MDL-52932 behat: Restart session if it fails because of some reason

This commit is contained in:
Rajesh Taneja
2016-02-01 09:33:01 +08:00
parent 01478c3ae7
commit afeffc0a74
+11 -1
View File
@@ -393,7 +393,17 @@ class behat_hooks extends behat_base {
* @AfterScenario @_switch_window
*/
public function after_scenario_switchwindow(ScenarioEvent $event) {
$this->getSession()->restart();
for ($count = 0; $count < self::EXTENDED_TIMEOUT; $count) {
try {
$this->getSession()->restart();
break;
} catch (DriverException $e) {
// Wait for timeout and try again.
sleep(self::TIMEOUT);
}
}
// If session is not restarted above then it will try to start session before next scenario
// and if that fails then exception will be thrown.
}
/**