Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Take screenshot of failed Behat step
use Behat\Behat\Event\StepEvent;
use Behat\Behat\Event\SuiteEvent;
use Behat\MinkExtension\Context\MinkContext;
class FeatureContext extends MinkContext
* @AfterStep
public function after(StepEvent $event)
if ($event->hasException()) {
$title = $event->getLogicalParent()->getTitle();
$this->saveScreenshot($title . '.png', __DIR__ . '/../../logs');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment