diff --git a/lib/NavigatorWatcher.js b/lib/NavigatorWatcher.js index 5a23c793..4ea721e4 100644 --- a/lib/NavigatorWatcher.js +++ b/lib/NavigatorWatcher.js @@ -64,7 +64,7 @@ class NavigatorWatcher { */ _createTimeoutPromise() { if (!this._timeout) - return null; + return new Promise(() => {}); const errorMessage = 'Navigation Timeout Exceeded: ' + this._timeout + 'ms exceeded'; return new Promise(fulfill => this._maximumTimer = setTimeout(fulfill, this._timeout)) .then(() => new Error(errorMessage)); diff --git a/test/test.js b/test/test.js index 9d11e31f..e2a56bd0 100644 --- a/test/test.js +++ b/test/test.js @@ -1029,8 +1029,11 @@ describe('Page', function() { })); it('should disable timeout when its set to 0', SX(async function() { let error = null; - await page.goto(PREFIX + '/grid.html', {timeout: 0}).catch(e => error = e); + let loaded = false; + page.once('load', () => loaded = true); + await page.goto(PREFIX + '/grid.html', {timeout: 0, waitUntil: ['load']}).catch(e => error = e); expect(error).toBe(null); + expect(loaded).toBe(true); })); it('should work when navigating to valid url', SX(async function() { const response = await page.goto(EMPTY_PAGE);