MDL-69072 behat: Remove restart_browser_after feature

This is no longer required as the Mink session is restarted after every
test regardless.
This commit is contained in:
Andrew Nicols
2020-06-29 11:05:53 +08:00
parent 71fda60d39
commit 56ff846bbb
3 changed files with 4 additions and 27 deletions
-7
View File
@@ -777,13 +777,6 @@ $CFG->admin = 'admin';
// ),
// );
//
// You can force the browser session (not user's sessions) to restart after N seconds. This could
// be useful if you are using a cloud-based service with time restrictions in the browser side.
// Setting this value the browser session that Behat is using will be restarted. Set the time in
// seconds. Is not recommended to use this setting if you don't explicitly need it.
// Example:
// $CFG->behat_restart_browser_after = 7200; // Restarts the browser session after 2 hours
//
// All this page's extra Moodle settings are compared against a white list of allowed settings
// (the basic and behat_* ones) to avoid problems with production environments. This setting can be
// used to expand the default white list with an array of extra settings.
-20
View File
@@ -63,11 +63,6 @@ use Behat\Testwork\Hook\Scope\BeforeSuiteScope,
*/
class behat_hooks extends behat_base {
/**
* @var Last browser session start time.
*/
protected static $lastbrowsersessionstart = 0;
/**
* @var For actions that should only run once.
*/
@@ -191,12 +186,6 @@ class behat_hooks extends behat_base {
// Avoid parallel tests execution, it continues when the previous lock is released.
test_lock::acquire('behat');
// Store the browser reset time if reset after N seconds is specified in config.php.
if (!empty($CFG->behat_restart_browser_after)) {
// Store the initial browser session opening.
self::$lastbrowsersessionstart = time();
}
if (!empty($CFG->behat_faildump_path) && !is_writable($CFG->behat_faildump_path)) {
throw new behat_stop_exception('You set $CFG->behat_faildump_path to a non-writable directory');
}
@@ -374,15 +363,6 @@ class behat_hooks extends behat_base {
$user = $DB->get_record('user', array('username' => 'admin'));
\core\session\manager::set_user($user);
// Reset the browser if specified in config.php.
if (!empty($CFG->behat_restart_browser_after) && $this->running_javascript()) {
$now = time();
if (self::$lastbrowsersessionstart + $CFG->behat_restart_browser_after < $now) {
$session->restart();
self::$lastbrowsersessionstart = $now;
}
}
// Set the theme if not default.
if ($suitename !== "default") {
set_config('theme', $suitename);
+4
View File
@@ -1,6 +1,10 @@
This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.
=== 3.5.11 ===
* The `$CFG->behat_retart_browser_after` configuration setting has been removed.
The browser session is now restarted between all tests.
=== 3.5.10 ===
* behat_data_generators::the_following_exist() has been removed, please use