From 7294377cd96200c1b1e99e6c43d760d4ad6b65cc Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Sun, 27 Jul 2025 21:11:10 +0200 Subject: [PATCH] Implement a delay for Chrome protocol calls in the integration tests In Chrome protocol calls are faster than in Firefox and thus trigger in quicker succession. This can cause intermittent failures because new protocol calls can run before events triggered by the previous protocol calls had a chance to be processed (essentially causing events to get lost). This commit fixes the issue by configuring Chrome with a protocol call delay value that gives it a more similar execution speed as Firefox (which also gives us more consistency between the two browser runs). Note that this doesn't negatively impact the overall runtime of the integration tests because Puppeteer already waits for a test to complete in both browsers before continuing to the next one and Chrome consistently was, and with this patch still slightly is, faster in completing the tests. --- test/test.mjs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/test.mjs b/test/test.mjs index d837f46ac..5e4efc57c 100644 --- a/test/test.mjs +++ b/test/test.mjs @@ -910,6 +910,14 @@ async function startBrowser({ // crashes with timeouts or OOM if WebDriver BiDi is used (issue #17961). options.protocol = "cdp"; + // Slow down protocol calls by the given number of milliseconds. In Chrome + // protocol calls are faster than in Firefox and thus trigger in quicker + // succession. This can cause intermittent failures because new protocol + // calls can run before events triggered by the previous protocol calls had + // a chance to be processed (essentially causing events to get lost). This + // value gives Chrome a more similar execution speed as Firefox. + options.slowMo = 5; + // avoid crash options.args = ["--no-sandbox", "--disable-setuid-sandbox"]; // silent printing in a pdf