fix(接口测试): 修复场景里带事务控制器,场景报告展示不对的缺陷 (#11981)

--bug=1011663 --user=王孝刚 【接口测试】LTS 版本,场景里带事务控制器,场景报告展示不对
https://www.tapd.cn/55049933/s/1125995

Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
MeterSphere Bot 2022-03-25 18:02:16 +08:00 committed by GitHub
parent 6a16aa8dbb
commit 484c795cba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 79 deletions

View File

@ -107,7 +107,7 @@ export default {
if (item && item.requestResults) { if (item && item.requestResults) {
item.requestResults.forEach(req => { item.requestResults.forEach(req => {
req.responseResult.console = res.console; req.responseResult.console = res.console;
if("RunningDebugSampler" !== req.name){ if ("RunningDebugSampler" !== req.name && (req.id || req.subRequestResults.length > 0)) {
resMap.set(req.id + req.name, req); resMap.set(req.id + req.name, req);
req.name = item.name + "^@~@^" + req.name + "UUID=" + getUUID(); req.name = item.name + "^@~@^" + req.name + "UUID=" + getUUID();
array.push(req); array.push(req);
@ -148,17 +148,19 @@ export default {
value: item, value: item,
}; };
if (i !== nodeArray.length) { if (i !== nodeArray.length - 1) {
node.children = []; node.children = [];
} } else {
if(item.subRequestResults && item.subRequestResults.length > 0){ if (item.subRequestResults && item.subRequestResults.length > 0) {
let itemChildren = this.deepFormatTreeNode(item.subRequestResults); let itemChildren = this.deepFormatTreeNode(item.subRequestResults);
node.children = itemChildren; node.children = itemChildren;
if (node.label.indexOf("UUID=")) { if (node.label.indexOf("UUID=")) {
node.label = node.label.split("UUID=")[0]; node.label = node.label.split("UUID=")[0];
}
} }
} }
if (children.length === 0) { if (children.length === 0) {
children.push(node); children.push(node);
} }
@ -215,10 +217,11 @@ export default {
}, },
deepFormatTreeNode(array) { deepFormatTreeNode(array) {
let children = []; let returnChildren = [];
array.map((item) => { array.map((item) => {
let key = item.name; let children = [];
let nodeArray = key.split('^@~@^'); let key = item.name.split('^@~@^')[0];
let nodeArray = key.split('<->');
//1 //1
//hashTreeID //hashTreeID
let scenarioId = ""; let scenarioId = "";
@ -232,75 +235,22 @@ export default {
} }
} }
// //
for (let i = 0; i < nodeArray.length; i++) { let node = {
if (!nodeArray[i]) { label: nodeArray[0],
continue; value: item,
} children: []
let node = { };
label: nodeArray[i], if (item.subRequestResults && item.subRequestResults.length > 0) {
value: item, let itemChildren = this.deepFormatTreeNode(item.subRequestResults);
}; node.children = itemChildren;
if (i !== nodeArray.length) {
node.children = [];
}
if(item.subRequestResults && item.subRequestResults.length > 0){
let itemChildren = this.deepFormatTreeNode(item.subRequestResults);
node.children = itemChildren;
}
if (children.length === 0) {
children.push(node);
}
let isExist = false;
for (let j in children) {
if (children[j].label === node.label) {
let idIsPath = true;
//ID
//
if (i === nodeArray.length - 2) {
idIsPath = false;
let childId = "";
let childName = "";
if (children[j].value && children[j].value.scenario) {
let scenarioArr = JSON.parse(children[j].value.scenario);
if (scenarioArr.length > 1) {
let childArr = scenarioArr[0].split("_");
childId = childArr[0];
if (childArr.length > 1) {
childName = childArr[1];
}
}
}
if (scenarioId === "") {
idIsPath = true;
} else if (scenarioId === childId) {
idIsPath = true;
} else if (scenarioName !== childName) {
//ID
idIsPath = true;
}
}
if (idIsPath) {
if (i !== nodeArray.length - 1 && !children[j].children) {
children[j].children = [];
}
children = (i === nodeArray.length - 1 ? children : children[j].children);
isExist = true;
break;
}
}
}
if (!isExist) {
children.push(node);
if (i !== nodeArray.length - 1 && !children[children.length - 1].children) {
children[children.length - 1].children = [];
}
children = (i === nodeArray.length - 1 ? children : children[children.length - 1].children);
}
} }
children.push(node);
children.forEach(itemNode => {
returnChildren.push(itemNode);
});
}); });
return children; return returnChildren;
}, },
recursiveSorting(arr) { recursiveSorting(arr) {
for (let i in arr) { for (let i in arr) {

View File

@ -29,7 +29,7 @@
name: "MsTableHeaderSelectPopover", name: "MsTableHeaderSelectPopover",
// props: ['total', 'pageSize', 'selectDataCounts'], // props: ['total', 'pageSize', 'selectDataCounts'],
props: { props: {
selectType: String, selectType: Boolean,
total: { total: {
type: Number, type: Number,
default() { default() {