mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-69072 behat: Relaunch browser session between scenarios
This commit is contained in:
parent
c11e2517a7
commit
675e981004
@ -576,25 +576,13 @@ class behat_hooks extends behat_base {
|
||||
}
|
||||
|
||||
/**
|
||||
* Executed after scenario having switch window to restart session.
|
||||
* This is needed to close all extra browser windows and starting
|
||||
* one browser window.
|
||||
* Reset the session between each scenario.
|
||||
*
|
||||
* @param AfterScenarioScope $scope scope passed by event fired after scenario.
|
||||
* @AfterScenario @_switch_window
|
||||
* @AfterScenario
|
||||
*/
|
||||
public function after_scenario_switchwindow(AfterScenarioScope $scope) {
|
||||
for ($count = 0; $count < behat_base::get_extended_timeout(); $count++) {
|
||||
try {
|
||||
$this->getSession()->restart();
|
||||
break;
|
||||
} catch (DriverException $e) {
|
||||
// Wait for timeout and try again.
|
||||
sleep(self::get_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.
|
||||
public function reset_webdriver_between_scenarios(AfterScenarioScope $scope) {
|
||||
$this->getSession()->stop();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user