Skip to content

Commit

Permalink
MDL-66979 behat: Goutte driver doesn't implement setTimeouts()
Browse files Browse the repository at this point in the history
Also, change:

get_real_timeout(30000)

to:

get_real_timeout(30) * 1000

because the original functions are defined to use seconds, and
having the 1000 around will help us detecting cases in the case
of a hypothetical review of uses.
  • Loading branch information
stronk7 authored and andrewnicols committed Jan 29, 2021
1 parent 63a322b commit ff1877c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/tests/behat/behat_hooks.php
Expand Up @@ -303,11 +303,13 @@ protected function restart_session(): void {
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),
]);
if ($this->running_javascript()) { // Goutte driver doesn't implement this.
$this->getSession()->getDriver()->setTimeouts([
// The standard script timeout is 30000 ms. (aka, 30 seconds).
// Use `get_real_timeout` to multiply this by the behat increased timeout factor.
'script' => self::get_real_timeout(30) * 1000,
]);
}
}

/**
Expand Down

0 comments on commit ff1877c

Please sign in to comment.