提交 d864d498 编写于 作者: P pissang

test(visual): optimize all tests runs list

上级 7e78f249
......@@ -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');
......
......@@ -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>
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册