ExpertPW-MFA-00660 minutesPlaywright

Reuse an MFA-verified session

A successful MFA verification creates the same secure synthetic UI session contract used by other authenticated Lab flows.

  • authentication
  • storage-state
  • roles

Objective

What to automate

Verify an Admin MFA challenge, save browser storage state, and reuse it to read the current authenticated identity.

Preconditions and test data

Preconditions

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

Test data

  • username: admin_user
  • OTP: 480321
  • storage state: Playwright context

Expected result

The reused context identifies admin_user and retains the public Admin role without repeating the MFA request.

Progressive hints

Hint 1

Create and verify the MFA challenge before saving storage state.

Hint 2

Persist the context state through Playwright rather than reading the HttpOnly cookie value.

Hint 3

Open the Auth sandbox in the reused context and inspect the identity contract.

I’ve tried it — show solution
  1. Create and verify the MFA challenge before saving storage state.
  2. Persist the context state through Playwright rather than reading the HttpOnly cookie value.
  3. Open the Auth sandbox in the reused context and inspect the identity contract.

The deliberately failing starter is in tests/mfa.spec.ts inside the TypeScript starter ZIP.