diff --git a/config-dist.php b/config-dist.php index 336c7c607de..70464b0b26f 100644 --- a/config-dist.php +++ b/config-dist.php @@ -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', diff --git a/lib/tests/behat/behat_hooks.php b/lib/tests/behat/behat_hooks.php index d7fc9e77287..d2f0bea4c75 100644 --- a/lib/tests/behat/behat_hooks.php +++ b/lib/tests/behat/behat_hooks.php @@ -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 = <<getCode(), + $e->getMessage(), + format_backtrace($e->getTrace(), true) + )); + } } /**