MDL-43439: Behat - new $CFG param - behat_screenshot_after_failure

This commit is contained in:
Damyon Wiese
2014-01-10 17:54:53 +08:00
committed by David Monllao
parent 8a0667a994
commit 3ec07614ba
+15
View File
@@ -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.
*