What problem does it solve?
Ensures consistent, testable authentication flows for Playwright end-to-end suites so tests don't waste time on flaky or duplicated login steps and teams can reuse authenticated contexts across tests and CI runs.
Core Features & Use Cases
- Auth Flow Contract: Defines required inputs (credentials, login URL, selectors) and outputs (authenticated Page and optional persisted storage state) for deterministic login flows.
- Integration Patterns: Describes when to use Page Object Model for complex login pages and when to use fixture-based pre-authenticated pages for multi-role scenarios.
- Storage State Management: Recommends saving and restoring storage state in a gitignored .auth directory, regenerating on CI, and one file per role for speed.
- Credential Sources & Safety: Advises using environment variables with safe fallbacks for local dev and never committing real credentials.
- Anti-Patterns & Best Practices: Lists common mistakes to avoid, such as logging in every test, using brittle selectors, or storing auth state in repo.
Quick Start
Use the playwright-auth guidance to implement a Playwright login flow that authenticates an admin user and saves storage state for reuse.