← Files Web App QA & Release CopilotARCHIVED FILE

references/playwright-practices.md

1.05 KB · Nov 20, 2026 · 06:40 UTC

↓ Download file

See the change to this file →

# Playwright test design and CI debugging

Official sources:
- https://playwright.dev/docs/best-practices
- https://playwright.dev/docs/locators
- https://playwright.dev/docs/test-assertions
- https://playwright.dev/docs/trace-viewer
- https://playwright.dev/docs/test-projects

## Rules
Inspect existing Playwright version and fixtures. Favor `getByRole`, `getByLabel` and explicit test-id contracts; avoid brittle structure-based selectors and positional locators. Prefer web-first assertions such as `await expect(locator).toBeVisible()` and Playwright's actionability checks. Avoid arbitrary sleeps and accidental dependence on execution order.

Use isolated state and deterministic data. Collect traces on first retry for CI failures. Distinguish retries that indicate flakiness from fixed outcomes; repeated run matrices should record pass/fail and worker/browser/version. Don't obscure network errors or weaken expectations to make tests pass.

Test only the supported browser/device matrix. Safari-like WebKit is not a blanket proof of real Safari device behavior.

SHA-256: 2f682b1bff227ba41769e171b3de8548ec1bb3796a34976e6f640dbbd9065dbe