Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions test/browser/tests/network-change.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ const settled = (page: Page) =>
page.waitForFunction(() => !(window as any).__widget().checkbox.classList.contains('loading'));

test.describe('network change between challenge and submit', () => {
// The widget can still be fetching a fresh challenge when a test finishes.
// Drop the route handlers first so that request is not fulfilled against a
// page that is closing ("Fetch response has been disposed").
test.afterEach(async ({ page }) => {
await page.unrouteAll({ behavior: 'ignoreErrors' });
});

test('the widget retries once with a challenge from the new network', async ({ page }) => {
// Loaded at home, clicked after switching to cellular.
const net = await routeNetworks(page, (kind, n) => (kind === 'challenge' && n === 0 ? HOME : CELLULAR));
Expand Down