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
//Take a screenshot after the failed Step | |
/** | |
* @AfterStep | |
* @param AfterStepScope $event | |
* @throws UnsupportedDriverActionException | |
*/ | |
public function takeScreenshotAfterFailedStep($event) | |
{ | |
$this->getSession()->wait(2000, 'window.jQuery !== undefined'); |
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
/** | |
* Sets the specified multi-line value to the field | |
* | |
* @Given /^I set the text field "(?P<field_string>(?:[^"]|\\")*)" with multi-line text:/ | |
*/ | |
public function i_set_the_text_field_with_multi_line_text($field, \Behat\Gherkin\Node\PyStringNode $value) { | |
$this->getSession()->getPage()->fillField($field, $value); | |
} |
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
/** | |
* @When /^I click on the element with xpath "([^"]*)"$/ | |
* @param $xpath1 | |
*/ | |
public function iClickOnTheElementWithXpath($xpath1) | |
{ | |
$session = $this->getSession(); | |
$element = $session->getPage()->find('xpath',$session->getSelectorsHandler()->selectorToXpath('xpath', '*//*[text()="'. $xpath1.'"]') |
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
/** | |
* @AfterStep | |
* @param AfterStepScope $event | |
* @throws UnsupportedDriverActionException | |
*/ | |
public function takeScreenshotAfterFailedStep($event) | |
{ | |
$this->getSession()->wait(2000, 'window.jQuery !== undefined'); | |
if (!$event->getTestResult()->isPassed()) { | |
$this->takeScreenshot("Fail"); |
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
/** | |
* @Then /^I click on the element with CSS selector "([^"]*)"$/ | |
*/ | |
public function iClickOnTheElementWithCSSSelector($cssSelector) | |
{ | |
$element = $this->getSession()->getPage()->find( | |
'xpath', $this->getSession()->getSelectorsHandler()->selectorToXpath('css', $cssSelector)); | |
if (null === $element) { | |
throw new \InvalidArgumentException(sprintf('Could not evaluate CSS Selector: "%s"', $cssSelector)); | |
} |
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
/** | |
* @Given /^I provide a string with a alphanumeric value$/ | |
*/ | |
public function iProvideAStringWithAAlphanumericValue() | |
{ | |
$length = 10; | |
$characters = '0123456789abcdefghijklmnopqrstuvwxyz'; | |
$charactersLength = strlen($characters); | |
$randomString = ''; |