Skip to content

Instantly share code, notes, and snippets.

@Spoygg
Created April 23, 2013 12:08
Show Gist options
  • Save Spoygg/5443042 to your computer and use it in GitHub Desktop.
Save Spoygg/5443042 to your computer and use it in GitHub Desktop.
/** @AfterStep */
public function showContentAfterFailure(StepEvent $event)
{
try {
if ($event->hasException()) {
$this->saveScreenshot(
sprintf(
'screenshot-%s-%s.png',
date('Y-m-d_h-i-s', time()),
str_replace(' ', '_', $event->getLogicalParent()->getTitle())
),
'/source'
);
}
} catch (UnsupportedDriverActionException $exception) {
// Screenshot will not be saved for contexts that do not
// support screenshots.
// $this->printLastResponse();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment