test: add failing modernizr detection tests (#7453)

This commit is contained in:
Pavel Feldman 2021-07-03 19:18:21 -07:00 committed by GitHub
parent f52a53e21e
commit 41a63a8825
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 747 additions and 3 deletions

View File

@ -0,0 +1,15 @@
<script src='modernizr.js'></script>
<body></body>
<script>
window.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;
}
document.body.style.whiteSpace = 'pre';
document.body.textContent = JSON.stringify(window.report, undefined, 4);
</script>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,300 @@
{
"input": {
"autocomplete": true,
"autofocus": true,
"list": true,
"placeholder": true,
"max": true,
"min": true,
"multiple": true,
"pattern": true,
"required": true,
"step": true
},
"inputtypes": {
"search": true,
"tel": true,
"url": true,
"email": true,
"datetime": false,
"date": true,
"month": true,
"week": true,
"time": true,
"datetime-local": true,
"number": true,
"range": true,
"color": true
},
"htmlimports": false,
"history": true,
"ie8compat": false,
"applicationcache": true,
"blobconstructor": true,
"blob-constructor": true,
"cookies": true,
"cors": true,
"customelements": true,
"customprotocolhandler": false,
"customevent": true,
"dataview": true,
"eventlistener": true,
"geolocation": true,
"json": 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,
"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,
"deviceorientation": 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": true,
"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": false,
"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,
"pagevisibility": true,
"performance": true,
"pointerlock": false,
"quotamanagement": false,
"requestanimationframe": true,
"raf": true,
"vibrate": false,
"webintents": false,
"lowbattery": false,
"getrandomvalues": true,
"backgroundblendmode": true,
"objectfit": true,
"object-fit": true,
"regions": false,
"wrapflow": false,
"speechrecognition": true,
"filesystem": false,
"requestautocomplete": false,
"bloburls": true,
"transferables": true,
"peerconnection": true,
"datachannel": 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": false,
"csstransforms": true,
"csstransforms3d": true,
"csstransformslevel2": true,
"csstransitions": true,
"csspseudotransitions": true,
"userselect": true,
"variablefonts": true
}

View File

@ -0,0 +1,300 @@
{
"input": {
"autocomplete": true,
"autofocus": true,
"list": true,
"placeholder": true,
"max": true,
"min": true,
"multiple": true,
"pattern": true,
"required": true,
"step": true
},
"inputtypes": {
"search": true,
"tel": true,
"url": true,
"email": true,
"datetime": false,
"date": true,
"month": false,
"week": false,
"time": true,
"datetime-local": true,
"number": true,
"range": true,
"color": true
},
"htmlimports": false,
"history": true,
"ie8compat": false,
"applicationcache": true,
"blobconstructor": true,
"blob-constructor": true,
"cookies": true,
"cors": true,
"customelements": true,
"customprotocolhandler": false,
"customevent": true,
"dataview": true,
"eventlistener": true,
"geolocation": true,
"json": 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,
"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,
"deviceorientation": 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": true,
"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": false,
"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,
"pagevisibility": true,
"performance": true,
"pointerlock": true,
"quotamanagement": false,
"requestanimationframe": true,
"raf": true,
"vibrate": false,
"webintents": false,
"lowbattery": false,
"getrandomvalues": true,
"backgroundblendmode": true,
"objectfit": true,
"object-fit": true,
"regions": false,
"wrapflow": false,
"speechrecognition": true,
"filesystem": false,
"requestautocomplete": false,
"bloburls": true,
"transferables": true,
"peerconnection": true,
"datachannel": 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": false,
"csstransforms": true,
"csstransforms3d": true,
"csstransformslevel2": true,
"csstransitions": true,
"csspseudotransitions": true,
"userselect": true,
"variablefonts": true
}

127
tests/modernizr.spec.ts Normal file
View File

@ -0,0 +1,127 @@
/**
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browserTest as it, expect } from './config/browserTest';
import fs from 'fs';
async function checkFeatures(name: string, context: any, server: any) {
try {
const page = await context.newPage();
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);
} finally {
await context.close();
}
}
it('safari-14-1', async ({ browser, browserName, platform, server }) => {
it.fixme();
/*
+ "atRule": undefined,
"atob-btoa": true,
"atobbtoa": true,
- "audio": true,
+ "audio": Object {
+ "m4a": "maybe",
+ "mp3": "probably",
+ "ogg": "",
+ "opus": "",
+ "wav": "",
+ },
- "hairline": true,
+ "hairline": false,
+ "hasEvent": undefined,
+ "mq": undefined,
+ "testStyles": undefined,
- "video": true,
+ "video": Object {
+ "h264": "probably",
+ "hls": "probably",
+ "ogg": "",
+ "vp9": "",
+ "webm": "",
+ },
*/
it.skip(browserName !== 'webkit' || platform !== 'darwin');
const context = await browser.newContext();
await checkFeatures('safari-14-1', context, server);
});
it('mobile-safari-14-1', async ({ playwright, browser, browserName, platform, server }) => {
it.fixme();
/*
+ "atRule": undefined,
"atob-btoa": true,
"atobbtoa": true,
- "audio": true,
+ "audio": Object {
+ "m4a": "maybe",
+ "mp3": "probably",
+ "ogg": "",
+ "opus": "",
+ "wav": "",
+ },
- "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,
- "hairline": true,
+ "hairline": false,
+ "hasEvent": undefined,
"inputtypes": Object {
- "month": true,
+ "month": false,
- "week": true,
+ "week": false,
},
+ "mq": undefined,
- "notification": false,
+ "notification": true,
- "overflowscrolling": true,
+ "overflowscrolling": false,
- "pointerlock": false,
+ "pointerlock": true,
+ "testStyles": undefined,
- "video": true,
+ "video": Object {
+ "h264": "probably",
+ "hls": "probably",
+ "ogg": "",
+ "vp9": "",
+ "webm": "",
+ },
*/
it.skip(browserName !== 'webkit' || platform !== 'darwin');
const iPhone = playwright.devices['iPhone 12'];
const context = await browser.newContext(iPhone);
await checkFeatures('mobile-safari-14-1', context, server);
});