Merge branch 'MDL-66979-master-7' of git://github.com/andrewnicols/moodle

This commit is contained in:
Eloy Lafuente (stronk7)
2021-01-28 09:07:39 +01:00
2 changed files with 34 additions and 4 deletions
+2 -2
View File
@@ -898,7 +898,7 @@ $CFG->admin = 'admin';
// ),
// 'extensions' => array(
// 'Behat\MinkExtension' => array(
// 'selenium2' => array(
// 'webddriver' => array(
// 'browser' => 'firefox',
// 'capabilities' => array(
// 'platform' => 'OS X 10.6',
@@ -911,7 +911,7 @@ $CFG->admin = 'admin';
// 'Mac-Safari' => array(
// 'extensions' => array(
// 'Behat\MinkExtension' => array(
// 'selenium2' => array(
// 'webddriver' => array(
// 'browser' => 'safari',
// 'capabilities' => array(
// 'platform' => 'OS X 10.8',
+32 -2
View File
@@ -290,13 +290,26 @@ EOF;
if ($session->isStarted()) {
$session->restart();
} else {
$session->start();
$this->start_session();
}
if ($this->running_javascript() && $this->getSession()->getDriver()->getWebDriverSessionId() === 'session') {
throw new DriverException('Unable to create a valid session');
}
}
/**
* Start the Session, applying any initial configuratino required.
*/
protected function start_session(): void {
$this->getSession()->start();
$this->getSession()->getDriver()->setTimeouts([
// The standard script timeout is 30000 ms.
// Use `get_real_timeout` to multiply this by the behat increased timeout factor.
'script' => self::get_real_timeout(30000),
]);
}
/**
* Restart the session before each non-javascript scenario.
*
@@ -660,7 +673,24 @@ EOF;
* @AfterScenario
*/
public function reset_webdriver_between_scenarios(AfterScenarioScope $scope) {
$this->getSession()->stop();
try {
$this->getSession()->stop();
} catch (Exception $e) {
$error = <<<EOF
Error while stopping WebDriver: %s (%d) '%s'
Attempting to continue with test run. Stacktrace follows:
%s
EOF;
error_log(sprintf(
$error,
get_class($e),
$e->getCode(),
$e->getMessage(),
format_backtrace($e->getTrace(), true)
));
}
}
/**