The Minimal Workflow
.github/workflows/e2e.yml
name: E2E
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 20, cache: 'npm' }
- run: npm ci
- run: npx playwright install --with-deps
- run: npx playwright testMatrix Sharding for Speed
yaml
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- run: npx playwright test --shard=${{ matrix.shard }}/4Upload the HTML Report
yaml
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report-${{ matrix.shard }}
path: playwright-report
retention-days: 14CI Tips
- Cache ~/.cache/ms-playwright to speed up browser installs.
- Set retries: 2 in CI only, using process.env.CI.
- Fail the PR on any test failure — never continue-on-error.
- Post the HTML report URL as a PR comment for reviewers.
Get Playwright tutorials in your inbox
Weekly tips, real-world examples, and framework patterns – no spam, unsubscribe anytime.