ExpertPW-AUTH-00460 minutesPlaywright

Authenticate by API, reuse session, and handle orders 500

An expert suite must skip UI login, preserve the customer session, and verify a resilient order-history error state.

  • authentication
  • api
  • storage-state
  • network-mocking

Objective

What to automate

Authenticate through the API, reuse the session in Playwright, intercept the orders API with HTTP 500, and verify the visible error state.

Preconditions and test data

Preconditions

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

Test data

  • standard_user
  • Practice@123
  • mock status: 500

Expected result

The browser is authenticated without UI login and Order history renders its assertion-ready 500 error state.

Progressive hints

Hint 1

Create the session and authenticate in APIRequestContext.

Hint 2

Export or transfer the resulting cookie into the browser context.

Hint 3

Route only the orders request and fulfil with the API error envelope plus status 500.

I’ve tried it — show solution
  1. Create the session and authenticate in APIRequestContext.
  2. Export or transfer the resulting cookie into the browser context.
  3. Route only the orders request and fulfil with the API error envelope plus status 500.