test: update Modernizer tests to Safari 18 (#32290)

Fixes https://github.com/microsoft/playwright/issues/32288

---------

Signed-off-by: Max Schmitt <max@schmitt.mx>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
This commit is contained in:
Max Schmitt 2024-08-23 16:59:55 +02:00 committed by GitHub
parent 787f20c920
commit 0d4d5758c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 4990 additions and 595 deletions

View File

@ -1,12 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Detect Touch Test</title>
<script src='modernizr.js'></script>
</head>
<body style="font-size:30vmin">
<script>
document.body.textContent = Modernizr.touchevents ? 'YES' : 'NO';
</script>
</body>
</html>

View File

@ -1,21 +0,0 @@
<script src='modernizr.js'></script>
<body></body>
<script>
const report = {};
for (const name in Modernizr) {
if (name.startsWith('_'))
continue;
if (['on', 'testAllProps', 'testProp', 'addTest', 'prefixed'].includes(name))
continue;
let value = Modernizr[name];
report[name] = value;
}
report['devicemotion2'] = 'ondevicemotion' in window;
report['deviceorientation2'] = 'orientation' in window;
report['deviceorientation3'] = 'ondeviceorientation' in window;
document.body.style.whiteSpace = 'pre';
document.body.textContent = JSON.stringify(report, undefined, 4);
window.report = JSON.parse(document.body.textContent);
</script>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,18 @@
# Playwright Modernizr tests
## Rolling Modernizr
- [modernizr.com](modernizr.com) isn't getting updated anymore, see [here](https://github.com/Modernizr/Modernizr/issues/2490) and [here](https://github.com/Modernizr/Modernizr/commit/db96bdaff995a1d4abccb0dc69c77db7b47ad614). It only contains version 3.6.
- This is why we build it from source ourselves, using `roll.sh` (they recommend it).
## Updating expectations
1. `npx http-server .`
1. Navigate to `http://127.0.0.1:8080/tests/assets/modernizr/index.html`
Do this with:
- Safari Technology Preview
- Apple iPhone
Make sure to change the updated file's name.

View File

@ -0,0 +1,26 @@
<script src='modernizr.js'></script>
<body></body>
<script>
function serialize(value) {
if (typeof value !== 'object')
return value;
const copy = {};
for (const key in value) {
if (typeof value[key] === 'function')
continue;
if (key.startsWith('_'))
continue;
copy[key] = serialize(value[key]);
}
return copy;
}
const report = serialize(Modernizr);
report['devicemotion2'] = 'ondevicemotion' in window;
report['deviceorientation2'] = 'orientation' in window;
report['deviceorientation3'] = 'ondeviceorientation' in window;
document.body.style.whiteSpace = 'pre';
document.body.textContent = JSON.stringify(report, undefined, 2);
window.report = JSON.parse(document.body.textContent);
</script>

View File

@ -11,6 +11,249 @@
"required": true,
"step": true
},
"adownload": true,
"aping": true,
"areaping": true,
"ambientlight": false,
"applicationcache": false,
"audio": {
"ogg": "",
"mp3": "probably",
"opus": "probably",
"wav": "probably",
"m4a": "maybe"
},
"audioloop": true,
"webaudio": true,
"batteryapi": false,
"battery-api": false,
"lowbattery": false,
"blobconstructor": true,
"blob-constructor": true,
"broadcastchannel": true,
"canvas": true,
"canvasblending": true,
"todataurljpeg": true,
"todataurlpng": true,
"todataurlwebp": false,
"canvaswinding": true,
"canvastext": true,
"clipboard": {
"read": true,
"readtext": true,
"write": true,
"writetext": true
},
"contenteditable": true,
"contextmenu": false,
"cors": true,
"crypto": true,
"getrandomvalues": true,
"cssall": true,
"cssanimations": true,
"appearance": true,
"aspectratio": true,
"backdropfilter": true,
"backgroundblendmode": true,
"backgroundcliptext": true,
"bgpositionshorthand": true,
"bgpositionxy": true,
"bgrepeatround": true,
"bgrepeatspace": true,
"backgroundsize": true,
"bgsizecover": true,
"borderimage": true,
"borderradius": true,
"boxdecorationbreak": true,
"boxshadow": true,
"boxsizing": true,
"csscalc": true,
"checked": true,
"csschunit": true,
"csscolumns": {
"width": true,
"span": true,
"fill": true,
"gap": true,
"rule": true,
"rulecolor": true,
"rulestyle": true,
"rulewidth": true,
"breakbefore": true,
"breakafter": true,
"breakinside": true
},
"cssgridlegacy": false,
"cssgrid": true,
"cubicbezierrange": true,
"customproperties": true,
"displayrunin": false,
"display-runin": false,
"displaytable": true,
"display-table": true,
"ellipsis": true,
"cssescape": true,
"cssexunit": true,
"supports": true,
"cssfilters": true,
"flexbox": true,
"flexboxlegacy": true,
"flexboxtweener": false,
"flexgap": true,
"flexwrap": true,
"focusvisible": true,
"focuswithin": true,
"fontdisplay": true,
"fontface": true,
"generatedcontent": true,
"cssgradients": true,
"hairline": true,
"hsla": true,
"cssinvalid": true,
"lastchild": true,
"cssmask": true,
"mediaqueries": true,
"multiplebgs": true,
"nthchild": true,
"objectfit": true,
"object-fit": true,
"opacity": true,
"overflowscrolling": true,
"csspointerevents": true,
"csspositionsticky": true,
"csspseudoanimations": true,
"csstransitions": true,
"csspseudotransitions": true,
"cssreflections": true,
"regions": false,
"cssremunit": true,
"cssresize": true,
"rgba": true,
"cssscrollbar": false,
"scrollsnappoints": true,
"shapes": true,
"siblinggeneral": true,
"subpixelfont": true,
"target": true,
"textalignlast": true,
"textdecoration": {
"line": true,
"style": true,
"color": true,
"skip": true,
"skipink": true
},
"textshadow": true,
"csstransforms": true,
"csstransforms3d": true,
"csstransformslevel2": true,
"preserve3d": true,
"userselect": true,
"cssvalid": true,
"variablefonts": true,
"cssvhunit": true,
"cssvmaxunit": false,
"cssvminunit": true,
"cssvwunit": true,
"willchange": true,
"wrapflow": false,
"customelements": true,
"customprotocolhandler": false,
"dart": false,
"dataview": true,
"classlist": true,
"createelementattrs": false,
"createelement-attrs": false,
"dataset": true,
"documentfragment": true,
"hidden": true,
"intersectionobserver": true,
"microdata": false,
"mutationobserver": true,
"passiveeventlisteners": true,
"shadowroot": true,
"shadowrootlegacy": false,
"bdi": true,
"details": true,
"outputelem": true,
"picture": true,
"progressbar": true,
"meter": true,
"ruby": true,
"template": true,
"time": false,
"texttrackapi": true,
"track": true,
"unknownelements": true,
"emoji": true,
"es5array": true,
"es5date": true,
"es5function": true,
"es5object": true,
"strictmode": true,
"es5string": true,
"json": true,
"es5syntax": true,
"es5undefined": true,
"es5": true,
"es6array": true,
"arrow": true,
"es6class": true,
"es6collections": true,
"generators": true,
"es6math": true,
"es6number": true,
"es6object": true,
"promises": true,
"restparameters": true,
"spreadarray": true,
"stringtemplate": true,
"es6string": true,
"es6symbol": true,
"es7array": true,
"restdestructuringarray": true,
"restdestructuringobject": true,
"spreadobject": true,
"es8object": true,
"customevent": true,
"devicemotion": true,
"deviceorientation": true,
"eventlistener": true,
"forcetouch": false,
"hashchange": true,
"oninput": true,
"pointerevents": true,
"proximity": false,
"filereader": true,
"filesystem": false,
"flash": false,
"fullscreen": false,
"gamepads": true,
"geolocation": true,
"hiddenscroll": true,
"history": true,
"htmlimports": false,
"ie8compat": false,
"sandbox": true,
"seamless": false,
"srcdoc": true,
"imgcrossorigin": true,
"lazyloading": true,
"sizes": true,
"srcset": true,
"capture": true,
"fileinput": true,
"fileinputdirectory": true,
"inputformaction": true,
"input-formaction": true,
"formattribute": true,
"inputformenctype": true,
"input-formenctype": true,
"inputformmethod": true,
"inputformnovalidate": true,
"input-formnovalidate": true,
"inputformtarget": true,
"input-formtarget": true,
"inputtypes": {
"search": true,
"tel": true,
@ -26,278 +269,140 @@
"range": true,
"color": true
},
"htmlimports": false,
"history": true,
"ie8compat": false,
"applicationcache": false,
"blobconstructor": true,
"blob-constructor": true,
"cookies": true,
"cors": true,
"customelements": true,
"customprotocolhandler": false,
"customevent": true,
"dataview": true,
"eventlistener": true,
"geolocation": true,
"json": true,
"formvalidation": true,
"localizednumber": false,
"inputsearchevent": false,
"placeholder": true,
"requestautocomplete": false,
"intl": true,
"ligatures": true,
"olreversed": true,
"mathml": true,
"mediasource": false,
"hovermq": false,
"pointermq": true,
"messagechannel": true,
"notification": false,
"postmessage": true,
"queryselector": true,
"serviceworker": true,
"svg": true,
"templatestrings": true,
"typedarrays": true,
"websockets": true,
"xdomainrequest": false,
"webaudio": true,
"cssescape": true,
"focuswithin": true,
"supports": true,
"target": true,
"microdata": false,
"mutationobserver": true,
"passiveeventlisteners": true,
"picture": true,
"es5array": true,
"es5date": true,
"es5function": true,
"beacon": true,
"effectivetype": false,
"lowbandwidth": false,
"eventsource": true,
"fetch": true,
"xhrresponsetype": true,
"xhr2": true,
"speechsynthesis": true,
"localstorage": true,
"sessionstorage": true,
"websqldatabase": true,
"es5object": true,
"svgfilters": true,
"strictmode": true,
"es5string": true,
"es5syntax": true,
"es5undefined": true,
"es5": true,
"es6array": true,
"arrow": true,
"es6collections": true,
"generators": true,
"es6math": true,
"es6number": true,
"es6object": true,
"promises": true,
"es6string": true,
"devicemotion": true,
"devicemotion2": true,
"deviceorientation": true,
"deviceorientation2": true,
"deviceorientation3": true,
"filereader": true,
"urlparser": true,
"urlsearchparams": true,
"framed": false,
"webworkers": true,
"contextmenu": false,
"cssall": true,
"willchange": true,
"classlist": true,
"documentfragment": true,
"contains": false,
"audio": true,
"canvas": true,
"canvastext": true,
"contenteditable": true,
"emoji": false,
"olreversed": true,
"userdata": false,
"video": true,
"vml": false,
"webanimations": true,
"webgl": true,
"adownload": true,
"audioloop": true,
"canvasblending": true,
"todataurljpeg": true,
"todataurlpng": true,
"todataurlwebp": false,
"canvaswinding": true,
"bgpositionshorthand": true,
"multiplebgs": true,
"csspointerevents": true,
"cssremunit": true,
"rgba": true,
"preserve3d": true,
"createelementattrs": false,
"createelement-attrs": false,
"dataset": true,
"hidden": true,
"outputelem": true,
"progressbar": true,
"meter": true,
"ruby": true,
"template": true,
"srcset": true,
"time": false,
"texttrackapi": true,
"track": true,
"unknownelements": true,
"inputformaction": true,
"input-formaction": true,
"inputformenctype": true,
"input-formenctype": true,
"inputformmethod": true,
"inputformtarget": false,
"input-formtarget": false,
"scriptasync": true,
"scriptdefer": true,
"stylescoped": false,
"capture": true,
"fileinput": true,
"formattribute": true,
"placeholder": true,
"sandbox": true,
"inlinesvg": true,
"textareamaxlength": true,
"videocrossorigin": true,
"webglextensions": true,
"seamless": false,
"srcdoc": true,
"imgcrossorigin": true,
"hashchange": true,
"inputsearchevent": false,
"ambientlight": false,
"datalistelem": true,
"videoloop": true,
"csscalc": true,
"cubicbezierrange": true,
"cssgradients": true,
"opacity": true,
"csspositionsticky": true,
"csschunit": true,
"cssexunit": true,
"hsla": true,
"videopreload": true,
"getusermedia": true,
"websocketsbinary": true,
"atobbtoa": true,
"atob-btoa": true,
"sharedworkers": true,
"bdi": true,
"xhrresponsetypearraybuffer": true,
"xhrresponsetypeblob": true,
"xhrresponsetypedocument": true,
"xhrresponsetypejson": true,
"xhrresponsetypetext": true,
"svgclippaths": true,
"svgforeignobject": true,
"smil": true,
"hiddenscroll": true,
"mathml": true,
"touchevents": true,
"unicoderange": true,
"unicode": true,
"checked": true,
"displaytable": true,
"display-table": true,
"fontface": true,
"generatedcontent": true,
"hairline": true,
"cssinvalid": true,
"lastchild": true,
"nthchild": true,
"cssscrollbar": false,
"siblinggeneral": true,
"subpixelfont": true,
"cssvalid": true,
"cssvhunit": false,
"cssvmaxunit": false,
"cssvminunit": true,
"cssvwunit": true,
"details": true,
"oninput": true,
"formvalidation": true,
"localizednumber": false,
"mediaqueries": true,
"flash": false,
"proximity": false,
"sizes": true,
"hovermq": false,
"pointermq": true,
"svgasimg": true,
"pointerevents": true,
"fileinputdirectory": true,
"textshadow": true,
"batteryapi": false,
"battery-api": false,
"crypto": true,
"dart": false,
"forcetouch": false,
"fullscreen": false,
"gamepads": true,
"intl": true,
"xhrresponsetype": true,
"xhr2": true,
"notification": false,
"pagevisibility": true,
"performance": true,
"pointerlock": false,
"quotamanagement": false,
"postmessage": {
"structuredclones": true
},
"proxy": true,
"queryselector": true,
"prefetch": false,
"requestanimationframe": true,
"raf": true,
"vibrate": false,
"webintents": false,
"lowbattery": false,
"getrandomvalues": true,
"backgroundblendmode": true,
"objectfit": true,
"object-fit": true,
"regions": false,
"wrapflow": false,
"scriptasync": true,
"scriptdefer": true,
"scrolltooptions": true,
"serviceworker": true,
"speechrecognition": true,
"filesystem": false,
"requestautocomplete": false,
"speechsynthesis": true,
"cookies": true,
"localstorage": true,
"quotamanagement": false,
"sessionstorage": true,
"userdata": false,
"websqldatabase": true,
"stylescoped": false,
"svg": true,
"svgasimg": true,
"svgclippaths": true,
"svgfilters": true,
"svgforeignobject": true,
"inlinesvg": true,
"smil": true,
"textareamaxlength": true,
"textencoder": true,
"textdecoder": true,
"typedarrays": true,
"unicoderange": true,
"bloburls": true,
"transferables": true,
"urlparser": true,
"urlsearchparams": true,
"vibrate": false,
"video": {
"ogg": "",
"h264": "probably",
"h265": "",
"webm": "probably",
"vp9": "probably",
"hls": "probably",
"av1": ""
},
"videocrossorigin": true,
"videoloop": true,
"videopreload": true,
"vml": false,
"webintents": false,
"webanimations": true,
"publickeycredential": true,
"webgl": true,
"webglextensions": {
"ANGLE_instanced_arrays": true,
"EXT_blend_minmax": true,
"EXT_clip_control": true,
"EXT_color_buffer_half_float": true,
"EXT_depth_clamp": true,
"EXT_frag_depth": true,
"EXT_polygon_offset_clamp": true,
"EXT_shader_texture_lod": true,
"EXT_texture_filter_anisotropic": true,
"EXT_sRGB": true,
"KHR_parallel_shader_compile": true,
"OES_element_index_uint": true,
"OES_fbo_render_mipmap": true,
"OES_standard_derivatives": true,
"OES_texture_float": true,
"OES_texture_half_float": true,
"OES_texture_half_float_linear": true,
"OES_vertex_array_object": true,
"WEBGL_color_buffer_float": true,
"WEBGL_compressed_texture_astc": true,
"WEBGL_compressed_texture_etc": true,
"WEBGL_compressed_texture_etc1": true,
"WEBGL_compressed_texture_pvrtc": true,
"WEBKIT_WEBGL_compressed_texture_pvrtc": true,
"WEBGL_debug_renderer_info": true,
"WEBGL_debug_shaders": true,
"WEBGL_depth_texture": true,
"WEBGL_draw_buffers": true,
"WEBGL_lose_context": true,
"WEBGL_multi_draw": true,
"WEBGL_polygon_mode": true
},
"peerconnection": true,
"datachannel": false,
"datachannel": true,
"getusermedia": true,
"mediastream": true,
"websockets": true,
"websocketsbinary": true,
"atobbtoa": true,
"atob-btoa": true,
"framed": false,
"matchmedia": true,
"ligatures": true,
"cssanimations": true,
"csspseudoanimations": true,
"appearance": true,
"backdropfilter": true,
"backgroundcliptext": true,
"bgpositionxy": true,
"bgrepeatround": true,
"bgrepeatspace": true,
"backgroundsize": true,
"bgsizecover": true,
"borderimage": true,
"borderradius": true,
"boxshadow": true,
"boxsizing": true,
"csscolumns": true,
"cssgridlegacy": false,
"cssgrid": true,
"displayrunin": false,
"display-runin": false,
"ellipsis": true,
"cssfilters": true,
"flexbox": true,
"flexboxlegacy": true,
"flexboxtweener": false,
"flexwrap": true,
"cssmask": true,
"overflowscrolling": true,
"cssreflections": true,
"cssresize": true,
"scrollsnappoints": true,
"shapes": true,
"textalignlast": true,
"csstransforms": true,
"csstransforms3d": true,
"csstransformslevel2": true,
"csstransitions": true,
"csspseudotransitions": true,
"userselect": true,
"variablefonts": true
"pushmanager": false,
"resizeobserver": true,
"workertypeoption": true,
"sharedworkers": true,
"webworkers": true,
"transferables": true,
"xdomainrequest": false,
"devicemotion2": true,
"deviceorientation2": true,
"deviceorientation3": true
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
MODERNIZR_VERSION="44fa7b07c367a1814e8699e3a2f15c53fbe32df7"
cd "$(dirname "$0")"
rm -rf Modernizr
git clone https://github.com/Modernizr/Modernizr
cd Modernizr
git checkout $MODERNIZR_VERSION
npm ci
# Modernizr minifier is not working, hence we minify with ESBuild.
./bin/modernizr --config lib/config-all.json
npx esbuild --bundle modernizr.js --minify --outfile=../modernizr.js
cd ..
rm -rf Modernizr

