fix(测试跟踪): 测试计划功能用例,步骤执行结果显示错乱

--bug=1043845 --user=陈建星 【测试跟踪】github#32006,测试计划执行用例后,修改用例,步骤执行结果会错乱 https://www.tapd.cn/55049933/s/1602641
This commit is contained in:
AgAngle 2024-10-31 14:04:38 +08:00 committed by Craftsman
parent 6ebbd3da7a
commit 364f7efa4c
3 changed files with 38 additions and 15 deletions

View File

@ -452,6 +452,7 @@ export default {
nodeId: '',
steps: [
{
id: this.newStepId(),
num: 1,
desc: "",
result: "",
@ -1138,6 +1139,11 @@ export default {
},
];
}
tmp.steps.forEach(step => {
if (!step.id) {
step.id = this.newStepId();
}
});
tmp.tags = JSON.parse(tmp.tags);
Object.assign(this.form, tmp);
if (!this.form.stepModel) {
@ -1167,6 +1173,9 @@ export default {
//
this.reloadForm();
},
newStepId() {
return getUUID().substring(0, 8);
},
resetSystemField() {
if (!this.caseId) {
return;
@ -1458,6 +1467,7 @@ export default {
this.form.testName = "";
this.form.steps = [
{
id: this.newStepId(),
num: 1,
desc: "",
result: "",

View File

@ -66,7 +66,7 @@
</template>
<script>
import { resizeTextarea } from "@/business/utils/sdk-utils";
import {getUUID, resizeTextarea} from "@/business/utils/sdk-utils";
export default {
name: "CaseStepItem",
@ -119,6 +119,7 @@ export default {
},
handleAddStep(index, data) {
let step = {};
step.id = this.newStepId();
step.num = data.num + 1;
step.desc = "";
step.result = "";
@ -129,11 +130,15 @@ export default {
});
this.form.steps.splice(index + 1, 0, step);
},
newStepId() {
return getUUID().substring(0, 8);
},
handleCopyStep(index, data) {
if (this.readOnly) {
return
}
let step = {};
step.id = this.newStepId();
step.num = data.num + 1;
step.desc = data.desc;
step.result = data.result;

View File

@ -317,6 +317,7 @@ export default {
param.comment = this.testCase.comment;
for (let i = 0; i < this.testCase.steptResults.length; i++) {
let result = {};
result.id = this.testCase.steptResults[i].id;
result.actualResult = this.testCase.steptResults[i].actualResult;
result.executeResult = this.testCase.steptResults[i].executeResult;
if (result.actualResult && result.actualResult.length > 500) {
@ -433,11 +434,6 @@ export default {
this.loading = false;
let item = {};
Object.assign(item, response.data);
if (item.results) {
item.results = JSON.parse(item.results);
} else if (item.steps) {
item.results = [item.steps.length];
}
if (item.issues) {
item.issues = JSON.parse(item.issues);
} else {
@ -448,20 +444,32 @@ export default {
item.stepModel = "STEP";
}
item.steptResults = [];
if (item.results) {
item.results = JSON.parse(item.results);
} else if (item.steps) {
item.results = [item.steps.length];
}
if (item.steps) {
let resultHasId = item.results.find((r) => r.id);
for (let i = 0; i < item.steps.length; i++) {
if (item.results) {
if (item.results[i]) {
item.steps[i].actualResult = item.results[i].actualResult;
item.steps[i].executeResult = item.results[i].executeResult;
let step = item.steps[i];
if (resultHasId) {
// ID
let result = item.results.find((r) => r.id === step.id);
if (result) {
step.actualResult = result.actualResult;
step.executeResult = result.executeResult;
}
item.steptResults.push(item.steps[i]);
} else {
item.steptResults.push({
actualResult: "",
executeResult: "",
});
//
if (item.results[i]) {
step.actualResult = item.results[i].actualResult;
step.executeResult = item.results[i].executeResult;
}
}
item.steptResults.push(step);
}
}
this.testCase = item;