simulate_api_failure
Intercept API requests to return error codes and verify fallback UI appears. Test resilience by simulating service failures.
Instructions
Intercepts API requests matching a URL pattern and makes them return an error status code. Navigates to the page and checks if a fallback UI element appears. Use to answer: does the app show a proper error state when the payment API returns 503?
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL of the page to test | |
| wait_ms | No | Milliseconds to wait after navigation before checking the fallback (default: 2000) | |
| viewport | No | Viewport size (default: 1280×720) | |
| status_code | No | HTTP error status code to return (default: 503) | |
| response_body | No | Response body to return for intercepted requests | {"error":"Service Unavailable"} |
| fallback_selector | No | CSS selector for the fallback UI that should appear (e.g., '.error-boundary') | |
| intercept_pattern | Yes | Glob pattern for requests to intercept (e.g., '**/api/payment**') |