GitHub Actions CI in Playwright

From the Playwright cheat sheet · Running Tests & CI · verified Jul 2026

GitHub Actions CI

Run Playwright tests in a GitHub Actions workflow

yaml
# .github/workflows/playwright.yml
name: Playwright Tests
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm ci
      - run: npx playwright install --with-deps
      - run: npx playwright test
      - uses: actions/upload-artifact@v4
        if: ${{ !cancelled() }}
        with:
          name: playwright-report
          path: playwright-report/
💡 --with-deps installs system libraries needed by browsers on the CI runner
⚡ Upload the HTML report as an artifact to debug failures without re-running
📌 Use if: ${{ !cancelled() }} so the report uploads even when tests fail
🟢 The init command generates this workflow automatically — customize as needed
cigithub-actionsworkflow

More Playwright tasks

Back to the full Playwright cheat sheet