fix(测试跟踪): 修复测试计划用例大批量执行超时问题

This commit is contained in:
fit2-zhao 2023-02-01 13:26:12 +08:00 committed by 建国
parent f73576785f
commit 5e9d29d711
1 changed files with 13 additions and 30 deletions

View File

@ -388,7 +388,6 @@ export default {
selectDataCounts: 0, selectDataCounts: 0,
screenHeight: "calc(100vh - 250px)", // screenHeight: "calc(100vh - 250px)", //
currentCaseProjectId: "", currentCaseProjectId: "",
runData: [],
testPlanCaseIds: [], testPlanCaseIds: [],
reportId: "", reportId: "",
rowLoading: "", rowLoading: "",
@ -610,7 +609,6 @@ export default {
getData() { getData() {
return new Promise((resolve) => { return new Promise((resolve) => {
let index = 1; let index = 1;
this.runData = [];
this.testPlanCaseIds = []; this.testPlanCaseIds = [];
if (this.condition != null && this.condition.selectAll) { if (this.condition != null && this.condition.selectAll) {
let selectAllRowParams = buildBatchParam(this); let selectAllRowParams = buildBatchParam(this);
@ -621,39 +619,24 @@ export default {
// //
this.orderBySelectRows(dataRows); this.orderBySelectRows(dataRows);
dataRows.forEach((row) => { dataRows.forEach((row) => {
apiTestCaseGet(row.caseId).then((response) => { this.testPlanCaseIds.push(row.id);
let apiCase = response.data; if (dataRows.length === index) {
let request = JSON.parse(apiCase.request); resolve();
request.name = row.id; }
request.id = row.id; index++;
request.useEnvironment = row.environmentId;
this.runData.unshift(request);
this.testPlanCaseIds.unshift(row.id);
if (dataRows.length === index) {
resolve();
}
index++;
});
}); });
} }
); );
} else { } else {
//
let dataRows = this.orderBySelectRows(this.$refs.table.selectRows); let dataRows = this.orderBySelectRows(this.$refs.table.selectRows);
//
this.orderBySelectRows(dataRows);
dataRows.forEach((row) => { dataRows.forEach((row) => {
apiTestCaseGet(row.caseId).then((response) => { this.testPlanCaseIds.push(row.id);
let apiCase = response.data; if (dataRows.length === index) {
let request = JSON.parse(apiCase.request); resolve();
request.name = row.id; }
request.id = row.id; index++;
request.useEnvironment = row.environmentId;
this.runData.unshift(request);
this.testPlanCaseIds.unshift(row.id);
if (dataRows.length === index) {
resolve();
}
index++;
});
}); });
} }
}); });
@ -697,7 +680,7 @@ export default {
}, },
handleBatchExecute() { handleBatchExecute() {
this.getData().then(() => { this.getData().then(() => {
if (this.runData && this.runData.length > 0) { if (this.testPlanCaseIds && this.testPlanCaseIds.length > 0) {
this.$refs.runMode.open("API"); this.$refs.runMode.open("API");
} }
}); });