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_userOTP: 480321storage 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
- Create and verify the MFA challenge before saving storage state.
- Persist the context state through Playwright rather than reading the HttpOnly cookie value.
- 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.