ci(e2e): shard Playwright tests across two runners

This commit is contained in:
Ritvik Sardana
2026-09-30 14:24:25 +05:30
parent 0a538f3274
commit 4044a1a309
2 changed files with 48 additions and 10 deletions

View File

@@ -23,9 +23,13 @@ env:
jobs:
ui-tests:
name: Playwright E2E Tests
name: Playwright E2E Tests (${{ matrix.shard }}/2)
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
shard: [1, 2]
services:
redis-cache:
@@ -118,25 +122,25 @@ jobs:
npx playwright install --with-deps chromium
- name: Run Playwright Tests
run: npx playwright test
run: npx playwright test --shard=${{ matrix.shard }}/2
env:
# localhost is a secure context, which crypto.randomUUID in frappe/ui needs.
BASE_URL: http://localhost:8000
ADMIN_PASSWORD: admin
- name: Upload Playwright Report
- name: Upload Blob Report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 7
name: blob-report-${{ matrix.shard }}
path: blob-report/
retention-days: 1
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-results
name: test-results-${{ matrix.shard }}
path: test-results/
retention-days: 7
@@ -146,3 +150,38 @@ jobs:
run: |
cat bench_start.log || true
cat logs/*.log || true
merge-reports:
name: Merge Playwright Reports
needs: ui-tests
if: always()
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 24
- name: Install Playwright
run: yarn install --frozen-lockfile --ignore-scripts
- name: Download Blob Reports
uses: actions/download-artifact@v4
with:
path: all-blob-reports
pattern: blob-report-*
merge-multiple: true
- name: Merge Into HTML Report
run: npx playwright merge-reports --reporter html ./all-blob-reports
- name: Upload Playwright Report
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 7

View File

@@ -11,9 +11,8 @@ export default defineConfig({
workers: 1,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
reporter: process.env.CI
? [["github"], ["html", { open: "never" }]]
: "list",
// CI shards write blob reports that the merge-reports job joins into one HTML report.
reporter: process.env.CI ? [["github"], ["blob"]] : "list",
timeout: 60_000,
expect: { timeout: 10_000 },
use: {