diff --git a/package.json b/package.json index a2461d9395a12..f5126e5e30617 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "playwright": { "chromium_revision": "759546", "firefox_revision": "1084", - "webkit_revision": "1197" + "webkit_revision": "1200" }, "scripts": { "ctest": "cross-env BROWSER=chromium node --unhandled-rejections=strict test/test.js", diff --git a/src/webkit/wkPage.ts b/src/webkit/wkPage.ts index 7738af4e43c32..6349c02229326 100644 --- a/src/webkit/wkPage.ts +++ b/src/webkit/wkPage.ts @@ -559,6 +559,10 @@ export class WKPage implements PageDelegate { height: viewport.height, }), ]; + if (options.isMobile) { + const angle = viewport.width > viewport.height ? 90 : 0; + promises.push(this._session.send('Page.setOrientationOverride', { angle })); + } await Promise.all(promises); } diff --git a/test/emulation.spec.js b/test/emulation.spec.js index 33dd7be6edd38..990c0d6fd3b1e 100644 --- a/test/emulation.spec.js +++ b/test/emulation.spec.js @@ -137,7 +137,16 @@ describe.skip(FFOX)('viewport.isMobile', () => { await context1.close(); await context2.close(); }); - it.fail(WEBKIT)('should fire orientationchange event', async({browser, server}) => { + it('should support window.orientation emulation', async({browser, server}) => { + const context = await browser.newContext({ viewport: { width: 300, height: 400 }, isMobile: true }); + const page = await context.newPage(); + await page.goto(server.PREFIX + '/mobile.html'); + expect(await page.evaluate(() => window.orientation)).toBe(0); + await page.setViewportSize({width: 400, height: 300}); + expect(await page.evaluate(() => window.orientation)).toBe(90); + await context.close(); + }); + it('should fire orientationchange event', async({browser, server}) => { const context = await browser.newContext({ viewport: { width: 300, height: 400 }, isMobile: true }); const page = await context.newPage(); await page.goto(server.PREFIX + '/mobile.html');