playwright

Playwright

Used in 841 typescript projects (avg ★1224)

TypeScript
Testing
Used by 841 projects

Details

Language / Topic
typescriptTypeScript
Category
Testing

Rules

balanced
- Use Playwright for E2E, integration, and browser tests simulating user interactions.
- Write tests in TypeScript for type-safe selectors, actions, and assertions.
- Run tests via `npx playwright test` or npm scripts for local and CI execution.
- Test across Chromium, Firefox, and WebKit browsers for cross-browser reliability.
- Configure playwright.config.ts with baseURL, viewport sizes, and timeouts to match production environments and reduce flakiness.
- Leverage auto-waiting features and expect() assertions for robust, low-maintenance tests without manual sleeps.
- Enable tracing, screenshots, and video capture on failure for efficient debugging of intermittent issues.
- Use getByRole, getByText, or getByTestId locators prioritizing accessibility over fragile selectors.