Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
462e3741
Commit
462e3741
authored
Jun 15, 2020
by
Andrew Nicols
Browse files
MDL-69072 behat: Relaunch browser session between scenarios
parent
67753d62
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/tests/behat/behat_hooks.php
View file @
462e3741
...
...
@@ -573,25 +573,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
();
}
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment