Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: restore networkidle0 alias (#1920)

Pavel Feldman6ecac8c16454
diff --git a/src/frames.ts b/src/frames.ts
index 500bcec081..0b5ff3097d 100644
--- a/src/frames.ts
+++ b/src/frames.ts
@@ -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) => {
diff --git a/test/navigation.spec.js b/test/navigation.spec.js
index c487066444..ac77f1fd9b 100644
--- a/test/navigation.spec.js
+++ b/test/navigation.spec.js
@@ -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;