mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Merge pull request #67 from tractorcow/pulls/refactor-resize
Refactor default screen resize into SilverStripeContext
This commit is contained in:
commit
16d5a0099b
@ -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…
Reference in New Issue
Block a user