IntermediatePW-MOCK-00325 minutesPlaywright

Recover from a controlled route error

A test must prove that a failed route stays visible and only a user-controlled retry makes the recovery request.

  • network-mocking
  • error-recovery

Objective

What to automate

Return HTTP 503 on the first request, then fulfil the learner-controlled retry with one replacement product.

Preconditions and test data

Preconditions

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

Test data

  • first response: HTTP 503
  • second response: HTTP 200
  • requests: 2

Expected result

The fixture displays HTTP_503, enables Retry request, then renders the recovery product after exactly one retry click.

Progressive hints

Hint 1

Count calls inside the route handler.

Hint 2

Assert the retry button becomes enabled after the controlled error.

Hint 3

Click Retry request once and verify the second visible outcome.

I’ve tried it — show solution
  1. Count calls inside the route handler.
  2. Assert the retry button becomes enabled after the controlled error.
  3. Click Retry request once and verify the second visible outcome.

The deliberately failing starter is in tests/network-mocking.spec.ts inside the TypeScript starter ZIP.