Skip to content

Flaky API With Retries

Fail the first matching request and assert that the retry path recovers.

await injectChaos(page, {
seed: 42,
network: { failures: [{ urlPattern: '/api/dashboard', statusCode: 503, probability: 1, onNth: 1 }] },
});
await page.goto('/dashboard');
await expect(page.locator('[data-testid="error-state"]')).toBeVisible();
await page.click('[data-testid="retry-button"]');
await expect(page.locator('[data-testid="dashboard-content"]')).toBeVisible();
expect((await getChaosLog(page)).some((event) => event.type === 'network:failure' && event.applied)).toBe(true);