Config and CI

Playwright GitHub Actions CI

Run Playwright tests in GitHub Actions with browser installation, test commands, reports, traces, and uploaded CI artifacts.

CI Workflow

A Playwright CI workflow installs project dependencies, installs Playwright browsers, runs tests, and uploads reports or traces when failures happen.

YAML Setup

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

Installing Browsers

Playwright needs browser binaries and Linux dependencies in CI. That is why the install step usually includes --with-deps.

Reports and Artifacts

- uses: actions/upload-artifact@v4
  if: always()
  with:
    name: playwright-report
    path: playwright-report/

Common CI Failures

  • Browsers were not installed.
  • Base URL or environment variables are missing.
  • Tests share data and fail in parallel.
  • The app server is not started before tests.
  • Reports or traces are not uploaded, making failures hard to inspect.