playwright-e2e-tests
Installation
SKILL.md
Playwright E2E Tests
Overview
End-to-end tests prove that real user journeys work in a real browser. Write few of them, make each one reliable, and locate elements the way users find them.
Method
- Setup (if missing):
npm init playwright@latest. ConfigurebaseURL,webServerto start the app,trace: "on-first-retry", and the browsers you support inplaywright.config.ts. - Pick journeys by risk: sign up / log in, the core purchase or create flow, payments, permissions. One spec file per journey.
- Set up state through the API or storage state, not through the UI, except in the test that covers that UI (log in once in a setup project and reuse
storageState). - Write steps with user-facing locators and web-first assertions (table below).
- Run
npx playwright test, thennpx playwright test --repeat-each=5on new tests to catch flakiness. Usenpx playwright show-traceon failures.