diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index f8912b8299b91b471ccf9641dedeb6970bd9f1e7..f22526bf75ed6fb7b24dd9692164220a09579c45 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -107,7 +107,7 @@ Then, open the test cases under `~/workspace/echarts/test` in Web browser. You c ```bash # puppeteer is not in the devDependencies and needs to be installed manually -npm install puppeteer +npm install puppeteer --no-save npm run test:visual ``` diff --git a/test/lib/config.js b/test/lib/config.js index 5409c4ad2afffaf3a9c34046a64085be93b36921..9b04aa0c4442ce4d4cce8a147eb8fb32ed4c410f 100644 --- a/test/lib/config.js +++ b/test/lib/config.js @@ -25,22 +25,32 @@ // `true` by default for debugging. sourceMap == null && (sourceMap = true); + var params = {}; + location.search.slice(1).split('&').forEach(item => { + var kv = item.split('='); + params[kv[0]] = kv[1]; + }); // Set default renderer in dev mode from hash. - var matchResult = location.href.match(/[?&]__RENDERER__=(canvas|svg)(&|$)/); - if (matchResult) { - window.__ECHARTS__DEFAULT__RENDERER__ = matchResult[1]; + if (params.__RENDERER__) { + window.__ECHARTS__DEFAULT__RENDERER__ = params.__RENDERER__; } // Set echarts source code. - var matchResult = location.href.match(/[?&]__ECDIST__=(webpack-req-ec|webpack-req-eclibec|webpackold-req-ec|webpackold-req-eclibec)(&|$)/); - var ecDistPath = 'dist/echarts'; - if (matchResult) { + var ecDistPath; + if (params.__ECDIST__) { ecDistPath = ({ 'webpack-req-ec': '../echarts-boilerplate/echarts-webpack/dist/webpack-req-ec', 'webpack-req-eclibec': '../echarts-boilerplate/echarts-webpack/dist/webpack-req-eclibec', 'webpackold-req-ec': '../echarts-boilerplate/echarts-webpackold/dist/webpackold-req-ec', 'webpackold-req-eclibec': '../echarts-boilerplate/echarts-webpackold/dist/webpackold-req-eclibec', - })[matchResult[1]]; + })[params.__ECDIST__]; + if (!ecDistPath && params.__ECDIST__.match(/[0-9.]/)) { + // Version number + ecDistPath = 'test/runTest/tmp/__version__/' + params.__ECDIST__ + '/echarts'; + } + } + if (!ecDistPath) { + ecDistPath = 'dist/echarts'; } if (typeof require !== 'undefined') { diff --git a/test/runTest/blacklist.js b/test/runTest/blacklist.js index a405b0b5a49ce71ac3ccf99b9568f1d5f5efc4e1..86da51abccabe8cc8a057bb0789bb2851342c401 100644 --- a/test/runTest/blacklist.js +++ b/test/runTest/blacklist.js @@ -31,6 +31,9 @@ module.exports.blacklist = [ 'scatter-gps.html', 'webkit-dep.html', + // Image size not match + 'symbol2.html', + // This case will have timeout 'visualMap-performance1.html', 'lines-bus.html', diff --git a/test/runTest/cli.js b/test/runTest/cli.js index d027e0c168047084910ca0623ee11f6c8f6c3ba5..a0940d4914effdd6092dcab3defd368c62a67447 100644 --- a/test/runTest/cli.js +++ b/test/runTest/cli.js @@ -162,7 +162,7 @@ async function runTestPage(browser, testOpt, version, runtimeCode, isExpected) { timeout: 10000 }); - await waitTime(200); // Wait for animation or something else. Pending + await waitTime(500); // Wait for animation or something else. Pending // Final shot. await page.mouse.move(0, 0); let desc = 'Full Shot'; diff --git a/test/runTest/client/client.css b/test/runTest/client/client.css index 1dc5484820832668e0ff7318cd086a0a414136e8..8a2c5984cfcc7f1411fbd6225407f99b982181f2 100644 --- a/test/runTest/client/client.css +++ b/test/runTest/client/client.css @@ -170,6 +170,14 @@ margin-top: 60px; } +.test-screenshots .preview { + cursor: pointer; + color: #409eff; +} +.test-screenshots .preview:hover { + text-decoration: underline; +} + .test-screenshots img { /* height: 200px; */ width: 100%; @@ -196,6 +204,11 @@ color: #f56c6c } +iframe { + border: none; + overflow: overlay; +} + ::-webkit-scrollbar { height: 8px; diff --git a/test/runTest/client/client.js b/test/runTest/client/client.js index 9ad2d3976f1f2404f14fd66257132a8f0d28f028..d57457430f3d613a3c94b40d45b96a7de7c22c4a 100644 --- a/test/runTest/client/client.js +++ b/test/runTest/client/client.js @@ -70,6 +70,10 @@ const app = new Vue({ versions: [], + showIframeDialog: false, + previewIframeSrc: '', + previewTitle: '', + runConfig: { noHeadless: false, replaySpeed: 5, @@ -207,6 +211,25 @@ const app = new Vue({ stopTests() { this.running = false; socket.emit('stop'); + }, + + preview(test, version) { + let searches = []; + + let ecVersion = test[version + 'Version']; + if (ecVersion !== 'local') { + searches.push('__ECDIST__=' + ecVersion); + } + if (test.useSVG) { + searches.push('__RENDERER__=svg'); + } + let src = test.fileUrl; + if (searches.length) { + src = src + '?' + searches.join('&'); + } + this.previewIframeSrc = `../../${src}`; + this.previewTitle = src; + this.showIframeDialog = true; } } }); diff --git a/test/runTest/client/index.html b/test/runTest/client/index.html index 51573fc16a66916760e18ca3fc2a64b3000369cd..2d94b979c4ba2b46171f9d59c3a0d272f4c7df9c 100644 --- a/test/runTest/client/index.html +++ b/test/runTest/client/index.html @@ -175,8 +175,9 @@ under the License.
Expected - {{currentTest.expectedVersion || ''}} +
- +
@@ -184,8 +185,9 @@ under the License.
Actual - {{currentTest.actualVersion || ''}} +
- +
@@ -194,7 +196,7 @@ under the License.
Diff - {{result.diffRatio.toFixed(4)}}
- + @@ -203,19 +205,11 @@ under the License.
- - +
{{error}}
- - +
{{error}}
@@ -224,28 +218,29 @@ under the License.
- - +
{{log}}
- +
{{log}}
+
-
- + +
+ {{previewTitle}} + Open in New Window
-
+ + diff --git a/test/runTest/server.js b/test/runTest/server.js index 554f591de89127799453d797de13e604bea931ef..565cb2195e5cf769ed214bca263d5e052ac87c28 100644 --- a/test/runTest/server.js +++ b/test/runTest/server.js @@ -184,7 +184,7 @@ function checkPuppeteer() { async function start() { if (!checkPuppeteer()) { // TODO Check version. - console.error(`Can't find puppeteer >= 1.19.0, use 'npm install puppeteer' to install or update`); + console.error(`Can't find puppeteer >= 1.19.0, use 'npm install puppeteer --no-save' to install or update`); return; }