84 / 168 · 01 Agent Skills for Browser Automation · Test Patterns for AI-Driven Browser Automation← prev⊞ allnext →☰ Read as one page
11.10Pattern 9: Error State Testing
Verify the application handles errors gracefully.
Example: Network Error
# Use eval to simulate offline mode
playwright-cli eval "window.navigator.__defineGetter__('onLine', () => false)"
playwright-cli click e11 # "Save" button ref from current snapshot
playwright-cli snapshot
# → Agent verifies: appropriate offline message shown
Example: Server Error
playwright-cli goto https://app.example.com/broken-page
playwright-cli snapshot
# → Agent checks: is there a user-friendly error page (not a raw 500 stack trace)?
playwright-cli screenshot