Skip to content

Add Playwright e2e hello-world test with CI job #211

Add Playwright e2e hello-world test with CI job

Add Playwright e2e hello-world test with CI job #211

Workflow file for this run

name: CI
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ '7.4', '8.3' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Cache Composer
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.php }}-
- name: Install dependencies
run: npm ci
- name: Run linting
run: npm run lint
- name: Run build
run: npm run build
e2e:
name: E2E (Playwright)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium
- name: Build assets
run: npm run build
- name: Start wp-env
run: npm run env:start
- name: Run E2E tests
run: npm run test:e2e
- name: Stop wp-env
if: always()
run: npm run env:stop
- name: Upload Playwright artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-artifacts
path: artifacts/
retention-days: 7