fix: Reverse Lumia 550 and Lumia 550 Landscape viewports (#34548)

This commit is contained in:
GeneratorX16 2025-01-31 03:27:43 +05:30 committed by GitHub
parent 1936cfa6c3
commit 4fa1d39c80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 4 deletions

View File

@ -1122,8 +1122,8 @@
"Microsoft Lumia 550": {
"userAgent": "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.6943.27 Mobile Safari/537.36 Edge/14.14263",
"viewport": {
"width": 640,
"height": 360
"width": 360,
"height": 640
},
"deviceScaleFactor": 2,
"isMobile": true,
@ -1133,8 +1133,8 @@
"Microsoft Lumia 550 landscape": {
"userAgent": "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.6943.27 Mobile Safari/537.36 Edge/14.14263",
"viewport": {
"width": 360,
"height": 640
"width": 640,
"height": 360
},
"deviceScaleFactor": 2,
"isMobile": true,

View File

@ -19,6 +19,7 @@ import { devices } from '@playwright/test';
import { contextTest as it, expect } from '../config/browserTest';
import { browserTest } from '../config/browserTest';
import { verifyViewport } from '../config/utils';
import { deviceDescriptors } from 'packages/playwright-core/lib/server/deviceDescriptors';
it('should get the proper default viewport size', async ({ page, server }) => {
await verifyViewport(page, 1280, 720);
@ -46,6 +47,14 @@ it('should return correct outerWidth and outerHeight', async ({ page }) => {
expect(size.outerHeight >= size.innerHeight).toBeTruthy();
});
it('landscape viewport should have width larger than height', async () => {
for (const device in deviceDescriptors) {
const configuration = deviceDescriptors[device];
if (device.includes('landscape') || device.includes('Landscape'))
expect(configuration.viewport.width).toBeGreaterThan(configuration.viewport.height);
}
});
it('should emulate device width', async ({ page, server }) => {
expect(page.viewportSize()).toEqual({ width: 1280, height: 720 });
await page.setViewportSize({ width: 300, height: 300 });