Network & mocking
Task-first recipes for network & mocking.
Use API request context
Create data, call backend endpoints, and verify side effects with the browser context's API client.
Wait for a network response
Trigger a request, wait for its response, then assert on both the payload and the UI.
Mock an API response
Serve a fixed JSON payload for an endpoint so you can reach a rare or fragile UI state.
Block unwanted requests
Abort images, fonts, and third-party trackers so a run loads only what the test needs.