diff --git a/browsers.json b/browsers.json index cef13e4193..47dfeae244 100644 --- a/browsers.json +++ b/browsers.json @@ -23,7 +23,7 @@ }, { "name": "webkit", - "revision": "1517", + "revision": "1521", "installByDefault": true, "revisionOverrides": { "mac10.14": "1446" diff --git a/src/server/webkit/protocol.d.ts b/src/server/webkit/protocol.d.ts index 6e5bbb1bd8..84be8c9560 100644 --- a/src/server/webkit/protocol.d.ts +++ b/src/server/webkit/protocol.d.ts @@ -5990,7 +5990,7 @@ the top of the viewport and Y increases as it proceeds towards the bottom of the /** * List of settings able to be overridden by WebInspector. */ - export type Setting = "PrivateClickMeasurementDebugModeEnabled"|"AuthorAndUserStylesEnabled"|"ICECandidateFilteringEnabled"|"ITPDebugModeEnabled"|"ImagesEnabled"|"MediaCaptureRequiresSecureConnection"|"MockCaptureDevicesEnabled"|"NeedsSiteSpecificQuirks"|"ScriptEnabled"|"ShowDebugBorders"|"ShowRepaintCounter"|"WebRTCEncryptionEnabled"|"WebSecurityEnabled"|"DeviceOrientationEventEnabled"|"SpeechRecognitionEnabled"; + export type Setting = "PrivateClickMeasurementDebugModeEnabled"|"AuthorAndUserStylesEnabled"|"ICECandidateFilteringEnabled"|"ITPDebugModeEnabled"|"ImagesEnabled"|"MediaCaptureRequiresSecureConnection"|"MockCaptureDevicesEnabled"|"NeedsSiteSpecificQuirks"|"ScriptEnabled"|"ShowDebugBorders"|"ShowRepaintCounter"|"WebRTCEncryptionEnabled"|"WebSecurityEnabled"|"DeviceOrientationEventEnabled"|"SpeechRecognitionEnabled"|"PointerLockEnabled"|"NotificationsEnabled"|"FullScreenEnabled"|"InputTypeMonthEnabled"|"InputTypeWeekEnabled"; /** * Resource type as it was perceived by the rendering engine. */ diff --git a/src/server/webkit/wkPage.ts b/src/server/webkit/wkPage.ts index 008e8dac8a..4dbf312d7b 100644 --- a/src/server/webkit/wkPage.ts +++ b/src/server/webkit/wkPage.ts @@ -210,6 +210,11 @@ export class WKPage implements PageDelegate { catch(e => { throw new Error(`Invalid timezone ID: ${contextOptions.timezoneId}`); })); } promises.push(session.send('Page.overrideSetting', { setting: 'DeviceOrientationEventEnabled' as any, value: contextOptions.isMobile })); + promises.push(session.send('Page.overrideSetting', { setting: 'FullScreenEnabled' as any, value: !contextOptions.isMobile })); + promises.push(session.send('Page.overrideSetting', { setting: 'NotificationsEnabled' as any, value: !contextOptions.isMobile })); + promises.push(session.send('Page.overrideSetting', { setting: 'PointerLockEnabled' as any, value: !contextOptions.isMobile })); + promises.push(session.send('Page.overrideSetting', { setting: 'InputTypeMonthEnabled' as any, value: contextOptions.isMobile })); + promises.push(session.send('Page.overrideSetting', { setting: 'InputTypeWeekEnabled' as any, value: contextOptions.isMobile })); await Promise.all(promises); } diff --git a/tests/modernizr.spec.ts b/tests/modernizr.spec.ts index 3ee81e93ea..d4ca959e9b 100644 --- a/tests/modernizr.spec.ts +++ b/tests/modernizr.spec.ts @@ -23,140 +23,119 @@ async function checkFeatures(name: string, context: any, server: any) { await page.goto(server.PREFIX + '/modernizr.html'); const actual = await page.evaluate('window.report'); const expected = JSON.parse(fs.readFileSync(require.resolve(`./assets/modernizr/${name}.json`), 'utf-8')); - expect(actual).toEqual(expected); + return { actual, expected }; } finally { await context.close(); } } -it('safari-14-1', async ({ browser, browserName, platform, server }) => { - /* GTK - - "gamepads": true, - + "gamepads": false, - - "getusermedia": true, - - "hairline": true, - + "getusermedia": false, - + "hairline": false, - + "hasEvent": undefined, - - "input": Object { - - "list": true, - + "list": false, - }, - "inputtypes": Object { - - "color": true, - - "date": true, - + "color": false, - + "date": false, - - "datetime-local": true, - + "datetime-local": false, - - "time": true, - + "time": false, - }, - - "peerconnection": true, - + "peerconnection": false, - - "pointerlock": true, - + "pointerlock": false, - - "speechrecognition": true, - - "speechsynthesis": true, - + "speechrecognition": false, - + "speechsynthesis": false, - - "subpixelfont": true, - + "subpixelfont": false, - - "todataurljpeg": true, - + "todataurljpeg": false, - */ - - /* WPE - - "datalistelem": true, - + "datalistelem": false, - */ - - it.skip(browserName !== 'webkit' || platform !== 'darwin'); +it('safari-14-1', async ({ browser, browserName, platform, server, headless }) => { + it.skip(browserName !== 'webkit'); const context = await browser.newContext({ deviceScaleFactor: 2 }); - await checkFeatures('safari-14-1', context, server); + const { actual, expected } = await checkFeatures('safari-14-1', context, server); + + if (platform === 'linux') { + expected.subpixelfont = false; + if (headless) + expected.todataurljpeg = false; + + // GHA + delete actual.variablefonts; + delete expected.variablefonts; + + if (isDocker()) { + delete actual.unicode; + delete expected.unicode; + } + } + + if (platform === 'win32') { + expected.datalistelem = false; + expected.fileinputdirectory = false; + expected.getusermedia = false; + expected.hiddenscroll = false; + expected.peerconnection = false; + expected.speechrecognition = false; + expected.speechsynthesis = false; + expected.todataurljpeg = false; + expected.unicode = false; + expected.webaudio = false; + + expected.input.list = false; + expected.inputtypes.color = false; + expected.inputtypes.date = false; + expected.inputtypes['datetime-local'] = false; + expected.inputtypes.time = false; + } + expect(actual).toEqual(expected); }); -it('mobile-safari-14-1', async ({ playwright, browser, browserName, platform, server }) => { - it.fixme(); - - /* macOS - - "capture": true, - + "capture": false, - - "cssscrollbar": false, - + "cssscrollbar": true, - - "cssvhunit": false, - - "cssvmaxunit": false, - + "cssvhunit": true, - + "cssvmaxunit": true, - - "devicemotion": true, - - "deviceorientation": true, - + "devicemotion": false, - + "deviceorientation": false, - - "fullscreen": false, - + "fullscreen": true, - "inputtypes": Object { - - "month": true, - + "month": false, - - "week": true, - + "week": false, - }, - - "notification": false, - + "notification": true, - - "overflowscrolling": true, - + "overflowscrolling": false, - - "pointerlock": false, - + "pointerlock": true, - */ - - /* GTK - - "datalistelem": true, - + "datalistelem": false, - - "gamepads": true, - + "gamepads": false, - - "getusermedia": true, - - "hairline": true, - + "getusermedia": false, - + "hairline": false, - + "hasEvent": undefined, - - "input": Object { - - "list": true, - + "list": false, - }, - "inputtypes": Object { - - "color": true, - - "date": true, - + "color": false, - + "date": false, - - "datetime-local": true, - + "datetime-local": false, - - "time": true, - + "time": false, - }, - - "peerconnection": true, - + "peerconnection": false, - - "pointerlock": true, - + "pointerlock": false, - - "speechrecognition": true, - - "speechsynthesis": true, - + "speechrecognition": false, - + "speechsynthesis": false, - - "subpixelfont": true, - + "subpixelfont": false, - - "todataurljpeg": true, - + "todataurljpeg": false, - */ - - /* WPE - - "datalistelem": true, - + "datalistelem": false, - */ - - it.skip(browserName !== 'webkit' || platform !== 'darwin'); +it('mobile-safari-14-1', async ({ playwright, browser, browserName, platform, server, headless }) => { + it.skip(browserName !== 'webkit'); const iPhone = playwright.devices['iPhone 12']; const context = await browser.newContext(iPhone); - await checkFeatures('mobile-safari-14-1', context, server); + const { actual, expected } = await checkFeatures('mobile-safari-14-1', context, server); + + { + // All platforms. + expected.capture = false; + expected.cssscrollbar = true; + expected.cssvhunit = true; + expected.cssvmaxunit = true; + expected.overflowscrolling = false; + } + + if (platform === 'linux') { + expected.subpixelfont = false; + if (headless) + expected.todataurljpeg = false; + + // GHA + delete actual.variablefonts; + delete expected.variablefonts; + + if (isDocker()) { + delete actual.unicode; + delete expected.unicode; + } + } + + if (platform === 'win32') { + expected.datalistelem = false; + expected.fileinputdirectory = false; + expected.getusermedia = false; + expected.hiddenscroll = false; + expected.peerconnection = false; + expected.speechrecognition = false; + expected.speechsynthesis = false; + expected.todataurljpeg = false; + expected.unicode = false; + expected.webaudio = false; + + expected.input.list = false; + expected.inputtypes.color = false; + expected.inputtypes.month = false; + expected.inputtypes.week = false; + expected.inputtypes.date = false; + expected.inputtypes.time = false; + expected.inputtypes['datetime-local'] = false; + expected.inputtypes.time = false; + } + + expect(actual).toEqual(expected); }); + +function isDocker() { + try { + fs.statSync('/.dockerenv'); + return true; + } catch { + } + try { + return fs.readFileSync('/proc/self/cgroup', 'utf8').includes('docker'); + } catch { + } + return false; +}