api: declare not supporting isMobile on Firefox (#1207)

This commit is contained in:
Dmitry Gozman 2020-03-03 17:28:31 -08:00 committed by GitHub
parent 33f3e5724b
commit f4e9b5079d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 9 deletions

View file

@ -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` <?[string]> Specific user agent to use in this context.
- `javaScriptEnabled` <?[boolean]> Whether or not to enable or disable JavaScript in the context. Defaults to true.
- `timezoneId` <?[string]> Changes the timezone of the context. See [ICUs `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` <?[string]> Specific user agent to use in this context.
- `javaScriptEnabled` <?[boolean]> Whether or not to enable or disable JavaScript in the context. Defaults to true.
- `timezoneId` <?[string]> Changes the timezone of the context. See [ICUs `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.

View file

@ -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,
};
}

View file

@ -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);

View file

@ -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 }
});