Skip to content
Permalink
Browse files

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

  • Loading branch information...
Rajesh Taneja
Rajesh Taneja committed Jan 29, 2016
1 parent eddec36 commit 5e48383330557fe2b143762f6b92f37d898c5d68
Showing with 11 additions and 1 deletion.
  1. +11 −1 lib/tests/behat/behat_hooks.php
@@ -393,7 +393,17 @@ public function after_step(StepEvent $event) {
* @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.
}
/**

0 comments on commit 5e48383

Please sign in to comment.
You can’t perform that action at this time.