Skip to content

Chrome DevTools for coding agents

test: fix flaky navigate_page with open dialog test (#2020)

Samiya Caur64a02d8c8eb4
diff --git a/tests/tools/pages.test.ts b/tests/tools/pages.test.ts
index 51c9a9b0..b8206622 100644
--- a/tests/tools/pages.test.ts
+++ b/tests/tools/pages.test.ts
@@ -872,9 +872,13 @@ describe('pages', () => {
page.on('dialog', () => resolve());
});
- page.evaluate(() => {
- alert('test dialog');
- });
+ page
+ .evaluate(() => {
+ alert('test dialog');
+ })
+ .catch(() => {
+ // Ignore error when navigation destroys the execution context
+ });
await dialogPromise;
await navigatePage().handler(