Skip to content

ci: add wp-env Playwright E2E workflow #6

ci: add wp-env Playwright E2E workflow

ci: add wp-env Playwright E2E workflow #6

Workflow file for this run

name: E2E (wp-env)
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
concurrency:
group: e2e-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e:
name: Playwright E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP 7.4
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer:v2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
# @wedevs/plugin-ui declares engines.node >= 22.
node-version: '22'
cache: npm
cache-dependency-path: |
package-lock.json
tests/pw/package-lock.json
- name: Build plugin
# Dev install on purpose: Mozart (post-install-cmd) only runs in dev
# mode and emits lib/packages/, which the plugin loads at runtime.
# build/, lib/ and vendor/ are all gitignored, so none of this is
# optional.
run: |
composer install --no-interaction --no-progress
npm ci
npm run build
- name: Stub tryaura-pro mapping
# .wp-env.json maps ../../../tryaura-pro (a sibling of the workspace).
# @lite never activates it, but a missing directory aborts wp-env start.
run: |
PRO_DIR="$(dirname "$GITHUB_WORKSPACE")/tryaura-pro"
mkdir -p "$PRO_DIR"
echo '<?php /* Plugin Name: TryAura Pro (CI stub) */' > "$PRO_DIR/tryaura-pro.php"
- name: Start wp-env
working-directory: tests/pw
run: |
npm ci
npx playwright install --with-deps chromium
npx wp-env start
- name: Run E2E specs
working-directory: tests/pw
run: npm run test:e2e
- name: Collect failure diagnostics
if: failure()
working-directory: tests/pw
run: npx wp-env logs tests --no-watch || true
- name: Upload Playwright artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-artifacts
path: tests/pw/test-results
retention-days: 7
if-no-files-found: ignore