From 19aa14832e48773f0d859cb946d7e2c1e33d8738 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Fri, 8 May 2026 19:20:43 +0800 Subject: [PATCH 1/2] Tests: Only run chromedriver in headless mode on GitHub Actions --- .github/workflows/tests.yml | 2 +- tests/EndToEnd.suite.yml | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 848acf7..ad0085a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -305,7 +305,7 @@ jobs: # Run Codeception End to End Tests. - name: Run tests/${{ matrix.test-groups }} working-directory: ${{ env.PLUGIN_DIR }} - run: php vendor/bin/codecept run tests/${{ matrix.test-groups }} --fail-fast + run: php vendor/bin/codecept run tests/${{ matrix.test-groups }} --env headless --fail-fast # Artifacts are data generated by this workflow that we want to access, such as log files, screenshots, HTML output. # The if: failure() directive means that this will run when the workflow fails e.g. if a test fails, which is needed diff --git a/tests/EndToEnd.suite.yml b/tests/EndToEnd.suite.yml index bce6fb9..df1fa6e 100644 --- a/tests/EndToEnd.suite.yml +++ b/tests/EndToEnd.suite.yml @@ -68,4 +68,27 @@ modules: wpRootFolder: '%WORDPRESS_ROOT_DIR%' dbUrl: '%WORDPRESS_DB_URL%' domain: '%WORDPRESS_DOMAIN%' - \ No newline at end of file + +# Environments +# +# Run with `vendor/bin/codecept run EndToEnd --env headless` to run Chrome in +# headless mode (used by GitHub Actions). Without `--env headless`, Chrome runs +# in headed mode so a developer can watch tests execute locally. +env: + headless: + modules: + config: + lucatume\WPBrowser\Module\WPWebDriver: + capabilities: + "goog:chromeOptions": + args: + - "--headless" + - "--disable-gpu" + - "--disable-dev-shm-usage" + - "--disable-software-rasterizer" + - "--proxy-server='direct://'" + - "--proxy-bypass-list=*" + - "--no-sandbox" + - "--user-agent=%TEST_SITE_HTTP_USER_AGENT%" + prefs: + download.default_directory: '%WORDPRESS_ROOT_DIR%' \ No newline at end of file From cee075021252d14333b45b896d046734603f902d Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Fri, 8 May 2026 23:36:18 +0800 Subject: [PATCH 2/2] Tests: Fix Runners on PHP 8.3 --- .github/workflows/tests.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 848acf7..3c035ef 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -180,6 +180,19 @@ jobs: php-version: ${{ matrix.php-versions }} coverage: xdebug + # Workaround for PHP 8.3 (and potentially other versions): the GitHub + # Actions ubuntu-latest runner ships with a pre-installed PHP that leaves + # an empty regular file at /run/php/php-fpm.sock. setup-php + # installs a different patch version on top, but PHP-FPM never replaces + # the stale file with a real Unix socket, so nginx returns 502. + # Removing the stale file and restarting PHP-FPM forces a clean socket. + - name: Restart PHP-FPM + run: | + sudo rm -f /run/php/php${{ matrix.php-versions }}-fpm.sock + sudo systemctl restart php${{ matrix.php-versions }}-fpm + sleep 1 + ls -la /run/php/ + # Configure nginx to use the PHP version and WOrdPress installation at /var/www/html - name: Configure nginx site run: |