Skip to content

Instantly share code, notes, and snippets.

@balsama
Created March 3, 2016 16:51
Show Gist options
  • Save balsama/bc6bc9df4c9cbffa703a to your computer and use it in GitHub Desktop.
Save balsama/bc6bc9df4c9cbffa703a to your computer and use it in GitHub Desktop.
Handy step definitions
/**
* Resizes the window to 1440x900
*
* @When I make the window big
*/
public function makeTheWindowBig() {
$this->getSession()->resizeWindow(1440, 900, 'current');
}
/**
* Takes a screenshot
*
* @param sting $filename
* The name of the screenshot file
*
* @When I take a screenshot named :filename
*/
public function takeScreenshotAfterFailedStep($filename) {
$screenshot = $this->getSession()->getDriver()->getScreenshot();
$filepath = sys_get_temp_dir() . DIRECTORY_SEPARATOR;
file_put_contents($_SERVER['HOME'] . '/' . $filename . '.png', $screenshot);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment