Quick reference

Playwright best practices checklist

The highest-impact habits from this guide, grouped by where they apply: writing tests, building them to last, and running them efficiently.

Write

Test what users see, not implementation details

Keep every test isolated, with its own data and context

Build

Prefer user-facing locators over CSS or XPath

Use web-first assertions that retry automatically

Generate locators with codegen when you're unsure

Run & debug

Test across all three browser engines

Debug CI failures with the trace viewer

Run tests in parallel, sharded across machines

Source: Playwright official documentation