Last active
August 29, 2015 14:09
-
-
Save bourg-ismael/059a249e8f28de4eecdb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
│ http://192.168.33.120/ | |
│ | |
│ | |
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') = 'hidden')][((.\/@id = 'login' or .\/@name = 'login') or .\/@id = \/\/label[normalize-space(string(.)) = 'login']\/@for or .\/@placeholder = 'login')] | \/\/html\/.\/\/label[normalize-space(string(.)) = 'login']\/\/.\/\/*[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') = 'hidden')] | \/\/html\/.\/\/*\n[self::input[translate(.\/@type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'radio' or translate(.\/@type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'checkbox' or translate(.\/@type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'file'] | self::select][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') = 'hidden')][((.\/@id = 'login' or .\/@name = 'login') or .\/@id = \/\/label[normalize-space(string(.)) = 'login']\/@for)] | \/\/html\/.\/\/label[normalize-space(string(.)) = 'login']\/\/.\/\/*[self::input[translate(.\/@type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'radio' or translate(.\/@type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'checkbox' or translate(.\/@type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'file'] | self::select][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') = 'hidden')]"); | |
while (node = result.iterateNext()) { | |
if (node.nodeType !== 10) { | |
pointers.push(node); | |
refs.push(pointers.length - 1); | |
} | |
} | |
stream.end(JSON.stringify(refs)); (Behat\Mink\Exception\DriverException) | |
And I fill in "password" with "toto" # FeatureContext::fillField() | |
And I press "loginButton" # FeatureContext::pressButton() | |
Given I go to "removeTou" # FeatureContext::visit() | |
Given I go to "params" # FeatureContext::visit() | |
And I fill in "zipCode" with "94200" # FeatureContext::fillField() | |
And I press "saveButton" # FeatureContext::pressButton() | |
Given I go to "assessment/launch/4" # FeatureContext::visit() | |
And I press "startButton" # FeatureContext::pressButton() | |
And I follow "modalConfirm" # FeatureContext::clickLink() | |
Given wait 1 seconds # FeatureContext::waitSeconds() | |
Then I follow "181" # FeatureContext::clickLink() | |
Given wait 2 seconds # FeatureContext::waitSeconds() | |
And I press "184" # FeatureContext::pressButton() | |
Given wait 2 seconds # FeatureContext::waitSeconds() | |
And I press "186" # FeatureContext::pressButton() | |
Given wait 2 seconds # FeatureContext::waitSeconds() | |
And I press "187" # FeatureContext::pressButton() | |
Given wait 2 seconds # FeatureContext::waitSeconds() | |
And I press "190" # FeatureContext::pressButton() | |
Given wait 2 seconds # FeatureContext::waitSeconds() | |
And I press "201" # FeatureContext::pressButton() | |
Given wait 2 seconds # FeatureContext::waitSeconds() | |
And I press "204" # FeatureContext::pressButton() | |
Given wait 2 seconds # FeatureContext::waitSeconds() | |
When I select "Oui" from "wholesomeConditions" # FeatureContext::selectOption() | |
When I select "Oui" from "honnesty" # FeatureContext::selectOption() | |
Given I go to "logout" # FeatureContext::visit() | |
Then I should be on "register" # FeatureContext::assertPageAddress() | |
--- Failed scenarios: | |
features/CandidateMiniEval.feature:8 | |
1 scenario (1 failed) | |
32 steps (3 passed, 1 failed, 28 skipped) | |
0m9.23s (13.17Mb) | |
Behat.yml : | |
default: | |
extensions: | |
Behat\MinkExtension: | |
base_url: http://192.168.33.120/ | |
javascript_session: zombie | |
goutte: | |
guzzle_parameters: | |
curl.options: | |
CURLOPT_HTTPHEADER: ["Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4;"] | |
selenium2: ~ | |
zombie: ~ | |
FeatureContext.php : | |
<?php | |
use Behat\Behat\Context\ClosuredContextInterface, | |
Behat\Behat\Context\TranslatedContextInterface, | |
Behat\Behat\Context\BehatContext, | |
Behat\Behat\Exception\PendingException; | |
use Behat\Gherkin\Node\PyStringNode, | |
Behat\Gherkin\Node\TableNode; | |
use Behat\MinkExtension\Context\MinkContext; | |
/** | |
* Features context. | |
*/ | |
class FeatureContext extends MinkContext | |
{ | |
/** | |
* Initializes context. | |
* Every scenario gets it's own context object. | |
* | |
* @param array $parameters context parameters (set them up through behat.yml) | |
*/ | |
public function __construct(array $parameters = []) | |
{ | |
// Initialize your context here | |
} | |
/** | |
* @Given /^wait (\d+) seconds?$/ | |
*/ | |
public function waitSeconds($arg1) | |
{ | |
sleep($arg1); | |
} | |
/** | |
* @Given /^init curl$/ | |
*/ | |
public function curlInit() | |
{ | |
$this->getSession()->setRequestHeader('Accept-Language', 'fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4;'); | |
} | |
} | |
And my test : | |
# features/search.feature | |
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 | |
Given init curl | |
Given I go to homepage | |
Then print last response | |
When I fill in "login" with "clem_primary@assessfirst.com" | |
And I fill in "password" with "toto" | |
And I press "loginButton" | |
Given I go to "removeTou" | |
Given I go to "params" | |
And I fill in "zipCode" with "94200" | |
And I press "saveButton" | |
Given I go to "assessment/launch/4" | |
And I press "startButton" | |
And I follow "modalConfirm" | |
Given wait 1 seconds | |
Then I follow "181" | |
Given wait 2 seconds | |
And I press "184" | |
Given wait 2 seconds | |
And I press "186" | |
Given wait 2 seconds | |
And I press "187" | |
Given wait 2 seconds | |
And I press "190" | |
Given wait 2 seconds | |
And I press "201" | |
Given wait 2 seconds | |
And I press "204" | |
Given wait 2 seconds | |
When I select "Oui" from "wholesomeConditions" | |
When I select "Oui" from "honnesty" | |
Given I go to "logout" | |
Then I should be on "register" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment