MDL-43439: Behat - new $CFG param - behat_screenshot_after_failure
This commit is contained in:
committed by
David Monllao
parent
8a0667a994
commit
3ec07614ba
@@ -278,6 +278,21 @@ class behat_hooks extends behat_base {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Take screenshot when step fails.
|
||||
* Screenshot is saved at /tmp/
|
||||
*
|
||||
* @AfterStep
|
||||
*/
|
||||
public function take_screenshot_after_failed_step(Behat\Behat\Event\StepEvent $event) {
|
||||
global $CFG;
|
||||
|
||||
if (!empty($CFG->behat_screenshot_after_failure) &&
|
||||
$event->getResult() === Behat\Behat\Event\StepEvent::FAILED) {
|
||||
$this->saveScreenshot();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for all the JS to be loaded.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user