I have the next fixture:
async function configPage<T extends IPages>(pageClass: new (args: Page) => T, fn: (page: T) => Promise<void>) {
const browser = await chromium.launch();
const fileName = './appLoginInfo.json';
fs.writeFileSync(fileName, APP_LOGIN_INFO as string, 'utf-8');
const context = await browser.newContext({ storageState: fileName });
await context.route(/(analytics|fonts)/, (route) => route.abort());
const page = new pageClass(await context.newPage());
await fn(page);
await browser.close();
fs.unlinkSync(fileName);
}
and through the test I'm initialize new browser with new context and page like this:
static async initializeNewContextWithPage<IPages>(type: new (obj: Page) => IPages): Promise<IPages> {
const browser = await chromium.launch();
const context = await browser.newContext();
await context.route(/(analytics|fonts)/, (route) => route.abort());
const page = await context.newPage();
return new type(page);
}
when it's ran on the launching new browser 2nd time the timeout exception is thrown.
Error: browserType.launch: Timeout 180000ms exceeded
Any ideas? Before updating to the latest version it's worked
This thread is trying to answer question "Why does launching a new browser when one is already initialized result in a timeout exception, and how can this issue be resolved?"
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].