fix: tests/setup/navigate.ts: bare 500ms timeout after pushState is fragile under CPU pressure (#390)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
326d026794
commit
f53e245f0e
1 changed files with 5 additions and 2 deletions
|
|
@ -12,6 +12,9 @@ export async function navigateSPA(page: Page, path: string): Promise<void> {
|
||||||
window.history.pushState({}, '', p);
|
window.history.pushState({}, '', p);
|
||||||
window.dispatchEvent(new PopStateEvent('popstate'));
|
window.dispatchEvent(new PopStateEvent('popstate'));
|
||||||
}, path);
|
}, path);
|
||||||
// Wait for Vue Router to actually resolve the route (not a fixed delay)
|
// waitForURL would resolve immediately (pushState already updated the URL
|
||||||
await page.waitForURL((url) => url.pathname === path, { timeout: 10_000 });
|
// 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 });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue