BEHAT_SCREEN_SIZE env var

This commit is contained in:
Ingo Schommer 2014-02-25 11:33:12 +13:00
parent 7f3cc3b6b9
commit d003707894
2 changed files with 14 additions and 0 deletions

View File

@ -280,6 +280,15 @@ Example: mymodule/tests/behat/features/bootstrap/MyModule/Test/Behaviour/Feature
}
}
### Screen Size
In some Selenium drivers like [SauceLabs](http://www.saucelabs.com) you can
define the desired browser window size through a `capabilities` definition.
By default, Selenium doesn't support this though, so we've added a workaround
through an environment variable:
BEHAT_SCREEN_SIZE=320x600 vendor/bin/behat
## FAQ
### FeatureContext not found

View File

@ -131,6 +131,11 @@ class SilverStripeContext extends MinkContext implements SilverStripeAwareContex
}
$this->testSessionEnvironment->startTestSession($this->getTestSessionState());
if($screenSize = getenv('BEHAT_SCREEN_SIZE')) {
list($screenWidth, $screenHeight) = explode('x', $screenSize);
$this->getSession()->resizeWindow((int)$screenWidth, (int)$screenHeight);
}
}
/**