Browse files

Fix Behat window switching in chrome

  • Loading branch information...
1 parent 0c859b8 commit 54edc0ddacd421690b5d3e7a34de5bafa6fcdf58 @chillu chillu committed Aug 22, 2013
View
14 tests/behat/features/bootstrap/SilverStripe/Framework/Test/Behaviour/CmsUiContext.php
@@ -245,10 +245,13 @@ public function iCanSeeThePreviewPanel()
public function thePreviewContains($content)
{
$driver = $this->getSession()->getDriver();
- $driver->switchToIFrame('cms-preview-iframe');
+ // 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');
$this->getMainContext()->assertPageContainsText($content);
- $driver->switchToWindow();
+ $driver->switchToWindow($origWindowName);
}
/**
@@ -257,10 +260,13 @@ public function thePreviewContains($content)
public function thePreviewDoesNotContain($content)
{
$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');
-
$this->getMainContext()->assertPageNotContainsText($content);
- $driver->switchToWindow();
+ $driver->switchToWindow($origWindowName);
}
/**

0 comments on commit 54edc0d

Please sign in to comment.