View File

@ -11,6 +11,249 @@
"required": true,
"step": true
},
"adownload": true,
"aping": true,
"areaping": true,
"ambientlight": false,
"applicationcache": false,
"audio": {
"ogg": "",
"mp3": "probably",
"opus": "probably",
"wav": "probably",
"m4a": "maybe"
},
"audioloop": true,
"webaudio": true,
"batteryapi": false,
"battery-api": false,
"lowbattery": false,
"blobconstructor": true,
"blob-constructor": true,
"broadcastchannel": true,
"canvas": true,
"canvasblending": true,
"todataurljpeg": true,
"todataurlpng": true,
"todataurlwebp": false,
"canvaswinding": true,
"canvastext": true,
"clipboard": {
"read": true,
"readtext": true,
"write": true,
"writetext": true
},
"contenteditable": true,
"contextmenu": false,
"cors": true,
"crypto": true,
"getrandomvalues": true,
"cssall": true,
"cssanimations": true,
"appearance": true,
"aspectratio": true,
"backdropfilter": true,
"backgroundblendmode": true,
"backgroundcliptext": true,
"bgpositionshorthand": true,
"bgpositionxy": true,
"bgrepeatround": true,
"bgrepeatspace": true,
"backgroundsize": true,
"bgsizecover": true,
"borderimage": true,
"borderradius": true,
"boxdecorationbreak": true,
"boxshadow": true,
"boxsizing": true,
"csscalc": true,
"checked": true,
"csschunit": true,
"csscolumns": {
"width": true,
"span": true,
"fill": true,
"gap": true,
"rule": true,
"rulecolor": true,
"rulestyle": true,
"rulewidth": true,
"breakbefore": true,
"breakafter": true,
"breakinside": true
},
"cssgridlegacy": false,
"cssgrid": true,
"cubicbezierrange": true,
"customproperties": true,
"displayrunin": false,
"display-runin": false,
"displaytable": true,
"display-table": true,
"ellipsis": true,
"cssescape": true,
"cssexunit": true,
"supports": true,
"cssfilters": true,
"flexbox": true,
"flexboxlegacy": true,
"flexboxtweener": false,
"flexgap": true,
"flexwrap": true,
"focusvisible": true,
"focuswithin": true,
"fontdisplay": true,
"fontface": true,
"generatedcontent": true,
"cssgradients": true,
"hairline": true,
"hsla": true,
"cssinvalid": true,
"lastchild": true,
"cssmask": true,
"mediaqueries": true,
"multiplebgs": true,
"nthchild": true,
"objectfit": true,
"object-fit": true,
"opacity": true,
"overflowscrolling": false,
"csspointerevents": true,
"csspositionsticky": true,
"csspseudoanimations": true,
"csstransitions": true,
"csspseudotransitions": true,
"cssreflections": true,
"regions": false,
"cssremunit": true,
"cssresize": true,
"rgba": true,
"cssscrollbar": true,
"scrollsnappoints": true,
"shapes": true,
"siblinggeneral": true,
"subpixelfont": true,
"target": true,
"textalignlast": true,
"textdecoration": {
"line": true,
"style": true,
"color": true,
"skip": true,
"skipink": true
},
"textshadow": true,
"csstransforms": true,
"csstransforms3d": true,
"csstransformslevel2": true,
"preserve3d": true,
"userselect": true,
"cssvalid": true,
"variablefonts": true,
"cssvhunit": true,
"cssvmaxunit": true,
"cssvminunit": true,
"cssvwunit": true,
"willchange": true,
"wrapflow": false,
"customelements": true,
"customprotocolhandler": false,
"dart": false,
"dataview": true,
"classlist": true,
"createelementattrs": false,
"createelement-attrs": false,
"dataset": true,
"documentfragment": true,
"hidden": true,
"intersectionobserver": true,
"microdata": false,
"mutationobserver": true,
"passiveeventlisteners": true,
"shadowroot": true,
"shadowrootlegacy": false,
"bdi": true,
"details": true,
"outputelem": true,
"picture": true,
"progressbar": true,
"meter": true,
"ruby": true,
"template": true,
"time": false,
"texttrackapi": true,
"track": true,
"unknownelements": true,
"emoji": true,
"es5array": true,
"es5date": true,
"es5function": true,
"es5object": true,
"strictmode": true,
"es5string": true,
"json": true,
"es5syntax": true,
"es5undefined": true,
"es5": true,
"es6array": true,
"arrow": true,
"es6class": true,
"es6collections": true,
"generators": true,
"es6math": true,
"es6number": true,
"es6object": true,
"promises": true,
"restparameters": true,
"spreadarray": true,
"stringtemplate": true,
"es6string": true,
"es6symbol": true,
"es7array": true,
"restdestructuringarray": true,
"restdestructuringobject": true,
"spreadobject": true,
"es8object": true,
"customevent": true,
"devicemotion": true,
"deviceorientation": true,
"eventlistener": true,
"forcetouch": false,
"hashchange": true,
"oninput": true,
"pointerevents": true,
"proximity": false,
"filereader": true,
"filesystem": false,
"flash": false,
"fullscreen": true,
"gamepads": true,
"geolocation": true,
"hiddenscroll": false,
"history": true,
"htmlimports": false,
"ie8compat": false,
"sandbox": true,
"seamless": false,
"srcdoc": true,
"imgcrossorigin": true,
"lazyloading": true,
"sizes": true,
"srcset": true,
"capture": false,
"fileinput": true,
"fileinputdirectory": true,
"inputformaction": true,
"input-formaction": true,
"formattribute": true,
"inputformenctype": true,
"input-formenctype": true,
"inputformmethod": true,
"inputformnovalidate": true,
"input-formnovalidate": true,
"inputformtarget": true,
"input-formtarget": true,
"inputtypes": {
"search": true,
"tel": true,
@ -26,278 +269,148 @@
"range": true,
"color": true
},
"htmlimports": false,
"history": true,
"ie8compat": false,
"applicationcache": false,
"blobconstructor": true,
"blob-constructor": true,
"cookies": true,
"cors": true,
"customelements": true,
"customprotocolhandler": false,
"customevent": true,
"dataview": true,
"eventlistener": true,
"geolocation": true,
"json": true,
"formvalidation": true,
"localizednumber": false,
"inputsearchevent": false,
"placeholder": true,
"requestautocomplete": false,
"intl": true,
"ligatures": true,
"olreversed": true,
"mathml": true,
"mediasource": true,
"hovermq": true,
"pointermq": true,
"messagechannel": true,
"notification": true,
"postmessage": true,
"queryselector": true,
"serviceworker": true,
"svg": true,
"templatestrings": true,
"typedarrays": true,
"websockets": true,
"xdomainrequest": false,
"webaudio": true,
"cssescape": true,
"focuswithin": true,
"supports": true,
"target": true,
"microdata": false,
"mutationobserver": true,
"passiveeventlisteners": true,
"picture": true,
"es5array": true,
"es5date": true,
"es5function": true,
"beacon": true,
"effectivetype": false,
"lowbandwidth": false,
"eventsource": true,
"fetch": true,
"xhrresponsetype": true,
"xhr2": true,
"speechsynthesis": true,
"localstorage": true,
"sessionstorage": true,
"websqldatabase": true,
"es5object": true,
"svgfilters": true,
"strictmode": true,
"es5string": true,
"es5syntax": true,
"es5undefined": true,
"es5": true,
"es6array": true,
"arrow": true,
"es6collections": true,
"generators": true,
"es6math": true,
"es6number": true,
"es6object": true,
"promises": true,
"es6string": true,
"devicemotion": false,
"devicemotion2": false,
"deviceorientation": false,
"deviceorientation2": false,
"deviceorientation3": false,
"filereader": true,
"urlparser": true,
"urlsearchparams": true,
"framed": false,
"webworkers": true,
"contextmenu": false,
"cssall": true,
"willchange": true,
"classlist": true,
"documentfragment": true,
"contains": false,
"audio": true,
"canvas": true,
"canvastext": true,
"contenteditable": true,
"emoji": true,
"olreversed": true,
"userdata": false,
"video": true,
"vml": false,
"webanimations": true,
"webgl": true,
"adownload": true,
"audioloop": true,
"canvasblending": true,
"todataurljpeg": true,
"todataurlpng": true,
"todataurlwebp": false,
"canvaswinding": true,
"bgpositionshorthand": true,
"multiplebgs": true,
"csspointerevents": true,
"cssremunit": true,
"rgba": true,
"preserve3d": true,
"createelementattrs": false,
"createelement-attrs": false,
"dataset": true,
"hidden": true,
"outputelem": true,
"progressbar": true,
"meter": true,
"ruby": true,
"template": true,
"srcset": true,
"time": false,
"texttrackapi": true,
"track": true,
"unknownelements": true,
"inputformaction": true,
"input-formaction": true,
"inputformenctype": true,
"input-formenctype": true,
"inputformmethod": true,
"inputformtarget": false,
"input-formtarget": false,
"scriptasync": true,
"scriptdefer": true,
"stylescoped": false,
"capture": false,
"fileinput": true,
"formattribute": true,
"placeholder": true,
"sandbox": true,
"inlinesvg": true,
"textareamaxlength": true,
"videocrossorigin": true,
"webglextensions": true,
"seamless": false,
"srcdoc": true,
"imgcrossorigin": true,
"hashchange": true,
"inputsearchevent": false,
"ambientlight": false,
"datalistelem": true,
"videoloop": true,
"csscalc": true,
"cubicbezierrange": true,
"cssgradients": true,
"opacity": true,
"csspositionsticky": true,
"csschunit": true,
"cssexunit": true,
"hsla": true,
"videopreload": true,
"getusermedia": true,
"websocketsbinary": true,
"atobbtoa": true,
"atob-btoa": true,
"sharedworkers": true,
"bdi": true,
"xhrresponsetypearraybuffer": true,
"xhrresponsetypeblob": true,
"xhrresponsetypedocument": true,
"xhrresponsetypejson": true,
"xhrresponsetypetext": true,
"svgclippaths": true,
"svgforeignobject": true,
"smil": true,
"hiddenscroll": true,
"mathml": true,
"touchevents": false,
"unicoderange": true,
"unicode": true,
"checked": true,
"displaytable": true,
"display-table": true,
"fontface": true,
"generatedcontent": true,
"hairline": true,
"cssinvalid": true,
"lastchild": true,
"nthchild": true,
"cssscrollbar": true,
"siblinggeneral": true,
"subpixelfont": true,
"cssvalid": true,
"cssvhunit": true,
"cssvmaxunit": true,
"cssvminunit": true,
"cssvwunit": true,
"details": true,
"oninput": true,
"formvalidation": true,
"localizednumber": false,
"mediaqueries": true,
"flash": false,
"proximity": false,
"sizes": true,
"hovermq": true,
"pointermq": true,
"svgasimg": true,
"pointerevents": true,
"fileinputdirectory": true,
"textshadow": true,
"batteryapi": false,
"battery-api": false,
"crypto": true,
"dart": false,
"forcetouch": false,
"fullscreen": true,
"gamepads": true,
"intl": true,
"xhrresponsetype": true,
"xhr2": true,
"notification": true,
"pagevisibility": true,
"performance": true,
"pointerlock": true,
"quotamanagement": false,
"postmessage": {
"structuredclones": true
},
"proxy": true,
"queryselector": true,
"prefetch": false,
"requestanimationframe": true,
"raf": true,
"vibrate": false,
"webintents": false,
"lowbattery": false,
"getrandomvalues": true,
"backgroundblendmode": true,
"objectfit": true,
"object-fit": true,
"regions": false,
"wrapflow": false,
"scriptasync": true,
"scriptdefer": true,
"scrolltooptions": false,
"serviceworker": true,
"speechrecognition": true,
"filesystem": false,
"requestautocomplete": false,
"speechsynthesis": true,
"cookies": true,
"localstorage": true,
"quotamanagement": false,
"sessionstorage": true,
"userdata": false,
"websqldatabase": true,
"stylescoped": false,
"svg": true,
"svgasimg": true,
"svgclippaths": true,
"svgfilters": true,
"svgforeignobject": true,
"inlinesvg": true,
"smil": true,
"textareamaxlength": true,
"textencoder": true,
"textdecoder": true,
"typedarrays": true,
"unicoderange": true,
"bloburls": true,
"transferables": true,
"urlparser": true,
"urlsearchparams": true,
"vibrate": false,
"video": {
"ogg": "",
"h264": "probably",
"h265": "",
"webm": "probably",
"vp9": "probably",
"hls": "probably",
"av1": ""
},
"videocrossorigin": true,
"videoloop": true,
"videopreload": true,
"vml": false,
"webintents": false,
"webanimations": true,
"publickeycredential": true,
"webgl": true,
"webglextensions": {
"ANGLE_instanced_arrays": true,
"EXT_blend_minmax": true,
"EXT_clip_control": true,
"EXT_color_buffer_half_float": true,
"EXT_depth_clamp": true,
"EXT_float_blend": true,
"EXT_frag_depth": true,
"EXT_polygon_offset_clamp": true,
"EXT_shader_texture_lod": true,
"EXT_texture_compression_bptc": true,
"EXT_texture_compression_rgtc": true,
"EXT_texture_filter_anisotropic": true,
"EXT_texture_mirror_clamp_to_edge": true,
"EXT_sRGB": true,
"KHR_parallel_shader_compile": true,
"OES_element_index_uint": true,
"OES_fbo_render_mipmap": true,
"OES_standard_derivatives": true,
"OES_texture_float": true,
"OES_texture_float_linear": true,
"OES_texture_half_float": true,
"OES_texture_half_float_linear": true,
"OES_vertex_array_object": true,
"WEBGL_blend_func_extended": true,
"WEBGL_color_buffer_float": true,
"WEBGL_compressed_texture_astc": true,
"WEBGL_compressed_texture_etc": true,
"WEBGL_compressed_texture_etc1": true,
"WEBGL_compressed_texture_pvrtc": true,
"WEBKIT_WEBGL_compressed_texture_pvrtc": true,
"WEBGL_compressed_texture_s3tc": true,
"WEBGL_compressed_texture_s3tc_srgb": true,
"WEBGL_debug_renderer_info": true,
"WEBGL_debug_shaders": true,
"WEBGL_depth_texture": true,
"WEBGL_draw_buffers": true,
"WEBGL_lose_context": true,
"WEBGL_multi_draw": true,
"WEBGL_polygon_mode": true
},
"peerconnection": true,
"datachannel": false,
"datachannel": true,
"getusermedia": true,
"mediastream": true,
"websockets": true,
"websocketsbinary": true,
"atobbtoa": true,
"atob-btoa": true,
"framed": false,
"matchmedia": true,
"ligatures": true,
"cssanimations": true,
"csspseudoanimations": true,
"appearance": true,
"backdropfilter": true,
"backgroundcliptext": true,
"bgpositionxy": true,
"bgrepeatround": true,
"bgrepeatspace": true,
"backgroundsize": true,
"bgsizecover": true,
"borderimage": true,
"borderradius": true,
"boxshadow": true,
"boxsizing": true,
"csscolumns": true,
"cssgridlegacy": false,
"cssgrid": true,
"displayrunin": false,
"display-runin": false,
"ellipsis": true,
"cssfilters": true,
"flexbox": true,
"flexboxlegacy": true,
"flexboxtweener": false,
"flexwrap": true,
"cssmask": true,
"overflowscrolling": false,
"cssreflections": true,
"cssresize": true,
"scrollsnappoints": true,
"shapes": true,
"textalignlast": true,
"csstransforms": true,
"csstransforms3d": true,
"csstransformslevel2": true,
"csstransitions": true,
"csspseudotransitions": true,
"userselect": true,
"variablefonts": true
}
"pushmanager": true,
"resizeobserver": true,
"workertypeoption": true,
"sharedworkers": true,
"webworkers": true,
"transferables": true,
"xdomainrequest": false,
"devicemotion2": true,
"deviceorientation2": false,
"deviceorientation3": true
}

