simulate_api_failure
Simulates API failures by intercepting matching browser requests and returning an error status, then checks whether the app shows the expected fallback UI.
Instructions
Opens the browser, redirects directly to the user application, and intercepts API requests matching a URL pattern to return an error status code. 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) | |
| headless | No | Whether to run in headless mode (default: false, launches real browser so user sees application) | |
| 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"} |
| preview_delay_ms | No | Milliseconds to pause after simulation before closing browser, allowing visual inspection (default: 2000) | |
| 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**') | |
| keep_browser_open | No | Keep browser window open after test completes so user can interactively inspect the app (default: false) | |
| api_health_check_url | No | Optional backend or hosted API health check URL to verify before running chaos test. Aborts if backend is down or errors. |