🔑 I4 · Login via API with storageState

I4 · Login via API with storageState: `storageState` is I3's hybrid idea applied to LOGIN: instead of typing a username/password in the UI and clicking "Log In" in every test (SL

`storageState` is I3's hybrid idea applied to LOGIN: instead of typing a username/password in the UI and clicking "Log In" in every test (SLOW, a step REPEATED in every test), you log in ONCE via the API and save the resulting session info (cookie/token) to a FILE — every subsequent test LOADS this file and starts as if the user is ALREADY logged in. In Java this is similar to logging in ONCE at the start of a test SUITE and SHARING that session across all tests (setting it up once with `@BeforeAll` and sharing it). So why does this matter so much — wasn't login already tested SEPARATELY in I3? Because the OTHER tests in GROUP I (bug list, detail page) do NOT aim to test the login flow — REFILLING the login form at the start of every test DEVIATES from that test's ACTUAL purpose and adds needless fragility. **For a deep Playwright auth/storageState guide → see the `/playwright` page.**

🎬 One Login, Hundreds of Tests

Fill form + click in every test

THE SLOW PATH: 50 test files, EACH filling its own login form and clicking — a slow step repeated 50 times.

THE FAST PATH: log in ONCE via the API with `POST /login`.

The returned session info (cookie/token) is saved to `auth.json`.

The lesson — EACH of the 50 test files now starts "already logged in" by LOADING `auth.json`, NEVER seeing the login form.

The Order for Sharing an API Login

Create a setup project/file that runs before the tests.

After API login, write the session info to a file with storageState({ path: ... }).

Share this file across every test file with test.use({ storageState: ... }).

Order the steps for setting up shared API login with storageState.

Send the API login request in auth.setup.ts

Save the returned session to auth.json with storageState