Refactor default screen resize into SilverStripeContext

This commit is contained in:
Damian Mooyman 2014-08-14 16:21:31 +12:00
parent 01b129de35
commit c0801a63ef
2 changed files with 7 additions and 21 deletions

View File

@ -97,21 +97,6 @@ JS;
$this->getSession()->executeScript($javascript);
}
/**
* @BeforeStep ~@resizes&&~@modal
*
* Resize the window to maximum size, unless the step will resize itself
*/
public function maximiseWindowBeforeStep(StepEvent $event) {
$driver = $this->getSession()->getDriver();
if($screenSize = getenv('BEHAT_SCREEN_SIZE')) {
list($screenWidth, $screenHeight) = explode('x', $screenSize);
$driver->resizeWindow((int)$screenWidth, (int)$screenHeight);
} else {
$driver->resizeWindow(1024, 768);
}
}
/**
* @AfterStep ~@modal
*

View File

@ -205,10 +205,11 @@ class SilverStripeContext extends MinkContext implements SilverStripeAwareContex
$this->testSessionEnvironment->loadFixtureIntoDb($fixtureFile);
}
if($screenSize = getenv('BEHAT_SCREEN_SIZE')) {
list($screenWidth, $screenHeight) = explode('x', $screenSize);
$this->getSession()->resizeWindow((int)$screenWidth, (int)$screenHeight);
} else {
$this->getSession()->resizeWindow(1024, 768);
}
}