diff --git a/core/lib/Drupal/Core/Php8/Behat/MinkSelenium2Driver/Selenium2Driver.php b/core/lib/Drupal/Core/Php8/Behat/MinkSelenium2Driver/Selenium2Driver.php index 6e21d72d8b..82e85709e8 100644 --- a/core/lib/Drupal/Core/Php8/Behat/MinkSelenium2Driver/Selenium2Driver.php +++ b/core/lib/Drupal/Core/Php8/Behat/MinkSelenium2Driver/Selenium2Driver.php @@ -979,13 +979,13 @@ public function evaluateScript($script) */ public function wait($timeout, $condition) { - $script = "return $condition;"; + $script = 'return (' . $condition . ');'; $start = microtime(true); $end = $start + $timeout / 1000.0; do { $result = $this->wdSession->execute(array('script' => $script, 'args' => array())); - usleep(100000); + usleep(10000); } while (microtime(true) < $end && !$result); return (bool) $result; @@ -1196,14 +1196,10 @@ private function uploadFile($path) } // Selenium only accepts uploads that are compressed as a Zip archive. - // @todo work out a better way to create an empty zip archive. PHP has - // deprecated using ZipArchive with an empty file but there is no obvious - // replacement. Deleting the file could lead to problems during - // concurrent testing so add .zip so the file does not exist. - $tempFilename = tempnam('', 'WebDriverZip') . '.zip'; + $tempFilename = tempnam('', 'WebDriverZip'); $archive = new \ZipArchive(); - $result = $archive->open($tempFilename, \ZipArchive::CREATE); + $result = $archive->open($tempFilename, \ZipArchive::OVERWRITE); if (!$result) { throw new DriverException('Zip archive could not be created. Error ' . $result); } diff --git a/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php b/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php index 29a5fc0247..605819c338 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/DrupalSelenium2Driver.php @@ -74,11 +74,7 @@ public function uploadFileAndGetRemoteFilePath($path) { } // Selenium only accepts uploads that are compressed as a Zip archive. - // @todo work out a better way to create an empty zip archive. PHP has - // deprecated using ZipArchive with an empty file but there is no obvious - // replacement. Deleting the file could lead to problems during - // concurrent testing so add .zip so the file does not exist. - $tempFilename = tempnam('', 'WebDriverZip') . '.zip'; + $tempFilename = tempnam('', 'WebDriverZip'); $archive = new \ZipArchive(); $result = $archive->open($tempFilename, \ZipArchive::OVERWRITE);