Merge pull request #100 from scott1702/confirming-element-click

Add ability to confirm/dismiss dialogs after clicking in elements
This commit is contained in:
Ingo Schommer 2015-10-22 16:29:44 +13:00
commit cfd1044ae5
2 changed files with 25 additions and 0 deletions

View File

@ -592,6 +592,10 @@ It's based on the `vendor/bin/behat -di @cms` output.
Given /^I (?:press|follow) the "([^"]*)" (?:button|link), dismissing the dialog$/
Given /^I (click|double click) "([^"]*)" in the "([^"]*)" element, confirming the dialog$/
Given /^I (click|double click) "([^"]*)" in the "([^"]*)" element, dismissing the dialog$/
Given /^I confirm the dialog$/
Given /^I dismiss the dialog$/

View File

@ -397,6 +397,27 @@ JS;
$element->$clickTypeFn();
}
/**
* Needs to be in single command to avoid "unexpected alert open" errors in Selenium.
* Example: I click "Delete" in the ".actions" element, confirming the dialog
*
* @Given /^I (click|double click) "([^"]*)" in the "([^"]*)" element, confirming the dialog$/
*/
public function iClickInTheElementConfirmingTheDialog($clickType, $text, $selector) {
$this->iClickInTheElement($clickType, $text, $selector);
$this->iConfirmTheDialog();
}
/**
* Needs to be in single command to avoid "unexpected alert open" errors in Selenium.
* Example: I click "Delete" in the ".actions" element, dismissing the dialog
*
* @Given /^I (click|double click) "([^"]*)" in the "([^"]*)" element, dismissing the dialog$/
*/
public function iClickInTheElementDismissingTheDialog($clickType, $text, $selector) {
$this->iClickInTheElement($clickType, $text, $selector);
$this->iDismissTheDialog();
}
/**
* @Given /^I type "([^"]*)" into the dialog$/
*/