From 03ef97f483d2a924376270deca4a9e8f0a3fa1f1 Mon Sep 17 00:00:00 2001
From: Dave Long <dave@longwaveconsulting.com>
Date: Mon, 27 Jan 2025 12:54:26 +0000
Subject: [PATCH] Issue #3494332 by catch, berdir, longwave, godotislate, oily,
 rkoller, quietone: Functional Javascript tests are silently skipped on Gitlab
 CI due to selenium standalone configuration

---
 .gitlab-ci/pipeline.yml                           |  4 ++--
 .../WebDriverTestBase.php                         | 15 +++++----------
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/.gitlab-ci/pipeline.yml b/.gitlab-ci/pipeline.yml
index 3196e5078226..02b2f796fe95 100644
--- a/.gitlab-ci/pipeline.yml
+++ b/.gitlab-ci/pipeline.yml
@@ -94,8 +94,8 @@ variables:
     SE_NODE_OVERRIDE_MAX_SESSIONS: "true"
     SE_NODE_MAX_SESSIONS: "16"
     SE_SESSION_RETRY_INTERVAL: "1"
-    SE_SESSION_REQUEST_TIMEOUT: "10"
-    SE_START_XVFB: "false"
+    SE_SESSION_REQUEST_TIMEOUT: "60"
+    SE_START_XVFB: "true"
     SE_START_VNC: "false"
 
 .run-tests: &run-tests
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php b/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php
index ea7d7bb8dde2..627e24f317c9 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php
@@ -4,7 +4,6 @@
 
 namespace Drupal\FunctionalJavascriptTests;
 
-use Behat\Mink\Exception\DriverException;
 use Drupal\Component\Utility\UrlHelper;
 use Drupal\Tests\BrowserTestBase;
 use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -60,16 +59,12 @@ protected function initMink() {
     try {
       return parent::initMink();
     }
-    catch (DriverException $e) {
-      if ($this->minkDefaultDriverClass === DrupalSelenium2Driver::class) {
-        $this->markTestSkipped("The test wasn't able to connect to your webdriver instance. For more information read core/tests/README.md.\n\nThe original message while starting Mink: {$e->getMessage()}");
-      }
-      else {
-        throw $e;
-      }
-    }
     catch (\Exception $e) {
-      $this->markTestSkipped('An unexpected error occurred while starting Mink: ' . $e->getMessage());
+      // If it's not possible to get a mink connection ensure that mink's own
+      // destructor is called immediately, to avoid it being called in
+      // ::tearDown(), then rethrow the exception.
+      $this->mink = NULL;
+      throw $e;
     }
   }
 
-- 
GitLab