diff --git a/tests/behat/features/bootstrap/SilverStripe/Framework/Test/Behaviour/CmsUiContext.php b/tests/behat/features/bootstrap/SilverStripe/Framework/Test/Behaviour/CmsUiContext.php index c7418590a..7f49a6c57 100644 --- a/tests/behat/features/bootstrap/SilverStripe/Framework/Test/Behaviour/CmsUiContext.php +++ b/tests/behat/features/bootstrap/SilverStripe/Framework/Test/Behaviour/CmsUiContext.php @@ -352,6 +352,42 @@ class CmsUiContext extends BehatContext { $driver->switchToWindow($origWindowName); } + /** + * When I follow "my link" in preview + * + * @When /^(?:|I )follow "(?P(?:[^"]|\\")*)" in preview$/ + */ + public function clickLinkInPreview($link) { + $driver = $this->getSession()->getDriver(); + // TODO Remove once we have native support in Mink and php-webdriver, + // see https://groups.google.com/forum/#!topic/behat/QNhOuGHKEWI + $origWindowName = $driver->getWebDriverSession()->window_handle(); + $driver->switchToIFrame('cms-preview-iframe'); + + $link = $this->fixStepArgument($link); + $this->getSession()->getPage()->clickLink($link); + + $driver->switchToWindow($origWindowName); + } + + /** + * When I press "submit" in preview + * + * @When /^(?:|I )press "(?P