From b789a3b67c849f97e80c0aa6bac98210818555ec Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Fri, 16 May 2014 10:25:53 +1200 Subject: [PATCH] Adding "I follow the link "test", dismissing the dialog" step --- README.md | 4 ++++ .../BehatExtension/Context/BasicContext.php | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/README.md b/README.md index 860cb0f..e8c0442 100644 --- a/README.md +++ b/README.md @@ -569,6 +569,10 @@ It's based on the `vendor/bin/behat -di @cms` output. Given /^I type "([^"]*)" into the dialog$/ + Given /^I (?:press|follow) the "([^"]*)" (?:button|link), confirming the dialog$/ + + Given /^I (?:press|follow) the "([^"]*)" (?:button|link), dismissing the dialog$/ + Given /^I confirm the dialog$/ Given /^I dismiss the dialog$/ diff --git a/src/SilverStripe/BehatExtension/Context/BasicContext.php b/src/SilverStripe/BehatExtension/Context/BasicContext.php index 7f78c98..9329b84 100644 --- a/src/SilverStripe/BehatExtension/Context/BasicContext.php +++ b/src/SilverStripe/BehatExtension/Context/BasicContext.php @@ -331,6 +331,18 @@ JS; $this->iConfirmTheDialog(); } + /** + * Needs to be in single command to avoid "unexpected alert open" errors in Selenium. + * Example: I follow the "Remove current combo" link, dismissing the dialog + * + * @Given /^I (?:press|follow) the "([^"]*)" (?:button|link), dismissing the dialog$/ + */ + public function stepIPressTheButtonDismissingTheDialog($button) + { + $this->stepIPressTheButton($button); + $this->iDismissTheDialog(); + } + /** * @Given /^I click "([^"]*)" in the "([^"]*)" element$/ */