Skip to content

Instantly share code, notes, and snippets.

@megclaypool
Last active April 18, 2018 18:42
Show Gist options
  • Save megclaypool/42dc283beccc8085a15f6e9c106d74f1 to your computer and use it in GitHub Desktop.
Save megclaypool/42dc283beccc8085a15f6e9c106d74f1 to your computer and use it in GitHub Desktop.
This Behat definition resizes the browser. I've discovered that Chrome defaults to a fairly wide browser whereas PhantomJS defaults to a very narrow browser... Either way, it's important to be able to resize the browser window so you can get specific versions of your sites/menus *on purpose* rather than by accident!
// Include the following step definition in your FeatureContext.php file:
/**
* @Given /^I set browser window size to "([^"]*)" x "([^"]*)"$/
*/
public function iSetBrowserWindowSizeToX($width, $height)
{
$this->getSession()->resizeWindow((int)$width, (int)$height, 'current');
}
# Include the following step in your .feature file, editing the sizes as appropriate:
Given I set browser window size to "1024" x "768"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment