chore: restore networkidle0 alias (#1920)

This commit is contained in:
Pavel Feldman 2020-04-22 10:52:01 -07:00 committed by GitHub
parent 95b8f61652
commit 6ecac8c164
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -1112,6 +1112,8 @@ export class FrameTask {
}
waitForLifecycle(waitUntil: types.LifecycleEvent): Promise<void> {
if (waitUntil as unknown === 'networkidle0')
waitUntil = 'networkidle';
if (!types.kLifecycleEvents.has(waitUntil))
throw new Error(`Unsupported waitUntil option ${String(waitUntil)}`);
return this.raceAgainstFailures(new Promise((resolve, reject) => {

View file

@ -172,10 +172,9 @@ describe('Page.goto', function() {
await page.goto(server.CROSS_PROCESS_PREFIX + '/empty.html');
await page.goto(httpsServer.EMPTY_PAGE).catch(e => void 0);
});
it('should throw if networkidle0 is passed as an option', async({page, server}) => {
it('should not throw if networkidle0 is passed as an option', async({page, server}) => {
let error = null;
await page.goto(server.EMPTY_PAGE, {waitUntil: 'networkidle0'}).catch(err => error = err);
expect(error.message).toContain('Unsupported waitUntil option');
await page.goto(server.EMPTY_PAGE, {waitUntil: 'networkidle0'});
});
it('should throw if networkidle2 is passed as an option', async({page, server}) => {
let error = null;