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
83e9f358
Commit
83e9f358
authored
Jul 01, 2020
by
Eloy Lafuente
Browse files
Merge branch 'MDL-69072-37' of
git://github.com/andrewnicols/moodle
into MOODLE_37_STABLE
parents
67753d62
60329816
Changes
4
Hide whitespace changes
Inline
Side-by-side
config-dist.php
View file @
83e9f358
...
...
@@ -799,13 +799,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.
...
...
lib/tests/behat/behat_hooks.php
View file @
83e9f358
...
...
@@ -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.
*/
...
...
@@ -196,12 +191,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'
);
}
...
...
@@ -378,15 +367,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
);
...
...
@@ -573,25 +553,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
();
}
/**
...
...
lib/upgrade.txt
View file @
83e9f358
This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.
=== 3.7.7 ===
* The `$CFG->behat_retart_browser_after` configuration setting has been removed.
The browser session is now restarted between all tests.
=== 3.7.6 ===
* database_manager::check_database_schema() now checks for missing indexes.
* Added function cleanup_after_drop to the database_manager class to take care of all the cleanups that need to be done after a table is dropped.
...
...
mod/scorm/tests/behat/behat_mod_scorm.php
deleted
100644 → 0
View file @
67753d62
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Steps definitions related to the SCORM activity module.
*
* @package mod_scorm
* @category test
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
require_once
(
__DIR__
.
'/../../../../lib/behat/behat_base.php'
);
use
Behat\Behat\Hook\Scope\AfterScenarioScope
;
/**
* Steps definitions related to the SCORM activity module.
*
* @package mod_scorm
* @category test
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class
behat_mod_scorm
extends
behat_base
{
/**
* Restart the Seleium Session after each mod_scorm Scenario.
*
* This prevents issues with the scorm player's onbeforeunload event, and cached SCORM content being served to the
* browser in subsequent tests.
*
* @AfterScenario @mod_scorm
* @param AfterScenarioScope $scope The scenario scope
*/
public
function
reset_after_scorm
(
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