Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Playwright infrastructure for E2E tests #2733

Merged
merged 7 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/e2e-tests-playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: End-to-end (e2e) Tests - Playwright

on:
# Run on all pull requests.
pull_request:
push:
branches:
- trunk

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
test:
name: e2e against WordPress latest
runs-on: ubuntu-20.04

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Refresh Composer autoload files
run: composer dump-autoload --classmap-authoritative

- name: Use desired version of NodeJS
uses: actions/[email protected]
with:
node-version: 16
cache: npm

- name: Npm install
run: |
npm ci

- name: Install Playwright dependencies
run: |
npx playwright install chromium --with-deps

- name: Start up WordPress environment
run: |
npm run dev:start

- name: Running the tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: |
npm run test:e2e:playwright

- name: Stop WordPress environment
run: |
npm run dev:stop

- name: Archive e2e results
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-results
path: artifacts
1 change: 1 addition & 0 deletions jest-e2e.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ const baseConfig = require( '@wordpress/scripts/config/jest-e2e.config' );

module.exports = {
...baseConfig,
testMatch: [ '**/tests/e2e/specs/**/*.[jt]s?(x)' ], // Prevent running Playwright tests.
testTimeout: 35000, // Increased timeout for E2E tests.
};
Loading
Loading