Skip to content

Instantly share code, notes, and snippets.

View bourg-ismael's full-sized avatar

Ismael BOURG bourg-ismael

  • MiiMOSA
  • Levallois-Perret, France
View GitHub Profile
@bourg-ismael
bourg-ismael / gist:320293bf2dee81af65c9
Created November 3, 2014 15:56
Selenium PHPUnit Test
<?php
class Example extends PHPUnit_Extensions_SeleniumTestCase
{
protected function setUp()
{
$this->setBrowser("*firefox");
$this->setBrowserUrl("http://192.168.33.120/");
}
public function testMyTestCase()
15:47:14.121 INFO - OS: Linux 3.13.0-24-generic amd64
15:47:14.133 INFO - v2.9.0, with Core v2.9.0. Built from revision 14289
15:47:14.333 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
15:47:14.336 INFO - Version Jetty/5.1.x
15:47:14.338 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
15:47:14.339 INFO - Started HttpContext[/selenium-server,/selenium-server]
15:47:14.340 INFO - Started HttpContext[/,/]
15:47:14.367 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@2e447a24
15:47:14.367 INFO - Started HttpContext[/wd,/wd]
15:47:14.372 INFO - Started SocketListener on 0.0.0.0:4444
15:56:46.445 INFO - Launching a standalone server
15:56:46.483 INFO - Java: Oracle Corporation 24.65-b04
15:56:46.483 INFO - OS: Linux 3.13.0-24-generic amd64
15:56:46.507 INFO - v2.44.0, with Core v2.44.0. Built from revision 76d78cf
15:56:46.614 INFO - Default driver org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match with current platform: LINUX
15:56:46.664 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
15:56:46.666 INFO - Version Jetty/5.1.x
15:56:46.668 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
15:56:46.671 INFO - Started HttpContext[/selenium-server,/selenium-server]
15:56:46.672 INFO - Started HttpContext[/,/]
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:10081 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:10082 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:10083 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:34628 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
tcp6 0 0 :::111 :::* LISTEN -
tcp6 0 0 :::80 :::* LISTEN -
* About to connect() to 192.168.33.120 port 80 (#0)
* Trying 192.168.33.120... connected
* Connected to 192.168.33.120 (192.168.33.120) port 80 (#0)
> GET /register HTTP/1.1
> User-Agent: curl/7.21.4 (x86_64-apple-darwin12.2.0) libcurl/7.21.4 OpenSSL/0.9.8z zlib/1.2.5 libidn/1.20
> Host: 192.168.33.120
> Accept: */*
>
* Empty reply from server
* Connection #0 to host 192.168.33.120 left intact
curl 'http://192.168.33.120/register' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Cookie: PHPSESSID=v5pqhphhjrknibcgd351nk0rvr4f5nva; locale=fr_FR' -H 'Connection: keep-alive' --compressed
<!DOCTYPE html><html lang="en-us" id="extr-page">
<head>
<meta charset="utf-8">
<title>App AssessFirst</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black"> <!-- Le styles -->
<link href="/smartadmin/css/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" media="screen" rel="stylesheet" type="text/css">
<link href="/smartadmin/css/smartadmin-production.min.css" media="screen" rel="stylesheet" type="text/css">
<link href="/smartadmin/css/smartadmin-skins.min.css" media="screen" rel="stylesheet" type="text/css">
When I fill in "login" with "clem_primary@assessfirst.com" # FeatureContext::fillField()
Error "Cannot read property 'nodeType' of null" while executing code: var node,
refs = [],
result = browser.xpath("\/\/html\/.\/\/*\n[self::input[not(translate(.\/@type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'radio' or translate(.\/@type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'checkbox' or translate(.\/@type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'file')] | self::textarea][not(translate(.\/@type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'submit' or translate(.\/@type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'image' or translate(.\/@type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'button' or translate(.\/@type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'reset' or translate(.\/@type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = '
Feature: Search
I Login
As clem_primary
I need to be able to do the Mini Eval
@javascript
Scenario: Login with clem_primary Then Logout # features/CandidateMiniEval.feature:8
Given init curl # FeatureContext::curlInit()
Given I go to homepage # FeatureContext::iAmOnHomepage()
Then print last response # FeatureContext::printLastResponse()
<!DOCTYPE html><html lang="en-us" id="extr-page">
<head>
<meta charset="utf-8">
<title>App AssessFirst</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black"> <!-- Le styles -->
<link href="/smartadmin/css/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" media="screen" rel="stylesheet" type="text/css">
<link href="/smartadmin/css/smartadmin-production.min.css" media="screen" rel="stylesheet" type="text/css">