Skip to content

Chaos Maker

Inject network, UI, WebSocket, Service Worker, SSE, and GraphQL chaos into your E2E tests without touching your backend.

Framework adapters

First-class support for Playwright, Cypress, WebdriverIO, and Puppeteer. One-line injection, no config files.

Reproducible chaos

Seeded PRNG makes probability-driven chaos decisions replayable. Log the seed on failure and run the same interaction sequence again.

Protocol coverage

Page requests, Service Worker fetches, WebSocket messages, Server-Sent Events, and GraphQL operations share one config model.

Nth-request targeting

Apply chaos on the 3rd request (onNth), every 5th (everyNth), or only after the first 10 pass through (afterN).

Observable

Structured event log for every chaos decision. Playwright trace integration surfaces chaos inline in the trace viewer.

Zero backend changes

Patches browser APIs in the test context and records every decision as a structured event. Your API is untouched.

import { test, expect } from '@playwright/test';
import { injectChaos, getChaosLog } from '@chaos-maker/playwright';
test('checkout shows error banner on payment API failure', async ({ page }) => {
await injectChaos(page, {
seed: 42,
network: {
failures: [{ urlPattern: '/api/payments', statusCode: 503, probability: 1.0 }],
},
});
await page.goto('/checkout');
await page.click('#pay-now');
await expect(page.locator('[data-testid="error-banner"]')).toBeVisible();
const log = await getChaosLog(page);
expect(log.some(e => e.type === 'network:failure' && e.applied)).toBe(true);
});
Terminal window
npm install @chaos-maker/core @chaos-maker/playwright
npm install @chaos-maker/core @chaos-maker/cypress
npm install @chaos-maker/core @chaos-maker/webdriverio
npm install @chaos-maker/core @chaos-maker/puppeteer