From 653101964d5bb7ddadb4aa44086fd997fbb6e459 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Thu, 28 Jan 2021 12:12:48 +0100 Subject: [PATCH] MDL-66979 behat: Goutte driver doesn't implement setTimeouts() 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. --- lib/tests/behat/behat_hooks.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/tests/behat/behat_hooks.php b/lib/tests/behat/behat_hooks.php index d2f0bea4c75..36f6a7eb353 100644 --- a/lib/tests/behat/behat_hooks.php +++ b/lib/tests/behat/behat_hooks.php @@ -303,11 +303,13 @@ EOF; 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, + ]); + } } /**