diff --git a/tests/setup/navigate.ts b/tests/setup/navigate.ts index 2e43b5b..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); - // Give Vue Router time to resolve the route and render - await page.waitForTimeout(500); + // 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 }); }