mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
test: fix flaky test (#2650)
When launching browser with a default URL, the page is not necessarily loaded when we're reaching into it.
This commit is contained in:
parent
0ba72df67d
commit
1c0ecc3d9c
@ -282,8 +282,11 @@ module.exports.addTests = function({testRunner, expect, PROJECT_ROOT, defaultBro
|
||||
const options = Object.assign({}, defaultBrowserOptions);
|
||||
options.args = [customUrl].concat(options.args);
|
||||
const browser = await puppeteer.launch(options);
|
||||
const pages = (await browser.pages()).map(page => page.url());
|
||||
expect(pages).toEqual([customUrl]);
|
||||
const pages = await browser.pages();
|
||||
expect(pages.length).toBe(1);
|
||||
if (pages[0].url() !== customUrl)
|
||||
await pages[0].waitForNavigation();
|
||||
expect(pages[0].url()).toBe(customUrl);
|
||||
await browser.close();
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user