Skip to content

Commit

Permalink
e2e test: test overlapping SPA navigations
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Hyndman committed Apr 14, 2022
1 parent f1f6593 commit f32779b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/e2e/spa2/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,26 @@ test.describe('TTVC', () => {
expect(entries[1]).toBeGreaterThanOrEqual(AJAX_DELAY);
expect(entries[1]).toBeLessThanOrEqual(AJAX_DELAY + FUDGE);
});

test('two overlapping SPA navigations', async ({page}) => {
// trigger a navigation
await page.click('[data-goto="/about"]');

// trigger a second navigation *before* the first resolves
await page.waitForTimeout(FUDGE);
await page.click('[data-goto="/about"]');

// wait for a possible duplicate entry
try {
await entryCountIs(page, 3, 2000);
} catch (e) {
// pass
}
const entries = await getEntries(page);

expect(entries.length).toBe(2);
expect(entries[1]).toBeGreaterThanOrEqual(AJAX_DELAY);
expect(entries[1]).toBeLessThanOrEqual(AJAX_DELAY + FUDGE);
});
});
});

0 comments on commit f32779b

Please sign in to comment.