Skip to content
Permalink
Browse files
fix(launcher): launcher.launch() should pass 'timeout' option #5180 (#…
…7596)

Co-authored-by: Bob Jamison <bob.jamison@pearson.com>
  • Loading branch information
jschfflr and bobpearson committed Sep 27, 2021
1 parent f2e1927 commit 113489d3b58e2907374a4e6e5133bf46630695d1
Showing with 11 additions and 2 deletions.
  1. +2 −2 src/node/Launcher.ts
  2. +9 −0 test/launcher.spec.ts
@@ -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();
@@ -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();
@@ -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, {

0 comments on commit 113489d

Please sign in to comment.