SoftwareTestPilot
All discussions
Mei LiuJul 12

Playwright storageState expires mid-suite on long runs

Auth token has a 30 min TTL. Suite runs ~45 min. Half the specs fail on redirect to login. Refreshing storageState in globalSetup only helps for the first shard. What is your pattern for auto-refreshing storageState mid-run?

playwrightauthflaky
Related learningLearn this concept in the Playwright course

1 answer

Most helpful answer

Maya RaoJul 12

We do a light "auth ping" fixture that re-hydrates storageState if the JWT is close to expiry. Runs per-worker, not per-spec, so overhead is small.