You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2021/05/17 05:55:42 UTC
[echarts] 01/01: test(visual): optimize all tests runs list
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch enhance-visual-regression-test
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit d864d498aa2c7d56cc382db218b5a4eb5bbc69e0
Author: pissang <bm...@gmail.com>
AuthorDate: Mon May 17 13:54:13 2021 +0800
test(visual): optimize all tests runs list
---
test/runTest/client/client.js | 3 +++
test/runTest/client/index.html | 2 +-
test/runTest/store.js | 20 ++++++++++++++------
3 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/test/runTest/client/client.js b/test/runTest/client/client.js
index b761aca..f110fbd 100644
--- a/test/runTest/client/client.js
+++ b/test/runTest/client/client.js
@@ -124,6 +124,7 @@ const app = new Vue({
// List of all runs.
showRunsDialog: false,
testsRuns: [],
+ loadingTestsRuns: false,
pageInvisible: false,
@@ -354,6 +355,7 @@ const app = new Vue({
showAllTestsRuns() {
this.showRunsDialog = true;
+ this.loadingTestsRuns = true;
socket.emit('getAllTestsRuns');
},
@@ -474,6 +476,7 @@ socket.on('abort', res => {
socket.on('getAllTestsRuns_return', res => {
app.testsRuns = res.runs;
+ app.loadingTestsRuns = false;
});
socket.on('genTestsRunReport_return', res => {
window.open(res.reportUrl, '_blank');
diff --git a/test/runTest/client/index.html b/test/runTest/client/index.html
index 0db49ae..5e876c3 100644
--- a/test/runTest/client/index.html
+++ b/test/runTest/client/index.html
@@ -292,7 +292,7 @@ under the License.
:visible.sync="showRunsDialog"
title="All Tests Runs"
>
- <el-table :data="testsRuns">
+ <el-table :data="testsRuns" v-loading="loadingTestsRuns">
<el-table-column property="expectedVersion" label="Expected" width="160"></el-table-column>
<el-table-column property="actualVersion" label="Actual" width="160"></el-table-column>
<el-table-column property="renderer" label="Renderer" width="100"></el-table-column>
diff --git a/test/runTest/store.js b/test/runTest/store.js
index f05f3d5..5eb3e1d 100644
--- a/test/runTest/store.js
+++ b/test/runTest/store.js
@@ -203,7 +203,8 @@ module.exports.updateTestsList = async function (
};
module.exports.saveTestsList = function () {
- fse.outputFileSync(getResultFilePath(), JSON.stringify(_tests, null, 2), 'utf-8');
+ fse.ensureDirSync(getResultBaseDir());
+ fs.writeFileSync(getResultFilePath(), JSON.stringify(_tests, null, 2), 'utf-8');
};
module.exports.mergeTestsResults = function (testsResults) {
@@ -255,11 +256,18 @@ module.exports.getAllTestsRuns = async function () {
}
for (let dir of dirs) {
const params = parseRunHash(dir);
- const resultJson = JSON.parse(fs.readFileSync(path.join(
- RESULTS_ROOT_DIR,
- dir,
- RESULT_FILE_NAME
- ), 'utf-8'));
+ let resultJson = [];
+ try {
+ resultJson = JSON.parse(fs.readFileSync(path.join(
+ RESULTS_ROOT_DIR,
+ dir,
+ RESULT_FILE_NAME
+ ), 'utf-8'));
+ }
+ catch (e) {
+ console.error('Invalid result ' + dir)
+ continue;
+ }
const total = resultJson.length;
let lastRunTime = 0;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org