Created
March 7, 2014 14:18
-
-
Save akuzemchak/9412280 to your computer and use it in GitHub Desktop.
Take screenshot of failed Behat step
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
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