Skip to content

Chrome DevTools for coding agents

test: stabilize delayed navigation timing (#2635)

Илия24e3e7c66981
diff --git a/tests/utils/WaitForHelper.test.ts b/tests/utils/WaitForHelper.test.ts
index 27ea5f9d..a1682b9d 100644
--- a/tests/utils/WaitForHelper.test.ts
+++ b/tests/utils/WaitForHelper.test.ts
@@ -60,13 +60,20 @@ describe('WaitForHelper', () => {
const result = await mcpPage.waitForEventsAfterAction(
async () => {
// Simulate an action that takes longer than expectNavigationIn (300ms)
- // before triggering the navigation.
+ // before scheduling the navigation. Scheduling it after evaluate
+ // returns avoids racing the execution-context teardown on Windows.
await new Promise(resolve => setTimeout(resolve, 600));
await mcpPage.pptrPage.evaluate(targetUrl => {
- location.href = targetUrl;
+ setTimeout(() => {
+ location.href = targetUrl;
+ }, 50);
}, url);
},
- {waitForStableDom: false, expectNavigationIn: 300},
+ {
+ waitForStableDom: false,
+ expectNavigationIn: 300,
+ timeout: 10_000,
+ },
);
assert.strictEqual(result.navigatedToUrl, url);