▲ 2 r/Playwright
Need authorization storage state flow advice
My app authenticates via an external OAuth 2.0 provider. I added a worker fixture that runs before each test and saves the storage state for a unique user into a file - this works fine.
But I’m going to have some tests where this isn’t necessary: a single user would be enough, since the state won’t change.
What’s the best way to handle this?
- Create a new fixture that saves the storage state for one shared user
- Do it via a setup project with project dependencies?
As I see it, both approaches have a downside: test organization. I’d have to move the tests that don’t modify state into a separate folder. But the spec/test cases that automation is based on doesn’t account for that, so it could easily lead to chaos and confusion.
Any advice would be appreciated.
u/Zestyclose_Inside498 — 3 days ago