diff --git a/tests/setup/navigate.ts b/tests/setup/navigate.ts index c6cc6ab..5770635 100644 --- a/tests/setup/navigate.ts +++ b/tests/setup/navigate.ts @@ -12,6 +12,9 @@ export async function navigateSPA(page: Page, path: string): Promise { window.history.pushState({}, '', p); window.dispatchEvent(new PopStateEvent('popstate')); }, path); - // Wait for Vue Router to actually resolve the route (not a fixed delay) - await page.waitForURL((url) => url.pathname === path, { timeout: 10_000 }); + // waitForURL would resolve immediately (pushState already updated the URL + // synchronously), so wait for networkidle instead: that fires once Vue Router + // has processed the popstate event, mounted the new view, and any route- + // triggered data fetches have settled. + await page.waitForLoadState('networkidle', { timeout: 10_000 }); }