Skip to content

Abort Upload Midflight

Abort an upload request after it starts and assert that the UI exits the uploading state.

await injectChaos(page, {
seed: 42,
network: { aborts: [{ urlPattern: '/api/uploads', timeout: 500, probability: 1 }] },
});
await page.goto('/upload');
await page.setInputFiles('input[type="file"]', 'fixtures/photo.png');
await page.click('[data-testid="upload"]');
await expect(page.locator('[data-testid="upload-error"]')).toBeVisible();
expect((await getChaosLog(page)).some((event) => event.type === 'network:abort' && event.applied)).toBe(true);