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.
This commit is contained in:
Tim van der Meij 2025-07-27 21:11:10 +02:00
parent c6bd044438
commit 7294377cd9
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762

View File

@ -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