Mocking the Network in Puppeteer: Deterministic Tests Without a Backend
Flaky staging APIs make flaky UI tests. Puppeteer's request interception lets you mock, block, or fail HTTP traffic from inside your test process — no backend required.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Flaky staging APIs make flaky UI tests. Puppeteer's request interception lets you mock, block, or fail HTTP traffic from inside your test process — no backend required.
Learn how to use Jasmine spies to isolate units under test, mock HTTP dependencies, and verify function calls without relying on live network requests.
Vitest hoists vi.mock calls, which can cause 'cannot access before initialization' errors. Learn how to use vi.hoisted to safely define mock data and functions.
Learn how to use Karate’s built‑in WireMock server to stub external APIs, eliminate flaky tests, and keep your API test suite fast and reliable.
Context DropwizardAppRule starts the full application lifecycle for integration tests, loading a test-specific YAML configuration that can override production values through environment variables or system properties. The framework does not prescribe a single approach for mocking external HTTP services, databases, or message brokers, leaving teams to decide
Goal We need to validate an integration that calls webread without exposing production credentials or relying on external services during unit tests. Constraints The documented matlab.mock system creates mocks only from classes; free functions such as webread are not directly interceptable. A wrapper or interface is the typical workaround, but the exact appr
Mocking API requests with @storybook/addon-msw When integrating a component that fetches data from an external API, we want to run Storybook stories and the Storybook test‑runner without exposing production credentials. The @storybook/addon‑msw addon intercepts network requests in the browser, but the test‑runner executes stories in a Playwright environment
Goal Test a Passport.js authentication flow in a local test environment while avoiding any calls to external OAuth providers. The test must simulate the provider’s token exchange, user profile retrieval, and session handling without using real production credentials. Constraints To keep the tests deterministic, the OAuth endpoints must be intercepted (e.g.,