From 0d2cdff6c57916f04209a13e3f216c7a9b2e9095 Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Sun, 28 Nov 2021 18:58:22 +0100 Subject: [PATCH] Fix browser page navigation for Puppeteer 11+ in `test/test.js` In Puppeteer 11 we noticed that Firefox doesn't shut down once the tests are done anymore. I tracked this down to the `page.goto` call, in `startBrowser`, never resolving anymore. I can only assume that something changed in Puppeteer, possibly in combination with recent Firefox Nightly versions, that caused this, but haven't been able to fully track it down. However, I did find that the problem is that the `load` event no longer triggers, so fortunately we can fix the problem by explicitly waiting for the `domcontentloaded` event instead. In general this change might even be better since we now wait until the test framework is fully loaded before we continue. Note that this also still works for the current Puppeteer version. I did find two upstream references that appear to track this issue, both on the Puppeteer side and on the Firefox side, making me further suspect that the issue is partly on both sides: - https://github.com/puppeteer/puppeteer/issues/5806 - https://bugzilla.mozilla.org/show_bug.cgi?id=1706353 --- test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test.js b/test/test.js index a5eb456c0..17e7b8bcb 100644 --- a/test/test.js +++ b/test/test.js @@ -956,7 +956,7 @@ async function startBrowser(browserName, startUrl = "") { if (startUrl) { const pages = await browser.pages(); const page = pages[0]; - await page.goto(startUrl, { timeout: 0 }); + await page.goto(startUrl, { timeout: 0, waitUntil: "domcontentloaded" }); } return browser;