Skip to content

Commit 7294377

Browse files
committed
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.
1 parent c6bd044 commit 7294377

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

test/test.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,14 @@ async function startBrowser({
910910
// crashes with timeouts or OOM if WebDriver BiDi is used (issue #17961).
911911
options.protocol = "cdp";
912912

913+
// Slow down protocol calls by the given number of milliseconds. In Chrome
914+
// protocol calls are faster than in Firefox and thus trigger in quicker
915+
// succession. This can cause intermittent failures because new protocol
916+
// calls can run before events triggered by the previous protocol calls had
917+
// a chance to be processed (essentially causing events to get lost). This
918+
// value gives Chrome a more similar execution speed as Firefox.
919+
options.slowMo = 5;
920+
913921
// avoid crash
914922
options.args = ["--no-sandbox", "--disable-setuid-sandbox"];
915923
// silent printing in a pdf

0 commit comments

Comments
 (0)