Summary
Standardize Playwright authentication using role-based setup projects and role-specific storage state files, so specs do not perform ad hoc login calls in test bodies.
Motivation
Some specs currently mix preloaded auth state with explicit loginAsAdmin() calls inside test bodies. This increases CI variability and makes multi-role coverage harder to scale and reason about.
Proposed improvements
- Add dedicated setup projects for each role (for example: admin, editor, viewer).
- Persist separate storage state files (for example under
playwright/.auth/).
- Configure role-specific browser projects to use the matching storage state.
- CRUD specs must not perform login in the test body; login happens in setup and auth state is reused.
- Document when explicit in-test login is still appropriate (for example: mid-test identity switches or login-flow tests).
Acceptance criteria
- Chromium CI tests pass using role-based storage states.
- Existing admin CRUD tests retain current behavior.
- At least one lower-role (editor or viewer) test path exists, or a scaffold test is committed.
- Default CRUD specs do not call
loginAsAdmin() inside test bodies.
Summary
Standardize Playwright authentication using role-based setup projects and role-specific storage state files, so specs do not perform ad hoc login calls in test bodies.
Motivation
Some specs currently mix preloaded auth state with explicit
loginAsAdmin()calls inside test bodies. This increases CI variability and makes multi-role coverage harder to scale and reason about.Proposed improvements
playwright/.auth/).Acceptance criteria
loginAsAdmin()inside test bodies.