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: jobs:
ui-tests: ui-tests:
name: Playwright E2E Tests name: Playwright E2E Tests (${{ matrix.shard }}/2)
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 60 timeout-minutes: 60
strategy:
fail-fast: false
matrix:
shard: [1, 2]
services: services:
redis-cache: redis-cache:
@@ -118,25 +122,25 @@ jobs:
npx playwright install --with-deps chromium npx playwright install --with-deps chromium
- name: Run Playwright Tests - name: Run Playwright Tests
run: npx playwright test run: npx playwright test --shard=${{ matrix.shard }}/2
env: env:
# localhost is a secure context, which crypto.randomUUID in frappe/ui needs. # localhost is a secure context, which crypto.randomUUID in frappe/ui needs.
BASE_URL: http://localhost:8000 BASE_URL: http://localhost:8000
ADMIN_PASSWORD: admin ADMIN_PASSWORD: admin
- name: Upload Playwright Report - name: Upload Blob Report
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
if: always() if: always()
with: with:
name: playwright-report name: blob-report-${{ matrix.shard }}
path: playwright-report/ path: blob-report/
retention-days: 7 retention-days: 1
- name: Upload Test Results - name: Upload Test Results
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
if: failure() if: failure()
with: with:
name: test-results name: test-results-${{ matrix.shard }}
path: test-results/ path: test-results/
retention-days: 7 retention-days: 7
@@ -146,3 +150,38 @@ jobs:
run: | run: |
cat bench_start.log || true cat bench_start.log || true
cat logs/*.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, workers: 1,
forbidOnly: !!process.env.CI, forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0, retries: process.env.CI ? 1 : 0,
reporter: process.env.CI // CI shards write blob reports that the merge-reports job joins into one HTML report.
? [["github"], ["html", { open: "never" }]] reporter: process.env.CI ? [["github"], ["blob"]] : "list",
: "list",
timeout: 60_000, timeout: 60_000,
expect: { timeout: 10_000 }, expect: { timeout: 10_000 },
use: { use: {