diff --git a/experimental/puppeteer-firefox/lib/FrameManager.js b/experimental/puppeteer-firefox/lib/FrameManager.js index f54118092e70f..39a2297aeeeb1 100644 --- a/experimental/puppeteer-firefox/lib/FrameManager.js +++ b/experimental/puppeteer-firefox/lib/FrameManager.js @@ -171,7 +171,7 @@ class Frame { } = options; const normalizedWaitUntil = normalizeWaitUntil(waitUntil); - const timeoutError = new TimeoutError('Navigation Timeout Exceeded: ' + timeout + 'ms'); + const timeoutError = new TimeoutError('Navigation timeout of ' + timeout + ' ms exceeded'); let timeoutCallback; const timeoutPromise = new Promise(resolve => timeoutCallback = resolve.bind(null, timeoutError)); const timeoutId = timeout ? setTimeout(timeoutCallback, timeout) : null; @@ -228,7 +228,7 @@ class Frame { if (!navigationId) return; - const timeoutError = new TimeoutError('Navigation Timeout Exceeded: ' + timeout + 'ms'); + const timeoutError = new TimeoutError('Navigation timeout of ' + timeout + ' ms exceeded'); let timeoutCallback; const timeoutPromise = new Promise(resolve => timeoutCallback = resolve.bind(null, timeoutError)); const timeoutId = timeout ? setTimeout(timeoutCallback, timeout) : null; diff --git a/experimental/puppeteer-firefox/lib/Page.js b/experimental/puppeteer-firefox/lib/Page.js index de5c7b41e95f1..ad7019b0ff5fd 100644 --- a/experimental/puppeteer-firefox/lib/Page.js +++ b/experimental/puppeteer-firefox/lib/Page.js @@ -446,7 +446,7 @@ class Page extends EventEmitter { if (!navigationId) return null; - const timeoutError = new TimeoutError('Navigation Timeout Exceeded: ' + timeout + 'ms'); + const timeoutError = new TimeoutError('Navigation timeout of ' + timeout + ' ms exceeded'); let timeoutCallback; const timeoutPromise = new Promise(resolve => timeoutCallback = resolve.bind(null, timeoutError)); const timeoutId = timeout ? setTimeout(timeoutCallback, timeout) : null; @@ -479,7 +479,7 @@ class Page extends EventEmitter { if (!navigationId) return null; - const timeoutError = new TimeoutError('Navigation Timeout Exceeded: ' + timeout + 'ms'); + const timeoutError = new TimeoutError('Navigation timeout of ' + timeout + ' ms exceeded'); let timeoutCallback; const timeoutPromise = new Promise(resolve => timeoutCallback = resolve.bind(null, timeoutError)); const timeoutId = timeout ? setTimeout(timeoutCallback, timeout) : null; @@ -512,7 +512,7 @@ class Page extends EventEmitter { if (!navigationId) return null; - const timeoutError = new TimeoutError('Navigation Timeout Exceeded: ' + timeout + 'ms'); + const timeoutError = new TimeoutError('Navigation timeout of ' + timeout + ' ms exceeded'); let timeoutCallback; const timeoutPromise = new Promise(resolve => timeoutCallback = resolve.bind(null, timeoutError)); const timeoutId = timeout ? setTimeout(timeoutCallback, timeout) : null; diff --git a/lib/Accessibility.js b/lib/Accessibility.js index 419e59fd2ed22..9f005a06b2e35 100644 --- a/lib/Accessibility.js +++ b/lib/Accessibility.js @@ -143,6 +143,7 @@ class AXNode { this._editable = false; this._focusable = false; this._expanded = false; + this._hidden = false; this._name = this._payload.name ? this._payload.name.value : ''; this._role = this._payload.role ? this._payload.role.value : 'Unknown'; this._cachedHasFocusableChild; @@ -156,6 +157,8 @@ class AXNode { this._focusable = property.value.value; if (property.name === 'expanded') this._expanded = property.value.value; + if (property.name === 'hidden') + this._hidden = property.value.value; } } @@ -289,7 +292,7 @@ class AXNode { */ isInteresting(insideControl) { const role = this._role; - if (role === 'Ignored') + if (role === 'Ignored' || this._hidden) return false; if (this._focusable || this._richlyEditable) diff --git a/lib/ExecutionContext.js b/lib/ExecutionContext.js index cda3899d1eec8..d66c0d7645824 100644 --- a/lib/ExecutionContext.js +++ b/lib/ExecutionContext.js @@ -163,7 +163,7 @@ class ExecutionContext { if (error.message.includes('Object couldn\'t be returned by value')) return {result: {type: 'undefined'}}; - if (error.message.endsWith('Cannot find context with specified id')) + if (error.message.endsWith('Cannot find context with specified id') || error.message.endsWith('Inspected target navigated or closed')) throw new Error('Execution context was destroyed, most likely because of a navigation.'); throw error; } diff --git a/lib/LifecycleWatcher.js b/lib/LifecycleWatcher.js index 3f1f86dbd6663..747675bcbf3c7 100644 --- a/lib/LifecycleWatcher.js +++ b/lib/LifecycleWatcher.js @@ -137,7 +137,7 @@ class LifecycleWatcher { _createTimeoutPromise() { if (!this._timeout) return new Promise(() => {}); - const errorMessage = 'Navigation Timeout Exceeded: ' + this._timeout + 'ms exceeded'; + const errorMessage = 'Navigation timeout of ' + this._timeout + ' ms exceeded'; return new Promise(fulfill => this._maximumTimer = setTimeout(fulfill, this._timeout)) .then(() => new TimeoutError(errorMessage)); } diff --git a/package.json b/package.json index 66d31c2d89e44..59dc40df082f3 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "node": ">=8.16.0" }, "puppeteer": { - "chromium_revision": "686378" + "chromium_revision": "706915" }, "scripts": { "unit": "node test/test.js", diff --git a/test/golden-chromium/screenshot-offscreen-clip.png b/test/golden-chromium/screenshot-offscreen-clip.png deleted file mode 100644 index fac15c30e0b3c..0000000000000 Binary files a/test/golden-chromium/screenshot-offscreen-clip.png and /dev/null differ diff --git a/test/golden-firefox/screenshot-offscreen-clip.png b/test/golden-firefox/screenshot-offscreen-clip.png deleted file mode 100644 index 791496e5da72d..0000000000000 Binary files a/test/golden-firefox/screenshot-offscreen-clip.png and /dev/null differ diff --git a/test/launcher.spec.js b/test/launcher.spec.js index 8cb43a9737a42..990c35da35da7 100644 --- a/test/launcher.spec.js +++ b/test/launcher.spec.js @@ -221,13 +221,13 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p expect(spawnargs.indexOf(defaultArgs[2])).toBe(-1); await browser.close(); }); - it_fails_ffox('should have default url when launching browser', async function() { + it_fails_ffox('should have default URL when launching browser', async function() { const browser = await puppeteer.launch(defaultBrowserOptions); const pages = (await browser.pages()).map(page => page.url()); expect(pages).toEqual(['about:blank']); await browser.close(); }); - it_fails_ffox('should have custom url when launching browser', async function({server}) { + it_fails_ffox('should have custom URL when launching browser', async function({server}) { const options = Object.assign({}, defaultBrowserOptions); options.args = [server.EMPTY_PAGE].concat(options.args || []); const browser = await puppeteer.launch(options); diff --git a/test/navigation.spec.js b/test/navigation.spec.js index fd212e59ec14c..5cf8d7b83c077 100644 --- a/test/navigation.spec.js +++ b/test/navigation.spec.js @@ -137,7 +137,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) { server.setRoute('/empty.html', (req, res) => { }); let error = null; await page.goto(server.PREFIX + '/empty.html', {timeout: 1}).catch(e => error = e); - expect(error.message).toContain('Navigation Timeout Exceeded: 1ms'); + expect(error.message).toContain('Navigation timeout of 1 ms exceeded'); expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError); }); it('should fail when exceeding default maximum navigation timeout', async({page, server}) => { @@ -146,7 +146,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) { let error = null; page.setDefaultNavigationTimeout(1); await page.goto(server.PREFIX + '/empty.html').catch(e => error = e); - expect(error.message).toContain('Navigation Timeout Exceeded: 1ms'); + expect(error.message).toContain('Navigation timeout of 1 ms exceeded'); expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError); }); it('should fail when exceeding default maximum timeout', async({page, server}) => { @@ -155,7 +155,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) { let error = null; page.setDefaultTimeout(1); await page.goto(server.PREFIX + '/empty.html').catch(e => error = e); - expect(error.message).toContain('Navigation Timeout Exceeded: 1ms'); + expect(error.message).toContain('Navigation timeout of 1 ms exceeded'); expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError); }); it('should prioritize default navigation timeout over default timeout', async({page, server}) => { @@ -165,7 +165,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) { page.setDefaultTimeout(0); page.setDefaultNavigationTimeout(1); await page.goto(server.PREFIX + '/empty.html').catch(e => error = e); - expect(error.message).toContain('Navigation Timeout Exceeded: 1ms'); + expect(error.message).toContain('Navigation timeout of 1 ms exceeded'); expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError); }); it('should disable timeout when its set to 0', async({page, server}) => { diff --git a/test/page.spec.js b/test/page.spec.js index a111ceadc9eaf..b7120c70e2e0f 100644 --- a/test/page.spec.js +++ b/test/page.spec.js @@ -18,13 +18,6 @@ const path = require('path'); const utils = require('./utils'); const {waitEvent} = utils; -let asyncawait = true; -try { - new Function('async function foo() {await 1}'); -} catch (e) { - asyncawait = false; -} - module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHROME}) { const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner; const {it, fit, xit, it_fails_ffox} = testRunner; @@ -101,7 +94,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR }); }); - (asyncawait ? describe : xdescribe)('Async stacks', () => { + describe('Async stacks', () => { it('should work', async({page, server}) => { server.setRoute('/empty.html', (req, res) => { res.statusCode = 204; diff --git a/test/requestinterception.spec.js b/test/requestinterception.spec.js index e0c7d9b74aa37..99124d8baebfd 100644 --- a/test/requestinterception.spec.js +++ b/test/requestinterception.spec.js @@ -146,7 +146,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) { }); expect(status).toBe(200); }); - it('should works with customizing referer headers', async({page, server}) => { + it('should work with custom referer headers', async({page, server}) => { await page.setExtraHTTPHeaders({ 'referer': server.EMPTY_PAGE }); await page.setRequestInterception(true); page.on('request', request => { diff --git a/test/screenshot.spec.js b/test/screenshot.spec.js index a427abaf6458e..701e208ab05cd 100644 --- a/test/screenshot.spec.js +++ b/test/screenshot.spec.js @@ -39,19 +39,6 @@ module.exports.addTests = function({testRunner, expect, product}) { }); expect(screenshot).toBeGolden('screenshot-clip-rect.png'); }); - it('should work for offscreen clip', async({page, server}) => { - await page.setViewport({width: 500, height: 500}); - await page.goto(server.PREFIX + '/grid.html'); - const screenshot = await page.screenshot({ - clip: { - x: 50, - y: 600, - width: 100, - height: 100 - } - }); - expect(screenshot).toBeGolden('screenshot-offscreen-clip.png'); - }); it('should run in parallel', async({page, server}) => { await page.setViewport({width: 500, height: 500}); await page.goto(server.PREFIX + '/grid.html'); diff --git a/test/waittask.spec.js b/test/waittask.spec.js index 69d44a740c8d2..3a0cba0b94912 100644 --- a/test/waittask.spec.js +++ b/test/waittask.spec.js @@ -16,13 +16,6 @@ const utils = require('./utils'); -let asyncawait = true; -try { - new Function('async function foo() {await 1}'); -} catch (e) { - asyncawait = false; -} - module.exports.addTests = function({testRunner, expect, product, puppeteer}) { const {describe, xdescribe, fdescribe} = testRunner; const {it, fit, xit, it_fails_ffox} = testRunner; @@ -378,7 +371,7 @@ module.exports.addTests = function({testRunner, expect, product, puppeteer}) { await page.setContent(`
anything
`); expect(await page.evaluate(x => x.textContent, await waitForSelector)).toBe('anything'); }); - (asyncawait ? it : xit)('should have correct stack trace for timeout', async({page, server}) => { + it('should have correct stack trace for timeout', async({page, server}) => { let error; await page.waitForSelector('.zombo', {timeout: 10}).catch(e => error = e); expect(error.stack).toContain('waittask.spec.js');