Testing / Playwright Interview questions
How can you integrate Playwright tests into a CI/CD pipeline?
The scaffolded project already includes a working GitHub Actions workflow, which is a reasonable template for most CI providers:
# .github/workflows/playwright.yml - uses: actions/setup-node@v4 - run: npm ci - run: npx playwright install --with-deps - run: npx playwright test - uses: actions/upload-artifact@v4 if: always() with: name: playwright-report path: playwright-report/
The --with-deps flag matters on Linux CI runners specifically, since it installs the OS-level libraries the browsers need beyond just the browser binaries themselves. Enabling trace: 'on-first-retry' in config and uploading the report and trace as build artifacts (with if: always(), so it runs even on failure) means a failing CI run leaves behind exactly the diagnostic evidence needed to debug it, instead of just a red X with no further detail.
For larger suites, adding a shard matrix (--shard=${{ matrix.shard }}/4 across a 4-job matrix) parallelizes the whole run across CI machines rather than one job working through everything sequentially.
More Related questions...