diff --git a/docs/api.md b/docs/api.md index 9b3c0e4fba..7431627b6d 100644 --- a/docs/api.md +++ b/docs/api.md @@ -190,7 +190,7 @@ Indicates that the browser is connected. - `width` <[number]> page width in pixels. - `height` <[number]> page height in pixels. - `deviceScaleFactor` <[number]> Specify device scale factor (can be thought of as dpr). Defaults to `1`. - - `isMobile` <[boolean]> Whether the `meta viewport` tag is taken into account. Defaults to `false`. + - `isMobile` <[boolean]> Whether the `meta viewport` tag is taken into account and touch events are enabled. Defaults to `false`. Not supported in Firefox. - `userAgent` Specific user agent to use in this context. - `javaScriptEnabled` Whether or not to enable or disable JavaScript in the context. Defaults to true. - `timezoneId` Changes the timezone of the context. See [ICU’s `metaZones.txt`](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs. @@ -224,7 +224,7 @@ Creates a new browser context. It won't share cookies/cache with other browser c - `width` <[number]> page width in pixels. - `height` <[number]> page height in pixels. - `deviceScaleFactor` <[number]> Specify device scale factor (can be thought of as dpr). Defaults to `1`. - - `isMobile` <[boolean]> Whether the `meta viewport` tag is taken into account. Defaults to `false`. + - `isMobile` <[boolean]> Whether the `meta viewport` tag is taken into account and touch events are enabled. Defaults to `false`. Not supported in Firefox. - `userAgent` Specific user agent to use in this context. - `javaScriptEnabled` Whether or not to enable or disable JavaScript in the context. Defaults to true. - `timezoneId` Changes the timezone of the context. See [ICU’s `metaZones.txt`](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs. diff --git a/src/firefox/ffBrowser.ts b/src/firefox/ffBrowser.ts index 059dca2f6c..335a35526c 100644 --- a/src/firefox/ffBrowser.ts +++ b/src/firefox/ffBrowser.ts @@ -72,17 +72,20 @@ export class FFBrowser extends platform.EventEmitter implements Browser { options = validateBrowserContextOptions(options); let viewport; if (options.viewport) { + // TODO: remove isMobile/hasTouch from the protocol? + if (options.viewport.isMobile) + throw new Error('viewport.isMobile is not supported in Firefox'); viewport = { viewportSize: { width: options.viewport.width, height: options.viewport.height }, - isMobile: !!options.viewport.isMobile, deviceScaleFactor: options.viewport.deviceScaleFactor || 1, - hasTouch: !!options.viewport.isMobile, + isMobile: false, + hasTouch: false, }; } else if (options.viewport !== null) { viewport = { viewportSize: { width: 1280, height: 720 }, - isMobile: false, deviceScaleFactor: 1, + isMobile: false, hasTouch: false, }; } diff --git a/test/mouse.spec.js b/test/mouse.spec.js index ea53b03bf9..e9de987758 100644 --- a/test/mouse.spec.js +++ b/test/mouse.spec.js @@ -132,8 +132,8 @@ module.exports.describe = function({testRunner, expect, FFOX, CHROMIUM, WEBKIT, [200, 300] ]); }); - // @see https://crbug.com/929806 - it('should work with mobile viewports and cross process navigations', async({browser, server}) => { + it.skip(FFOX)('should work with mobile viewports and cross process navigations', async({browser, server}) => { + // @see https://crbug.com/929806 const context = await browser.newContext({ viewport: {width: 360, height: 640, isMobile: true} }); const page = await context.newPage(); await page.goto(server.EMPTY_PAGE); diff --git a/test/popup.spec.js b/test/popup.spec.js index 419b61858f..3e7ce606d2 100644 --- a/test/popup.spec.js +++ b/test/popup.spec.js @@ -48,7 +48,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE await context.close(); expect(request.headers['foo']).toBe('bar'); }); - it.fail(CHROMIUM)('should inherit touch support from browser context', async function({browser, server}) { + it.skip(FFOX).fail(CHROMIUM)('should inherit touch support from browser context', async function({browser, server}) { const context = await browser.newContext({ viewport: { width: 400, height: 500, isMobile: true } }); @@ -61,7 +61,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE await context.close(); expect(hasTouch).toBe(true); }); - it.skip(FFOX).fail(CHROMIUM)('should inherit viewport size from browser context', async function({browser, server}) { + it.fail(CHROMIUM)('should inherit viewport size from browser context', async function({browser, server}) { const context = await browser.newContext({ viewport: { width: 400, height: 500 } });