diff --git a/docs/package.json b/docs/package.json index 9d96dc6c38a197..72b5bb2a4ec381 100644 --- a/docs/package.json +++ b/docs/package.json @@ -30,7 +30,7 @@ "@fortawesome/free-solid-svg-icons": "^5.14.0", "@fortawesome/react-fontawesome": "^0.1.11", "@material-ui/core": "5.0.0-alpha.26", - "@material-ui/data-grid": "^4.0.0-alpha.18", + "@material-ui/data-grid": "^4.0.0-alpha.21", "@material-ui/docs": "5.0.0-alpha.26", "@material-ui/icons": "5.0.0-alpha.26", "@material-ui/lab": "5.0.0-alpha.26", @@ -48,7 +48,6 @@ "@types/react-dom": "^17.0.0", "@types/react-router-dom": "^5.1.0", "@types/react-swipeable-views": "^0.13.0", - "@types/react-swipeable-views-utils": "^0.13.0", "@types/react-text-mask": "^5.4.6", "@types/react-virtualized": "^9.21.4", "@types/react-window": "^1.7.0", @@ -103,7 +102,7 @@ "react-router": "^5.0.0", "react-router-dom": "^5.0.1", "react-spring": "^8.0.27", - "react-swipeable-views": "^0.13.9", + "react-swipeable-views": "^0.14.0-alpha.0", "react-text-mask": "^5.0.2", "react-transition-group": "^4.4.1", "react-virtualized": "^9.21.1", diff --git a/package.json b/package.json index df075e17b1f610..bd11a0c9c0a19d 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "test:coverage:html": "cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=html mocha 'packages/**/*.test.{js,ts,tsx}' 'docs/**/*.test.{js,ts,tsx}' 'scripts/**/*.test.{js,ts,tsx}' 'test/utils/**/*.test.{js,ts,tsx}'", "test:karma": "cross-env NODE_ENV=test karma start test/karma.conf.js", "test:karma:profile": "cross-env NODE_ENV=test karma start test/karma.conf.profile.js", - "test:regressions": "cross-env NODE_ENV=production yarn test:regressions:build && concurrently --success first --kill-others \"yarn test:regressions:run\" \"yarn test:regressions:server\"", + "test:regressions": "yarn test:regressions:build && concurrently --success first --kill-others \"yarn test:regressions:run\" \"yarn test:regressions:server\"", "test:regressions:build": "webpack --config test/regressions/webpack.config.js", "test:regressions:dev": "concurrently \"yarn test:regressions:build --watch\" \"yarn test:regressions:server\"", "test:regressions:run": "mocha --config test/regressions/.mocharc.js --delay 'test/regressions/**/*.test.js'", diff --git a/test/regressions/index.js b/test/regressions/index.js index 4efa7c9ec4fb71..4afb7c68605f03 100644 --- a/test/regressions/index.js +++ b/test/regressions/index.js @@ -70,7 +70,7 @@ const blacklist = [ 'docs-components-material-icons/synonyms.png', // No component 'docs-components-menus', // Need interaction 'docs-components-modal/KeepMountedModal.png', // Needs interaction - 'docs-components-modal/SimpleModal.png', // Needs interaction + 'docs-components-modal/BasicModal.png', // Needs interaction 'docs-components-modal/SpringModal.png', // Needs interaction 'docs-components-modal/TransitionsModal.png', // Needs interaction 'docs-components-no-ssr/FrameDeferring.png', // Needs interaction @@ -104,11 +104,11 @@ const blacklist = [ 'docs-components-snackbars/SimpleSnackbar.png', // Needs interaction 'docs-components-snackbars/TransitionsSnackbar.png', // Needs interaction 'docs-components-speed-dial', // Needs interaction - 'docs-components-steppers/HorizontalNonLinearAlternativeLabelStepper.png', // Redundant 'docs-components-steppers/HorizontalNonLinearStepper.png', // Redundant 'docs-components-steppers/SwipeableTextMobileStepper.png', // Flaky image loading 'docs-components-steppers/TextMobileStepper.png', // Flaky image loading - 'docs-components-tabs/AccessibleTabs.png', // Need interaction + 'docs-components-tabs/AccessibleTabs1.png', // Need interaction + 'docs-components-tabs/AccessibleTabs2.png', // Need interaction 'docs-components-textarea-autosize', // Superseded by a dedicated regression test 'docs-components-time-picker/LocalizedTimePicker.png', // Redundant 'docs-components-time-picker/ResponsiveTimePickers.png', // Redundant diff --git a/test/regressions/index.test.js b/test/regressions/index.test.js index 9be05435995d70..63ec627a06bf92 100644 --- a/test/regressions/index.test.js +++ b/test/regressions/index.test.js @@ -2,6 +2,8 @@ import * as fse from 'fs-extra'; import * as path from 'path'; import * as playwright from 'playwright'; +const ERROR_THRESHOLD = 2; + async function main() { const baseUrl = 'http://localhost:5000'; const screenshotDir = path.resolve(__dirname, './screenshots/chrome'); @@ -26,6 +28,16 @@ async function main() { } }); + let errorConsole; + let errorConsoleCounter = 0; + + page.on('console', async (msg) => { + console.log('console', msg) + if (msg.args().length > 0 && (msg.type() === 'error' || msg.type() === 'warning')) { + errorConsole = Promise.all(msg.args().map((x) => x.jsonValue())); + } + }); + // Wait for all requests to finish. // This should load shared ressources such as fonts. await page.goto(`${baseUrl}#no-dev`, { waitUntil: 'networkidle0' }); @@ -51,21 +63,15 @@ async function main() { // prepare screenshots await fse.emptyDir(screenshotDir); - let errorMessage; - - page.on('console', async (msg) => { - if (msg.args().length > 0 && (msg.type() === 'error' || msg.type() === 'warning')) { - errorMessage = Promise.all(msg.args().map((x) => x.jsonValue())); - } - }); - describe('visual regressions', () => { after(async () => { await browser.close(); }); routes.forEach((route, index) => { - it(`creates screenshots of ${route.replace(baseUrl, '')}`, async () => { + const pathURL = route.replace(baseUrl, ''); + + it(`creates screenshots of ${pathURL}`, async () => { // Use client-side routing which is much faster than full page navigation via page.goto(). // Could become an issue with test isolation. // If tests are flaky due to global pollution switch to page.goto(route); @@ -86,15 +92,32 @@ async function main() { // Testcase.screenshot would resize the viewport to the element bbox. await page.screenshot({ clip, path: screenshotPath, type: 'png' }); - if (errorMessage) { - const msg = await errorMessage; - errorMessage = undefined; - console.warn(msg); + if (errorConsole) { + const msg = await errorConsole; + errorConsole = undefined; + // eslint-disable-next-line no-console + console.log(`⚠️ Error logged in the console in ${pathURL}:\n`); + // eslint-disable-next-line no-console + console.log(msg.join('\n')); + errorConsoleCounter += 1; } }); }); }); + describe('no console errors', () => { + it(`should have fewer than ${ERROR_THRESHOLD} console errors`, () => { + if (errorConsoleCounter > 0) { + // eslint-disable-next-line no-console + console.log(`${errorConsoleCounter} errors have been logged in the console.`); + } + + if (errorConsoleCounter > ERROR_THRESHOLD) { + throw new Error(`More than ${ERROR_THRESHOLD} errors have been logged in the console.`); + } + }); + }); + run(); } diff --git a/test/regressions/tests/Select/SelectMissingValue.js b/test/regressions/tests/Select/SelectMissingValue.js index 85da9e9b2b118e..0c392eed74b332 100644 --- a/test/regressions/tests/Select/SelectMissingValue.js +++ b/test/regressions/tests/Select/SelectMissingValue.js @@ -5,6 +5,7 @@ import Select from '@material-ui/core/Select'; export default function SelectMissingValue() { return ( ); diff --git a/yarn.lock b/yarn.lock index 2b63a7641a472a..0873c828720ec2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2200,16 +2200,16 @@ npmlog "^4.1.2" write-file-atomic "^2.3.0" -"@material-ui/data-grid@^4.0.0-alpha.18": - version "4.0.0-alpha.20" - resolved "https://registry.yarnpkg.com/@material-ui/data-grid/-/data-grid-4.0.0-alpha.20.tgz#5fe8df438f5a9718636dc3bfaf268267cc87f17e" - integrity sha512-YqTTGs61zf3kT/5LuWWxwfTWwjXXJfP8nR7JiX30cMQXlOeIihQXHqbRrm7IHQRVWYQ5YxI95QLWtLHBIm2h0w== +"@material-ui/data-grid@^4.0.0-alpha.21": + version "4.0.0-alpha.21" + resolved "https://registry.yarnpkg.com/@material-ui/data-grid/-/data-grid-4.0.0-alpha.21.tgz#f70d542e1edd6d66135326e2107d48e0f2fa484d" + integrity sha512-ifv/SuqZxhcEKVLxspm9hZkzINUt71PKspEB1Wk9Mh+BKLqfNODtJZE8iu9cIfAwt2jHxUpM2Ut5ntQ4ITUSpA== dependencies: "@material-ui/utils" "^5.0.0-alpha.14" prop-types "^15.7.2" reselect "^4.0.0" -"@material-ui/types@^4.0.0", "@material-ui/types@^4.1.1": +"@material-ui/types@^4.1.1": version "4.1.1" resolved "https://registry.yarnpkg.com/@material-ui/types/-/types-4.1.1.tgz#b65e002d926089970a3271213a3ad7a21b17f02b" integrity sha512-AN+GZNXytX9yxGi0JOfxHrRTbhFybjUJ05rnsBVjcB+16e466Z0Xe5IxawuOayVZgTBNDxmPKo5j4V6OnMtaSQ== @@ -3135,16 +3135,7 @@ "@types/history" "*" "@types/react" "*" -"@types/react-swipeable-views-utils@^0.13.0": - version "0.13.2" - resolved "https://registry.yarnpkg.com/@types/react-swipeable-views-utils/-/react-swipeable-views-utils-0.13.2.tgz#74c247ab62665d0a5b4f3c30dea7e3d82d5fdc7d" - integrity sha512-/EdlhYN7K62XS853ULfLS9adOFtdDVjo7a56U2/Knc233HR+cOoKQHn/qv3APFxQjuOWnF1bc7Kwx3LlEv4PlQ== - dependencies: - "@material-ui/types" "^4.0.0" - "@types/react" "*" - "@types/react-swipeable-views" "*" - -"@types/react-swipeable-views@*", "@types/react-swipeable-views@^0.13.0": +"@types/react-swipeable-views@^0.13.0": version "0.13.0" resolved "https://registry.yarnpkg.com/@types/react-swipeable-views/-/react-swipeable-views-0.13.0.tgz#9e5f2efa51380886f3f73014ac8b15546d337210" integrity sha512-orrreCcXev6IUXDuHf07RDDCAoIZRMSr95eyWmYNRfjic7w/O+68iPu0NCysVls+UygRNvoqZMuXI72N/58E1w== @@ -13529,35 +13520,35 @@ react-spring@^8.0.27: "@babel/runtime" "^7.3.1" prop-types "^15.5.8" -react-swipeable-views-core@^0.13.7: - version "0.13.7" - resolved "https://registry.yarnpkg.com/react-swipeable-views-core/-/react-swipeable-views-core-0.13.7.tgz#c082b553f26e83fd20fc17f934200eb717023c8a" - integrity sha512-ekn9oDYfBt0oqJSGGwLEhKvn+QaqMGTy//9dURTLf+vp7W5j6GvmKryYdnwJCDITaPFI2hujXV4CH9krhvaE5w== +react-swipeable-views-core@^0.14.0-alpha.0: + version "0.14.0-alpha.0" + resolved "https://registry.yarnpkg.com/react-swipeable-views-core/-/react-swipeable-views-core-0.14.0-alpha.0.tgz#1c40dd1c328c97048a8f2cb9de504ee611ae21dd" + integrity sha512-TQm58RJv01EseBfaeY0kZUIBmhs1NyKXwhJL52iN/UlzbQSiaIE2kk+mSGicUriBK0H7UlScgLeJR91AJ7SVcA== dependencies: "@babel/runtime" "7.0.0" warning "^4.0.1" -react-swipeable-views-utils@^0.13.9: - version "0.13.9" - resolved "https://registry.yarnpkg.com/react-swipeable-views-utils/-/react-swipeable-views-utils-0.13.9.tgz#a66e98f2f4502d8b00182901f80d13b2f903e10f" - integrity sha512-QLGxRKrbJCbWz94vkWLzb1Daaa2Y/TZKmsNKQ6WSNrS+chrlfZ3z9tqZ7YUJlW6pRWp3QZdLSY3UE3cN0TXXmw== +react-swipeable-views-utils@^0.14.0-alpha.0: + version "0.14.0-alpha.0" + resolved "https://registry.yarnpkg.com/react-swipeable-views-utils/-/react-swipeable-views-utils-0.14.0-alpha.0.tgz#1bc91cf89d13417a0ca8edc11b4a2c55c4a889b9" + integrity sha512-Ya9Xtr4uE1CYxyrPwtcImzcZFcOr3PP51kRgIOTx3Dx9SF31OtF0t2CgXuypTYTs7G4StRE3NzWlvSBiMZSVtQ== dependencies: "@babel/runtime" "7.0.0" keycode "^2.1.7" prop-types "^15.6.0" react-event-listener "^0.6.0" - react-swipeable-views-core "^0.13.7" + react-swipeable-views-core "^0.14.0-alpha.0" shallow-equal "^1.2.1" -react-swipeable-views@^0.13.9: - version "0.13.9" - resolved "https://registry.yarnpkg.com/react-swipeable-views/-/react-swipeable-views-0.13.9.tgz#d6a6c508bf5288ad55509f9c65916db5df0f2cec" - integrity sha512-WXC2FKYvZ9QdJ31v9LjEJEl1bA7E4AcaloTkbW0uU0dYf5uvv4aOpiyxubvOkVl1a5L2UAHmKSif4TmJ9usrSg== +react-swipeable-views@^0.14.0-alpha.0: + version "0.14.0-alpha.0" + resolved "https://registry.yarnpkg.com/react-swipeable-views/-/react-swipeable-views-0.14.0-alpha.0.tgz#53cd109edf612b3121cc7d18cea41ae1af238d34" + integrity sha512-DIw4ig/QtDIbBPBa+15Dski51tp/JPXIbqm9c9hlO32eWzUmMXLXFo+DnieTt1n+KJXrSrduHYWcR48LMP3Tbg== dependencies: "@babel/runtime" "7.0.0" prop-types "^15.5.4" - react-swipeable-views-core "^0.13.7" - react-swipeable-views-utils "^0.13.9" + react-swipeable-views-core "^0.14.0-alpha.0" + react-swipeable-views-utils "^0.14.0-alpha.0" warning "^4.0.1" react-test-renderer@^16.0.0-0, react-test-renderer@^16.14.0: