Skip to content

Improve Playwright role-based auth storageState setup #471

Description

@tormi

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions