fix: navigateSPA waitForLoadState networkidle times out due to persistent WebSocket connections

Replace waitForLoadState('networkidle') with a comment explaining that callers
must assert on a route-specific element. The SPA keeps persistent WebSocket
connections for blockchain event subscriptions, so networkidle never fires
within the 10 s window, causing spurious TimeoutErrors in 01-acquire-and-stake
and 02-max-stake-all-tax-rates.

Vue Router processes popstate synchronously inside page.evaluate(), so the
route transition has already started by the time evaluate() resolves. Callers'
toBeVisible() assertions (with their own timeouts) serve as the readiness gate.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-06 10:33:04 +00:00
parent 97a4ef7cd3
commit ab57c5bccd

View file

@ -12,9 +12,11 @@ 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);
// waitForURL would resolve immediately (pushState already updated the URL // Vue Router processes the popstate event synchronously within evaluate(),
// synchronously), so wait for networkidle instead: that fires once Vue Router // so the route transition has already started by the time we return here.
// has processed the popstate event, mounted the new view, and any route- // Callers must assert on a route-specific element (e.g. a heading) to confirm
// triggered data fetches have settled. // the view has mounted — that assertion is the readiness signal.
await page.waitForLoadState('networkidle', { timeout: 10_000 }); // waitForLoadState('networkidle') is not used because persistent WebSocket
// connections (blockchain event subscriptions) prevent the network from ever
// going idle, causing spurious timeouts.
} }