mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Ensure that the window is maximised prior to running each step
This commit is contained in:
parent
78cfd94240
commit
01b129de35
@ -59,13 +59,15 @@ class BasicContext extends BehatContext
|
||||
$this->context = $parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Mink session from MinkContext
|
||||
*/
|
||||
public function getSession($name = null)
|
||||
{
|
||||
return $this->getMainContext()->getSession($name);
|
||||
}
|
||||
/**
|
||||
* Get Mink session from MinkContext
|
||||
*
|
||||
* @return \Behat\Mink\Session
|
||||
*/
|
||||
public function getSession($name = null)
|
||||
{
|
||||
return $this->getMainContext()->getSession($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @AfterStep ~@modal
|
||||
@ -95,6 +97,21 @@ 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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user