Skip to content

WebSocket Disconnect Storm

Force-close the socket shortly after connection and assert that the app enters a reconnecting state.

await injectChaos(page, {
seed: 42,
websocket: { closes: [{ urlPattern: '/realtime', code: 4000, reason: 'chaos', afterMs: 300, probability: 1 }] },
});
await page.goto('/messages');
await expect(page.locator('[data-testid="ws-status"]')).toContainText('reconnecting');
expect((await getChaosLog(page)).some((event) => event.type === 'websocket:close' && event.applied)).toBe(true);