simulate_stateful_failure
Fails the first N intercepted browser requests with an HTTP error, then allows later requests to succeed so you can verify retry and recovery behavior.
Instructions
Opens the browser, navigates to the application, and intercepts requests matching a URL pattern. Fails the first N requests with an error status, then lets subsequent requests succeed. Simulates transient failures and tests retry/recovery logic. Use to answer: does the app retry after a 503 and recover when the service comes back?
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL of the page to test | |
| wait_ms | No | Milliseconds to wait after navigation before checking state (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) | |
| http_status | No | HTTP error status code for the failing requests (default: 503) | |
| failure_count | No | Number of requests to fail before allowing success (default: 3) | |
| success_payload | No | Response body for requests after the failure window (default: {"ok":true}) | {"ok":true} |
| 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/retry UI that should appear (e.g., '.retry-button') | |
| intercept_pattern | Yes | Glob pattern for requests to intercept (e.g., '**/api/data**') | |
| 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. |