network-mocked-edge-cases

Writes deterministic Playwright edge-case tests for the programs flow using page.route network mocks.

Updated Jun 18, 2026
One-click install
npx skills add https://github.com/tetianna/ai-assisted-qa-automation-2 --skill network-mocked-edge-cases-tetianna
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: network-mocked-edge-cases
Source: https://github.com/tetianna/ai-assisted-qa-automation-2/tree/main/.cursor/skills/network-mocked-edge-cases
Command: npx skills add https://github.com/tetianna/ai-assisted-qa-automation-2 --skill network-mocked-edge-cases-tetianna

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Testing how a UI reacts to API failures, timeouts, empty lists, and malformed payloads is hard to do deterministically against a live backend. This Skill guides the creation of Playwright tests that use page.route network mocks to simulate controlled API outcomes for the Didaxis programs flow, so edge cases are reproducible without depending on backend state. ## Core Features & Use Cases - Deterministic API failure simulation: Mock 500/503 save failures, 401/403 auth errors, 404 missing resources, 3xx redirects, and timeouts via route.abort for the /api/programs endpoints. - Empty and malformed payload coverage: Fulfill GET requests with empty arrays or malformed bodies to verify empty-state rendering and crash guards. - Observe-before-assert discipline: Requires opening the real Programs UI first to capture actual error and empty-state copy, so tests never assert invented strings. - Use Case: A QA engineer needs to verify the Programs page shows an error banner when the save API returns 503. The Skill produces a tagged @api spec that routes POST /api/programs to a 503 fulfillment and asserts the observed UI error through existing page object models. ## Quick Start Write a Playwright test that mocks the programs API to return a 503 on save and asserts the error state shown in the real UI.

Frequently Asked Questions about network-mocked-edge-cases

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I mock API responses in Playwright tests?▼

Use page.route with a URL pattern like "**/api/programs**" and call route.fulfill with a status, content type, and body for matching requests. Call route.continue() for all other requests so the rest of the app behaves normally.

How to test API error handling in a web UI with Playwright?▼

Mock the endpoint to return the failure status (for example 503 on POST) and assert the error UI the app actually renders. First open the real UI and observe the exact error copy, then assert only strings you have seen.

When should I not mock an endpoint in Playwright tests?▼

Never mock the endpoint under test when verifying the real API contract or happy-path save and list behavior. Mock only when the test verifies the UI reaction to a controlled outcome such as an error banner, empty state, or crash guard.

How do I simulate a network timeout in Playwright?▼

Call route.abort("timedout") inside the page.route handler, or delay the fulfillment, to simulate a timeout. Then assert the timeout or error UI the app renders, or note in the handoff if the app renders nothing.

Why should Playwright tests use page object models instead of inline locators?▼

Page object models like ProgramsPage and NewProgramModal centralize selectors so specs stay maintainable when the UI changes. This Skill requires driving every click, fill, and navigation through existing POMs with no inline locators in the spec.