fix(UI自动化): 修复UI报告流程控制中步骤顺序错误

--bug=1014053 --user=刘瑶 【UI测试】UI报告,循环里套循环的时候,报告显示顺序不是循环的顺序 https://www.tapd.cn/55049933/s/1183488
This commit is contained in:
nathan.liu 2022-06-16 10:51:31 +08:00 committed by f2c-ci-robot[bot]
parent a3276c7f18
commit 0fa1dd37ea
2 changed files with 49 additions and 10 deletions

View File

@ -412,8 +412,12 @@ export default {
if(data.reportType === "UI_INDEPENDENT"){
this.tempResult = report.steps;
//
this.checkOrder(this.tempResult);
this.fullTreeNodes = this.tempResult;
try{
this.checkOrder(this.tempResult);
this.fullTreeNodes = this.tempResult;
}catch(e){
this.fullTreeNodes = report.steps;
}
}else{
this.fullTreeNodes = report.steps;
}
@ -437,19 +441,54 @@ export default {
if(!origin){
return;
}
if(origin.children && Array.isArray(origin.children)){
origin.children.sort((m,n)=>{
let mTime = m.value ? m.value.startTime ? m.value.startTime : 0 : 0;
let nTime = n.value ? n.value.startTime ? n.value.startTime : 0 : 0;
return mTime <= nTime;
})
origin.children.forEach(v => {
if(Array.isArray(origin)){
this.sortChildren(origin);
origin.forEach(v => {
if(v.children){
this.checkOrder(v.children)
}
})
}
},
sortChildren(source){
if(!source){
return;
}
source.forEach( item =>{
let children = item.children;
if(children && children.length > 0){
let tempArr = new Array(children.length);
let tempMap = new Map();
for(let i = 0; i < children.length; i++){
if(!children[i].value || !children[i].value.startTime || children[i].value.startTime === 0){
//valuestep
tempArr[i] = children[i];
//
tempMap.set(children[i].stepId, children[i])
}
}
//step
let arr = children.filter(m => {
return !tempMap.get(m.stepId);
}).sort((m, n) => {
//
return m.value.startTime - n.value.startTime;
});
//arr() tempArr
for(let j = 0, i = 0; j < tempArr.length; j++){
if(!tempArr[j]){
//
tempArr[j] = arr[i];
i++;
}
//
tempArr[j].index = j + 1;
}
//
item.children = tempArr;
}
})
},
buildReport() {
if (this.report) {
if (this.isNotRunning) {

@ -1 +1 @@
Subproject commit 9a499be8ea905306f4aae866ee94a05d9f150293
Subproject commit 8e321b56d9cd47bf37db047b53cc9a76411a84af