Skip to content

Commit

Permalink
fix(launcher): launcher.launch() should pass 'timeout' option #5180 (#…
Browse files Browse the repository at this point in the history
…7596)

Co-authored-by: Bob Jamison <bob.jamison@pearson.com>
  • Loading branch information
jschfflr and bobpearson committed Sep 27, 2021
1 parent f2e1927 commit 113489d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/node/Launcher.ts
Expand Up @@ -164,7 +164,7 @@ class ChromeLauncher implements ProductLauncher {
runner.close.bind(runner)
);
if (waitForInitialPage)
await browser.waitForTarget((t) => t.type() === 'page');
await browser.waitForTarget((t) => t.type() === 'page', { timeout });
return browser;
} catch (error) {
runner.kill();
Expand Down Expand Up @@ -336,7 +336,7 @@ class FirefoxLauncher implements ProductLauncher {
runner.close.bind(runner)
);
if (waitForInitialPage)
await browser.waitForTarget((t) => t.type() === 'page');
await browser.waitForTarget((t) => t.type() === 'page', { timeout });
return browser;
} catch (error) {
runner.kill();
Expand Down
9 changes: 9 additions & 0 deletions test/launcher.spec.ts
Expand Up @@ -392,6 +392,15 @@ describe('Launcher specs', function () {
await browser.close();
}
);
it('should pass the timeout parameter to browser.waitForTarget', async () => {
const { puppeteer, defaultBrowserOptions } = getTestState();
const options = Object.assign({}, defaultBrowserOptions, {
timeout: 1,
});
let error = null;
await puppeteer.launch(options).catch((error_) => (error = error_));
expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError);
});
it('should set the default viewport', async () => {
const { puppeteer, defaultBrowserOptions } = getTestState();
const options = Object.assign({}, defaultBrowserOptions, {
Expand Down

0 comments on commit 113489d

Please sign in to comment.