mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #3000 from mateusz/preview-behaviours
Add Behat behaviours to click links and submit forms in preview.
This commit is contained in:
commit
f58fd7ea55
@ -352,6 +352,42 @@ class CmsUiContext extends BehatContext {
|
||||
$driver->switchToWindow($origWindowName);
|
||||
}
|
||||
|
||||
/**
|
||||
* When I follow "my link" in preview
|
||||
*
|
||||
* @When /^(?:|I )follow "(?P<link>(?:[^"]|\\")*)" 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<button>(?:[^"]|\\")*)" in preview$/
|
||||
*/
|
||||
public function pressButtonInPreview($button) {
|
||||
$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');
|
||||
|
||||
$button = $this->fixStepArgument($button);
|
||||
$this->getSession()->getPage()->pressButton($button);
|
||||
|
||||
$driver->switchToWindow($origWindowName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Workaround for chosen.js dropdowns or tree dropdowns which hide the original dropdown field.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user