Q&A
How do you persist authentication state across Playwright tests without logging in every time?
Ajitesh MohantaAmbassador
1w ago 1,269 0
Our Playwright suite has 200+ tests and login takes 3–4 seconds each time. Running everything serially we're losing ~15 minutes just to auth.
I know about `storageState` but I'm not sure of the right pattern when:
1. Some tests need a regular user, others need an admin
2. Tokens expire after 30 minutes (our staging env is aggressive about this)
3. We run tests in parallel across 4 workers
Do you re-use a single storage state file per role, regenerate per worker, or something else? Would love to see your `playwright.config.ts` setup if you've solved this cleanly.