Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
[CI] Speed up E2E tests
  • Loading branch information
adamziel committed Nov 28, 2025
commit a9f45cea8c2d7d0d5003815c91cc17c9cbd8e3b6
83 changes: 34 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,28 @@ jobs:
with:
name: cypress-screenshots
path: dist/cypress/packages/playground/website/screenshots
test-e2e-playwright-prepare:
# E2E Playwright tests - builds inline per runner for faster parallel execution
# Previously used a prepare job + artifact sharing, but inline builds allow
# all shards to start immediately in parallel, reducing total wall time.
test-e2e-playwright:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# 4 Chromium shards for fast parallel execution
# 1 Firefox runner (no sharding - acceptable to be slower)
# WebKit disabled - random failures, see PR #2475
include:
- browser: 'chromium'
shard: '1/4'
- browser: 'chromium'
shard: '2/4'
- browser: 'chromium'
shard: '3/4'
- browser: 'chromium'
shard: '4/4'
- browser: 'firefox'
shard: ''
steps:
- name: Free up runner disk space
shell: bash
Expand All @@ -201,68 +221,33 @@ jobs:
with:
submodules: true
- uses: ./.github/actions/prepare-playground
- name: Install Playwright Browsers
run: sudo npx playwright install --with-deps
- name: Prepare app deploy and offline mode
run: CORS_PROXY_URL=http://127.0.0.1:5263/cors-proxy.php? npx nx e2e:playwright:prepare-app-deploy-and-offline-mode playground-website
- name: Zip dist
run: zip -r dist.zip dist
- name: Upload dist
uses: actions/upload-artifact@v4
with:
name: playwright-dist
path: dist.zip
test-e2e-playwright:
runs-on: ubuntu-latest
needs: [test-e2e-playwright-prepare]
strategy:
fail-fast: false
matrix:
# WebKit runner is disabled in CI – it used to be enabled but the tests
# failed randomly without any obvious reason.
# @see https://github.com/WordPress/wordpress-playground/pull/2475
part: ['chromium', 'firefox']
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/actions/prepare-playground
- name: Download dist
uses: actions/download-artifact@v4
with:
name: playwright-dist
- name: Unzip dist
run: unzip dist.zip
- name: Install Playwright Browser
run: sudo npx playwright install ${{ matrix.part }} --with-deps
- name: Run Playwright tests - ${{ matrix.part }}
run: sudo npx playwright install ${{ matrix.browser }} --with-deps
- name: Build app for E2E tests
run: CORS_PROXY_URL=http://127.0.0.1:5263/cors-proxy.php? npx nx e2e:playwright:prepare-app-deploy-and-offline-mode playground-website
- name: Run Playwright tests - ${{ matrix.browser }}${{ matrix.shard && format(' (shard {0})', matrix.shard) || '' }}
run: |
if [ "${{ matrix.part }}" = "firefox" ]; then
sudo -E HOME=/root XDG_RUNTIME_DIR=/root CI=true npx playwright test --config=packages/playground/website/playwright/playwright.ci.config.ts --project=${{ matrix.part }}
SHARD_ARG=""
if [ -n "${{ matrix.shard }}" ]; then
SHARD_ARG="--shard=${{ matrix.shard }}"
fi
if [ "${{ matrix.browser }}" = "firefox" ]; then
sudo -E HOME=/root XDG_RUNTIME_DIR=/root CI=true npx playwright test --config=packages/playground/website/playwright/playwright.ci.config.ts --project=${{ matrix.browser }} $SHARD_ARG
else
sudo CI=true npx playwright test --config=packages/playground/website/playwright/playwright.ci.config.ts --project=${{ matrix.part }}
sudo CI=true npx playwright test --config=packages/playground/website/playwright/playwright.ci.config.ts --project=${{ matrix.browser }} $SHARD_ARG
fi
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report-${{ matrix.part }}
name: playwright-report-${{ matrix.browser }}${{ matrix.shard && format('-shard-{0}', matrix.shard) || '' }}
path: packages/playground/website/playwright-report/
if-no-files-found: ignore
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-snapshots-${{ matrix.part }}
name: playwright-snapshots-${{ matrix.browser }}${{ matrix.shard && format('-shard-{0}', matrix.shard) || '' }}
path: packages/playground/website/playwright/e2e/deployment.spec.ts-snapshots/
if-no-files-found: ignore
test-e2e-playwright-cleanup:
runs-on: ubuntu-latest
needs: [test-e2e-playwright]
steps:
- name: Delete playwright-dist artifact
uses: geekyeggo/delete-artifact@v5
if: ${{ success() }}
with:
name: playwright-dist

test-e2e-components:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions packages/playground/website/playwright/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ const baseURL =
export const playwrightConfig: PlaywrightTestConfig = {
testDir: './e2e',
/* Run tests in files in parallel */
fullyParallel: false,
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
retries: 3,
workers: 3,
workers: process.env.CI ? 4 : 3,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [['html'], ['list', { printSteps: true }]],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
Expand Down
Loading