View File

@ -15,7 +15,6 @@
* limitations under the License.
*/
import os from 'os';
import { browserTest as it, expect } from '../config/browserTest';
it.describe('mobile viewport', () => {
@ -55,23 +54,19 @@ it.describe('mobile viewport', () => {
}
});
it('should be detectable by Modernizr', async ({ playwright, browser, server, browserName, platform }) => {
it.skip(browserName === 'webkit' && platform === 'darwin' && parseInt(os.release(), 10) === 22, 'detect-touch.html uses Modernizr which uses WebGL. WebGL is not available in macOS-13 - https://bugs.webkit.org/show_bug.cgi?id=278277');
it('should be detectable', async ({ playwright, browser, server, browserName, platform }) => {
const iPhone = playwright.devices['iPhone 6'];
const context = await browser.newContext({ ...iPhone });
const page = await context.newPage();
await page.goto(server.PREFIX + '/detect-touch.html');
expect(await page.evaluate(() => document.body.textContent!.trim())).toBe('YES');
expect(await page.evaluate(() => 'ontouchstart' in window || !!window.TouchEvent)).toBe(true);
await context.close();
});
it('should detect touch when applying viewport with touches', async ({ browser, server, browserName, platform }) => {
it.skip(browserName === 'webkit' && platform === 'darwin' && parseInt(os.release(), 10) === 22, 'Modernizr uses WebGL. WebGL is not available in macOS-13 - https://bugs.webkit.org/show_bug.cgi?id=278277');
const context = await browser.newContext({ viewport: { width: 800, height: 600 }, hasTouch: true });
const page = await context.newPage();
await page.goto(server.EMPTY_PAGE);
await page.addScriptTag({ url: server.PREFIX + '/modernizr.js' });
expect(await page.evaluate(() => (window as any)['Modernizr'].touchevents)).toBe(true);
expect(await page.evaluate(() => 'ontouchstart' in window || !!window.TouchEvent)).toBe(true);
await context.close();
});

View File

@ -94,11 +94,8 @@ it('should emulate availWidth and availHeight', async ({ page }) => {
});
it('should not have touch by default', async ({ page, server, browserName, platform }) => {
it.skip(browserName === 'webkit' && platform === 'darwin' && parseInt(os.release(), 10) === 22, 'detect-touch.html uses Modernizr which uses WebGL. WebGL is not available in macOS-13 - https://bugs.webkit.org/show_bug.cgi?id=278277');
await page.goto(server.PREFIX + '/mobile.html');
expect(await page.evaluate(() => 'ontouchstart' in window)).toBe(false);
await page.goto(server.PREFIX + '/detect-touch.html');
expect(await page.evaluate(() => document.body.textContent.trim())).toBe('NO');
});
it('should throw on tap if hasTouch is not enabled', async ({ page }) => {

View File

@ -21,7 +21,7 @@ import os from 'os';
async function checkFeatures(name: string, context: any, server: any) {
try {
const page = await context.newPage();
await page.goto(server.PREFIX + '/modernizr.html');
await page.goto(server.PREFIX + '/modernizr/index.html');
const actual = await page.evaluate('window.report');
const expected = JSON.parse(fs.readFileSync(require.resolve(`../assets/modernizr/${name}.json`), 'utf-8'));
return { actual, expected };
@ -30,28 +30,39 @@ async function checkFeatures(name: string, context: any, server: any) {
}
}
it('safari-14-1', async ({ browser, browserName, platform, server, headless, isMac }) => {
it('Safari Desktop', async ({ browser, browserName, platform, server, headless, isMac }) => {
it.skip(browserName !== 'webkit');
it.skip(browserName === 'webkit' && platform === 'darwin' && parseInt(os.release(), 10) === 22, 'Modernizr uses WebGL which is not available in macOS-13 - https://bugs.webkit.org/show_bug.cgi?id=278277');
const context = await browser.newContext({
deviceScaleFactor: 2
});
const { actual, expected } = await checkFeatures('safari-14-1', context, server);
const { actual, expected } = await checkFeatures('safari-18', context, server);
expected.pushmanager = false;
expected.hiddenscroll = true;
expected.devicemotion2 = false;
expected.devicemotion = false;
expected.deviceorientation = false;
expected.deviceorientation3 = false;
delete expected.webglextensions;
delete actual.webglextensions;
expected.audio = !!expected.audio;
actual.audio = !!actual.audio;
expected.video = !!expected.video;
actual.video = !!actual.video;
if (platform === 'linux') {
expected.subpixelfont = false;
expected.speechrecognition = false;
expected.publickeycredential = false;
expected.mediastream = false;
if (headless)
expected.todataurljpeg = false;
// GHA
delete actual.variablefonts;
delete expected.variablefonts;
if (isDocker()) {
delete actual.unicode;
delete expected.unicode;
}
}
if (platform === 'win32') {
@ -61,30 +72,34 @@ it('safari-14-1', async ({ browser, browserName, platform, server, headless, isM
expected.speechrecognition = false;
expected.speechsynthesis = false;
expected.todataurljpeg = false;
expected.unicode = false;
expected.webaudio = false;
expected.gamepads = false;
expected.input.list = false;
delete expected.datalistelem;
expected.publickeycredential = false;
expected.mediastream = false;
expected.mediasource = false;
expected.datachannel = false;
expected.inputtypes.color = false;
expected.inputtypes.month = false;
expected.inputtypes.week = false;
expected.inputtypes.date = false;
expected.inputtypes['datetime-local'] = false;
expected.inputtypes.time = false;
}
if (isMac && parseInt(os.release(), 10) > 20)
expected.applicationcache = false;
expect(actual).toEqual(expected);
});
it('mobile-safari-14-1', async ({ playwright, browser, browserName, platform, isMac, server, headless }) => {
it('Mobile Safari', async ({ playwright, browser, browserName, platform, isMac, server, headless }) => {
it.skip(browserName !== 'webkit');
it.skip(browserName === 'webkit' && platform === 'darwin' && parseInt(os.release(), 10) < 20, 'WebKit for macOS 10.15 is frozen.');
it.skip(browserName === 'webkit' && platform === 'darwin' && parseInt(os.release(), 10) === 22, 'Modernizr uses WebGL which is not available in macOS-13 - https://bugs.webkit.org/show_bug.cgi?id=278277');
const iPhone = playwright.devices['iPhone 12'];
const context = await browser.newContext(iPhone);
const { actual, expected } = await checkFeatures('mobile-safari-14-1', context, server);
const { actual, expected } = await checkFeatures('mobile-safari-18', context, server);
{
// All platforms.
@ -93,22 +108,28 @@ it('mobile-safari-14-1', async ({ playwright, browser, browserName, platform, is
expected.cssvhunit = true;
expected.cssvmaxunit = true;
expected.overflowscrolling = false;
expected.mediasource = true;
expected.scrolltooptions = false;
delete expected.webglextensions;
delete actual.webglextensions;
expected.audio = !!expected.audio;
actual.audio = !!actual.audio;
expected.video = !!expected.video;
actual.video = !!actual.video;
}
if (platform === 'linux') {
expected.subpixelfont = false;
expected.speechrecognition = false;
expected.publickeycredential = false;
expected.mediastream = false;
if (headless)
expected.todataurljpeg = false;
// GHA
delete actual.variablefonts;
delete expected.variablefonts;
if (isDocker()) {
delete actual.unicode;
delete expected.unicode;
}
}
if (platform === 'win32') {
@ -118,32 +139,25 @@ it('mobile-safari-14-1', async ({ playwright, browser, browserName, platform, is
expected.speechrecognition = false;
expected.speechsynthesis = false;
expected.todataurljpeg = false;
expected.unicode = false;
expected.webaudio = false;
expected.gamepads = false;
expected.input.list = false;
delete expected.datalistelem;
expected.publickeycredential = false;
expected.mediastream = false;
expected.mediasource = false;
expected.datachannel = 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;
}