TickYouOff
Back
🎭

Playwright E2E Testing Checklist

Hard 20 items · 2 hours
testuser's avatar
testuser Published 1 month ago

A practical checklist to set up robust end-to-end tests with Playwright. Ideal for developers and QA engineers who want reliable browser automation, auth reuse, parallel runs, CI integration, and visual checks.

Progress
0 / 20
  1. Install Node.js and Playwright browsers — Install Node LTS, add Playwright package, and run 'npx playwright install' to fetch browsers.
  2. Initialize Playwright project and config file — Create playwright.config.ts, set testDir, timeouts, and project browsers.
  3. Create Page Object Model (POM) structure
  4. Create a BasePage class with shared helpers — Include common navigation, waits, and element helpers for reuse.
  5. Create per-page classes with selectors and actions — Keep selectors and actions encapsulated to simplify tests.
  6. Export types and reusable fixtures for tests — Share locator types and fixtures to enforce consistent APIs.
  7. Implement test data isolation strategy
  8. Provision an isolated test database or container per run — Reset DB or use disposable containers to avoid cross-test pollution.
  9. Generate unique test data per test run — Use timestamps or UUIDs for users, emails, and resources to avoid collisions.
  10. Create and reuse auth storageState for authenticated flows
  11. Generate storageState with a login script or Playwright flow — Run a trusted login once to save state.json for reuse in tests.
  12. Load storageState in contextOptions and secure credentials — Apply storageState to browserContext; keep secrets out of the repo.
  13. Configure parallel execution and worker limits in config — Set workers, shard tests if needed, and monitor for flaky failures.
  14. Enable screenshots, traces, and videos on failure — Turn on artifacts for failing tests to speed up debugging.
  15. Add visual snapshot baseline and comparison workflow — Store baselines and review diffs; keep visuals under source control or CI artifacts.
  16. Integrate Playwright into CI and install browsers in pipeline — Install Playwright browsers in CI before running tests and cache node modules.
  17. Upload test artifacts and HTML reports from CI — Publish traces, videos, screenshots, and HTML reports as CI artifacts for review.
  18. Add retries, sensible timeouts, and flaky test annotations — Use retries sparingly and annotate flaky tests for future fixes.
  19. Run tests locally in headed mode and use the inspector to debug — Use 'npx playwright test --headed --debug' to interactively reproduce failures.
  20. Clean up test data and implement teardown scripts — Remove created users and reset external state after runs to avoid pollution.
Sign in to save
📝 My Notes