Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(launcher): launcher.launch() should pass 'timeout' option #5180 #7596

Merged
merged 6 commits into from Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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