fix(ff): allow more time to launch browser (#15290)

This commit is contained in:
Pavel Feldman 2022-06-30 17:07:25 -08:00 committed by GitHub
parent b86926e691
commit 6425ab9e78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View File

@ -18,6 +18,7 @@
import { debugMode } from '../utils';
export const DEFAULT_TIMEOUT = 30000;
export const DEFAULT_LAUNCH_TIMEOUT = 3 * 60 * 1000; // 3 minutes
export class TimeoutSettings {
private _parent: TimeoutSettings | undefined;
@ -69,4 +70,12 @@ export class TimeoutSettings {
return 0;
return DEFAULT_TIMEOUT;
}
static launchTimeout(options: { timeout?: number }): number {
if (typeof options.timeout === 'number')
return options.timeout;
if (debugMode())
return 0;
return DEFAULT_LAUNCH_TIMEOUT;
}
}

View File

@ -71,7 +71,7 @@ export abstract class BrowserType extends SdkObject {
if (seleniumHubUrl)
return this._launchWithSeleniumHub(progress, seleniumHubUrl, options);
return this._innerLaunchWithRetries(progress, options, undefined, helper.debugProtocolLogger(protocolLogger)).catch(e => { throw this._rewriteStartupError(e); });
}, TimeoutSettings.timeout(options));
}, TimeoutSettings.launchTimeout(options));
return browser;
}
@ -82,7 +82,7 @@ export abstract class BrowserType extends SdkObject {
controller.setLogName('browser');
const browser = await controller.run(progress => {
return this._innerLaunchWithRetries(progress, options, persistent, helper.debugProtocolLogger(), userDataDir).catch(e => { throw this._rewriteStartupError(e); });
}, TimeoutSettings.timeout(options));
}, TimeoutSettings.launchTimeout(options));
return browser._defaultContext!;
}

View File

@ -134,7 +134,7 @@ export const test = _baseTest.extend<TestFixtures, WorkerFixtures>({
const browser = await playwright[browserName].launch();
await use(browser);
await browser.close();
}, { scope: 'worker' } ],
}, { scope: 'worker', timeout: 0 } ],
acceptDownloads: [ true, { option: true } ],
bypassCSP: [ undefined, { option: true } ],