Network Steps

Route stubs, mocks, delays, offline mode. Lets QA cover error states, 3G simulation, and dependency outages without staging changes.

Step phrasings in this group

The book sidebar lists each individual step page under this group.

Given the URL "**\/api/users" returns the JSON:

Stub a URL pattern with a JSON response body.

Given the URL "**\/api/login" returns status 401 with body "Unauthorized"

Stub a URL pattern with a status code and plain-text body.

Given the URL "**\/analytics.js" is blocked

Block a URL pattern entirely (network failure simulation).

Given the URL "**\/api/**" is delayed by 1500 ms

Delay matching requests by N milliseconds (slow-network simulation).

Given the network is offline

" or "*.png".`,

Given the network is online

Restore network connectivity after the network is offline.

Given I start recording network requests

Start recording every outgoing request for later assertion.

Then a request to "**\/api/users" should have been made

Assert at least one request matching a URL pattern was recorded.

Then a GET request to "**\/api/users" should have been made

Assert at least one HTTP-method-specific request was recorded.

Then no request to "**\/tracking" should have been made

Assert NO request matching a URL pattern was recorded.

Back to all step groups