mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 15:05:32 +00:00
Refactor default screen resize into SilverStripeContext
This commit is contained in:
parent
01b129de35
commit
c0801a63ef
@ -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
|
||||
*
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user