Skip to content

Fix E2E tests stability #184

Fix E2E tests stability

Fix E2E tests stability #184

Workflow file for this run

name: E2E Tests
on:
workflow_call:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e:
name: PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }}
runs-on: ubuntu-24.04
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
php: ["8.2", "8.3", "8.4"]
wordpress: ["6.7", "6.8"]
steps:
- name: Checkout plugin
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
# Host PHP is used only to run Pest; WordPress PHP is set via WP_ENV_PHP_VERSION below.
php-version: 8.4
extensions: mysqli, zip, gd
coverage: none
- name: Install pnpm
uses: pnpm/action-setup@v5
with:
version: 10
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: lts/*
cache: "pnpm"
- name: Install pnpm dependencies
run: pnpm install
- name: Set WordPress version override
run: |
echo '{"core": "https://wordpress.org/wordpress-${{ matrix.wordpress }}.zip"}' > .wp-env.override.json
- name: Start wp-env
run: pnpm exec wp-env start
env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
- name: Install Playwright browsers
run: pnpm run tests:install
- name: Cache composer dependencies
uses: actions/cache@v5
with:
path: vendor
key: composer-${{ hashFiles('composer.lock') }}
- name: Run composer install
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Run Pest tests
run: ./vendor/bin/pest -v --ci --bail --colors=always
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results-php${{ matrix.php }}-wp${{ matrix.wordpress }}
path: tests/Browser/Screenshots
retention-days: 30