From 521a44788a1273106b7dbf9da28c5ed88335fc62 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Tue, 11 Jun 2024 10:12:19 +0200 Subject: [PATCH] add regression test --- tests/library/browsercontext-viewport.spec.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/library/browsercontext-viewport.spec.ts b/tests/library/browsercontext-viewport.spec.ts index 6c37ee3ac9..19dd03d335 100644 --- a/tests/library/browsercontext-viewport.spec.ts +++ b/tests/library/browsercontext-viewport.spec.ts @@ -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(); +});