diff --git a/experimental/puppeteer-firefox/lib/Page.js b/experimental/puppeteer-firefox/lib/Page.js index bc733a1bb892e..91c355355d4f6 100644 --- a/experimental/puppeteer-firefox/lib/Page.js +++ b/experimental/puppeteer-firefox/lib/Page.js @@ -1,4 +1,4 @@ -const {helper, debugError} = require('./helper'); +const {helper, debugError, assert} = require('./helper'); const {Keyboard, Mouse} = require('./Input'); const {Dialog} = require('./Dialog'); const {TimeoutError} = require('./Errors'); @@ -84,6 +84,14 @@ class Page extends EventEmitter { await this._networkManager.setExtraHTTPHeaders(headers); } + /** + * @param {?string} mediaType + */ + async emulateMedia(mediaType) { + assert(mediaType === 'screen' || mediaType === 'print' || mediaType === null, 'Unsupported media type: ' + mediaType); + await this._session.send('Page.setEmulatedMedia', {media: mediaType || ''}); + } + /** * @param {string} name * @param {Function} puppeteerFunction diff --git a/experimental/puppeteer-firefox/package.json b/experimental/puppeteer-firefox/package.json index ec7d8e9d451e2..08a899694c0d8 100644 --- a/experimental/puppeteer-firefox/package.json +++ b/experimental/puppeteer-firefox/package.json @@ -9,7 +9,7 @@ "node": ">=8.9.4" }, "puppeteer": { - "firefox_revision": "f8e2e3a2e86cd47766cd839624b3f08e093c1f27" + "firefox_revision": "86e93329fd528bd28ff1493f117f126b6f010eac" }, "scripts": { "install": "node install.js", diff --git a/test/elementhandle.spec.js b/test/elementhandle.spec.js index 7b3be85fdd8df..3c71650840de2 100644 --- a/test/elementhandle.spec.js +++ b/test/elementhandle.spec.js @@ -16,7 +16,7 @@ const utils = require('./utils'); -module.exports.addTests = function({testRunner, expect}) { +module.exports.addTests = function({testRunner, expect, CHROME}) { const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner; const {it, fit, xit, it_fails_ffox} = testRunner; const {beforeAll, beforeEach, afterAll, afterEach} = testRunner; @@ -29,13 +29,16 @@ module.exports.addTests = function({testRunner, expect}) { const box = await elementHandle.boundingBox(); expect(box).toEqual({ x: 100, y: 50, width: 50, height: 50 }); }); - it_fails_ffox('should handle nested frames', async({page, server}) => { + it('should handle nested frames', async({page, server}) => { await page.setViewport({width: 500, height: 500}); await page.goto(server.PREFIX + '/frames/nested-frames.html'); const nestedFrame = page.frames()[1].childFrames()[1]; const elementHandle = await nestedFrame.$('div'); const box = await elementHandle.boundingBox(); - expect(box).toEqual({ x: 28, y: 260, width: 264, height: 18 }); + if (CHROME) + expect(box).toEqual({ x: 28, y: 260, width: 264, height: 18 }); + else + expect(box).toEqual({ x: 28, y: 182, width: 254, height: 18 }); }); it('should return null for invisible elements', async({page, server}) => { await page.setContent('
hi
'); diff --git a/test/emulation.spec.js b/test/emulation.spec.js index a2ce575f6f939..72a6ad1d5c111 100644 --- a/test/emulation.spec.js +++ b/test/emulation.spec.js @@ -99,7 +99,7 @@ module.exports.addTests = function({testRunner, expect, product}) { }); }); - describe_fails_ffox('Page.emulateMedia', function() { + describe('Page.emulateMedia', function() { it('should work', async({page, server}) => { expect(await page.evaluate(() => window.matchMedia('screen').matches)).toBe(true); expect(await page.evaluate(() => window.matchMedia('print').matches)).toBe(false); diff --git a/test/evaluation.spec.js b/test/evaluation.spec.js index d03b4f5d205bc..ddab30b50fd78 100644 --- a/test/evaluation.spec.js +++ b/test/evaluation.spec.js @@ -101,7 +101,7 @@ module.exports.addTests = function({testRunner, expect}) { await page.goto(server.EMPTY_PAGE); expect(await frameEvaluation).toBe(42); }); - it_fails_ffox('should work from-inside an exposed function', async({page, server}) => { + it('should work from-inside an exposed function', async({page, server}) => { // Setup inpage callback, which calls Page.evaluate await page.exposeFunction('callController', async function(a, b) { return await page.evaluate((a, b) => a * b, a, b);