feat(webkit): roll to r2029 (#31257)

This commit is contained in:
Playwright Service 2024-06-11 13:14:30 -07:00 committed by GitHub
parent 2b257ea963
commit e07b46883d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 30 additions and 12 deletions

View file

@ -27,7 +27,7 @@
},
{
"name": "webkit",
"revision": "2022",
"revision": "2029",
"installByDefault": true,
"revisionOverrides": {
"mac10.14": "1446",

View file

@ -2122,6 +2122,10 @@ export module Protocol {
* Array of <code>DOMNode</code> ids of any children marked as selected.
*/
selectedChildNodeIds?: NodeId[];
/**
* On / off state of switch form controls.
*/
switchState?: "off"|"on";
}
/**
* A structure holding an RGBA color.
@ -4584,6 +4588,14 @@ might return multiple quads for inline nodes.
}
export type resetPermissionsReturnValue = {
}
/**
* Overrides window.orientation with provided value.
*/
export type setOrientationOverrideParameters = {
angle?: number;
}
export type setOrientationOverrideReturnValue = {
}
}
/**
@ -7351,14 +7363,6 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the
}
export type crashReturnValue = {
}
/**
* Overrides window.orientation with provided value.
*/
export type setOrientationOverrideParameters = {
angle?: number;
}
export type setOrientationOverrideReturnValue = {
}
/**
* Ensures that the scroll regions are up to date.
*/
@ -9509,6 +9513,7 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the
"Emulation.setActiveAndFocused": Emulation.setActiveAndFocusedParameters;
"Emulation.grantPermissions": Emulation.grantPermissionsParameters;
"Emulation.resetPermissions": Emulation.resetPermissionsParameters;
"Emulation.setOrientationOverride": Emulation.setOrientationOverrideParameters;
"Heap.enable": Heap.enableParameters;
"Heap.disable": Heap.disableParameters;
"Heap.gc": Heap.gcParameters;
@ -9591,7 +9596,6 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the
"Page.createUserWorld": Page.createUserWorldParameters;
"Page.setBypassCSP": Page.setBypassCSPParameters;
"Page.crash": Page.crashParameters;
"Page.setOrientationOverride": Page.setOrientationOverrideParameters;
"Page.updateScrollingState": Page.updateScrollingStateParameters;
"Playwright.enable": Playwright.enableParameters;
"Playwright.disable": Playwright.disableParameters;
@ -9820,6 +9824,7 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the
"Emulation.setActiveAndFocused": Emulation.setActiveAndFocusedReturnValue;
"Emulation.grantPermissions": Emulation.grantPermissionsReturnValue;
"Emulation.resetPermissions": Emulation.resetPermissionsReturnValue;
"Emulation.setOrientationOverride": Emulation.setOrientationOverrideReturnValue;
"Heap.enable": Heap.enableReturnValue;
"Heap.disable": Heap.disableReturnValue;
"Heap.gc": Heap.gcReturnValue;
@ -9902,7 +9907,6 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the
"Page.createUserWorld": Page.createUserWorldReturnValue;
"Page.setBypassCSP": Page.setBypassCSPReturnValue;
"Page.crash": Page.crashReturnValue;
"Page.setOrientationOverride": Page.setOrientationOverrideReturnValue;
"Page.updateScrollingState": Page.updateScrollingStateReturnValue;
"Playwright.enable": Playwright.enableReturnValue;
"Playwright.disable": Playwright.disableReturnValue;

View file

@ -16,6 +16,7 @@
*/
import path from 'path';
import os from 'os';
import { PNG, jpegjs } from '../../utilsBundle';
import { splitErrorMessage } from '../../utils/stackTrace';
import { assert, createGuid, debugAssert, headersArrayToObject } from '../../utils';
@ -713,7 +714,9 @@ export class WKPage implements PageDelegate {
];
if (options.isMobile) {
const angle = viewportSize.width > viewportSize.height ? 90 : 0;
promises.push(this._session.send('Page.setOrientationOverride', { angle }));
// Special handling for macOS 12.
const useLegacySetOrientationOverrideMethod = os.platform() === 'darwin' && parseInt(os.release().split('.')[0], 10) <= 21;
promises.push(this._pageProxySession.send(useLegacySetOrientationOverrideMethod ? 'Page.setOrientationOverride' as any : 'Emulation.setOrientationOverride', { angle }));
}
await Promise.all(promises);
}

View file

@ -15,6 +15,7 @@
* limitations under the License.
*/
import { devices } from '@playwright/test';
import { contextTest as it, expect } from '../config/browserTest';
import { browserTest } from '../config/browserTest';
import { verifyViewport } from '../config/utils';
@ -175,3 +176,13 @@ browserTest('should be able to get correct orientation angle on non-mobile devic
expect(await page.evaluate(() => window.screen.orientation.angle)).toBe(0);
await context.close();
});
it('should set window.screen.orientation.type for mobile devices', async ({ contextFactory, browserName, server }) => {
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/31151' });
it.skip(browserName === 'firefox', 'Firefox does not support mobile emulation');
const context = await contextFactory(devices['iPhone 14']);
const page = await context.newPage();
await page.goto(server.PREFIX + '/index.html');
expect(await page.evaluate(() => window.screen.orientation.type)).toBe('portrait-primary');
await context.close();
});