IntermediatePW-AUTH-00225 minutesPlaywright

Reuse authenticated storage state

Several specs need the same signed-in customer without repeating UI login.

  • authentication
  • storage-state

Objective

What to automate

Save standard_user browser state and reuse it in a fresh context.

Preconditions and test data

Preconditions

  • Use a fresh isolated Practice Lab browser context.
  • Open the fixture identified by FX-AUTH-001.

Test data

  • standard_user
  • Practice@123
  • state file: playwright/.auth/customer.json

Expected result

A new page starts authenticated as standard_user without submitting login.

Progressive hints

Hint 1

Authenticate once in setup.

Hint 2

Call storageState after the signed-in assertion.

Hint 3

Create a new context from that state and inspect the session.

I’ve tried it — show solution
  1. Authenticate once in setup.
  2. Call storageState after the signed-in assertion.
  3. Create a new context from that state and inspect the session.