From fa36a29b2805fcfb47373389ed5595952654f34c Mon Sep 17 00:00:00 2001
From: Joe Corall <joe@libops.io>
Date: Tue, 23 Apr 2024 05:06:39 -0400
Subject: [PATCH] back to selenium

---
 .github/workflows/build-2.x.yml | 20 ++++++++------------
 phpunit.xml                     |  2 +-
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/.github/workflows/build-2.x.yml b/.github/workflows/build-2.x.yml
index 53fc8dcc..c3ffe2a5 100644
--- a/.github/workflows/build-2.x.yml
+++ b/.github/workflows/build-2.x.yml
@@ -22,8 +22,7 @@ jobs:
       SCRIPT_DIR: ${{ github.workspace }}/islandora_ci
       DRUPAL_DIR: /opt/drupal
       PHPUNIT_FILE: ${{ github.workspace }}/build_dir/phpunit.xml
-      MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", {"browserName":"chrome","chromeOptions":{"args":["--disable-gpu","--headless", "--no-sandbox"]}}, "http://localhost:9515"]'
-      SIMPLETEST_BASE_URL: http://host.docker.internal:8282
+      MINK_DRIVER_ARGS_WEBDRIVER: '["firefox", null, "http://localhost:4444/wd/hub"]'
 
     # The type of runner that the job will run on
     runs-on: ubuntu-latest
@@ -57,12 +56,10 @@ jobs:
           - 8161:8161
           - 61616:61616
           - 61613:61613
-      chromedriver:
-        image: drupalci/webdriver-chromedriver:production
+      firefox:
+        image: selenium/standalone-firefox:3.141
         ports:
-          - 9515:9515
-        # chromedriver needs to access drupal running on the host
-        options: --add-host=host.docker.internal:host-gateway
+          - 4444:4444
 
     # Steps represent a sequence of tasks that will be executed as part of the job
     steps:
@@ -125,12 +122,11 @@ jobs:
       - name: Test scripts
         run: $SCRIPT_DIR/travis_scripts.sh
 
-      - name: Add hosts to /etc/hosts
-        run: |
-          echo "127.0.0.1 host.docker.internal" | sudo tee -a /etc/hosts
       - name: PHPUNIT tests
         run: |
           cd $DRUPAL_DIR/web/core
           $DRUPAL_DIR/vendor/bin/phpunit --verbose --testsuite "${{ matrix.test-suite }}"
-          docker logs $(docker container ls --format "{{.Names}}" | grep chromedriver)
-          drush watchdog:show
+          if [ "${{ matrix.test-suite }}" = "functional-javascript" ]; then
+            echo "Printing selenium logs"
+            docker logs $(docker container ls --format "{{.Names}}" | grep firefox)
+          fi
diff --git a/phpunit.xml b/phpunit.xml
index d88400c0..46e82e78 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -28,7 +28,7 @@
     <!-- Do not limit the amount of memory tests take to run. -->
     <ini name="memory_limit" value="-1"/>
     <!-- Example SIMPLETEST_BASE_URL value: http://localhost -->
-    <env name="SIMPLETEST_BASE_URL" value="http://localhost:8282"/>
+    <env name="SIMPLETEST_BASE_URL" value="http://127.0.0.1:8282"/>
     <!-- Example SIMPLETEST_DB value: mysql://username:password@localhost/databasename#table_prefix -->
     <env name="SIMPLETEST_DB" value="mysql://drupal:drupal@127.0.0.1/drupal"/>
     <!-- Example BROWSERTEST_OUTPUT_DIRECTORY value: /path/to/webroot/sites/simpletest/browser_output -->