Skip to content

Commit

Permalink
Fix the protocol timeout configuration for Puppeteer
Browse files Browse the repository at this point in the history
The default protocol timeout is 180 seconds according to the
documentation at https://pptr.dev/api/puppeteer.browserconnectoptions,
but the Jasmine timeout we configure in the individual boot files is 30
seconds. The consequence of this is that if a protocol (CDP) error
occurs after 30 seconds Jasmine will fail the test, but the actual
protocol error from Puppeteer is raised much later in the context of
another test, which causes unrelated failures or tracebacks.

This commit fixes the problem by configuring Puppeteer to always use a
lower protocol timeout than the Jasmine timeout so that protocol errors
are always raised in the context of the test that actually triggered it.
  • Loading branch information
timvandermeij committed Oct 8, 2023
1 parent d64f223 commit ede65e1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,11 @@ async function startBrowser(browserName, startUrl = "") {
headless: false,
defaultViewport: null,
ignoreDefaultArgs: ["--disable-extensions"],
// The timeout for individual protocol (CDP) calls should always be lower
// than the Jasmine timeout. This way protocol errors are always raised in
// the context of the tests that actually triggered them and don't leak
// through to other tests (causing unrelated failures or tracebacks).
protocolTimeout: /* jasmine.DEFAULT_TIMEOUT_INTERVAL = */ 30000 - 1000,
};

if (!tempDir) {
Expand Down

0 comments on commit ede65e1

Please sign in to comment.