Add ability to confirm/dismiss dialogs after clicking in elements

This commit is contained in:
scott1702 2015-10-22 16:27:48 +13:00
parent 6009c5bdbd
commit 33eb0adf0c
2 changed files with 25 additions and 0 deletions

View File

@ -591,6 +591,10 @@ It's based on the `vendor/bin/behat -di @cms` output.
Given /^I (?:press|follow) the "([^"]*)" (?:button|link), confirming the dialog$/
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$/

View File

@ -394,6 +394,27 @@ JS;
$element->click();
}
/**
* 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$/