fix(接口测试): 修复插件被删除后操作场景步骤提示问题

--bug=1008130 --user=赵勇 【接口测试】场景没有插件执行报错 https://www.tapd.cn/55049933/s/1093571
This commit is contained in:
fit2-zhao 2022-01-18 18:36:54 +08:00 committed by fit2-zhao
parent e143237ca0
commit 21a2240cca
2 changed files with 60 additions and 29 deletions

View File

@ -515,6 +515,7 @@ export default {
dialogVisible: false,
newScenarioDefinition: [],
currentItem: {},
pluginDelStep: false
}
},
watch: {
@ -692,6 +693,7 @@ export default {
this.reqTotal = 0;
this.reqSuccess = 0;
this.executeType = "";
this.pluginDelStep = false;
},
clearResult(arr) {
if (arr) {
@ -863,6 +865,11 @@ export default {
this.debug = false;
this.saved = true;
this.executeType = "Saved";
this.validatePluginData(this.scenarioDefinition);
if (this.pluginDelStep) {
this.$error("场景包含插件步骤,对应场景已经删除不能执行!");
return;
}
/*触发执行操作*/
this.$refs['currentScenario'].validate(async (valid) => {
if (valid) {
@ -891,10 +898,21 @@ export default {
};
this.reportId = getUUID().substring(0, 8);
this.debugLoading = false;
this.pluginDelStep = false;
})
}
})
},
validatePluginData(steps) {
steps.forEach(step => {
if (step.plugin_del) {
this.pluginDelStep = true;
}
if (step.hashTree && step.hashTree.length > 0) {
this.validatePluginData(step.hashTree);
}
});
},
openHis() {
this.$refs.changeHistory.open(this.currentScenario.id, ["接口自动化", "Api automation", "接口自動化"]);
},
@ -1206,6 +1224,11 @@ export default {
}
this.stopDebug = "";
this.clearDebug();
this.validatePluginData(this.scenarioDefinition);
if (this.pluginDelStep) {
this.$error("场景包含插件步骤,对应场景已经删除不能调试!");
return;
}
this.clearResult(this.scenarioDefinition);
this.clearNodeStatus(this.$refs.stepTree.root.childNodes);
this.sort();
@ -1249,6 +1272,7 @@ export default {
}
this.reportId = getUUID().substring(0, 8);
this.debug = true;
this.pluginDelStep = false;
} else {
this.clearMessage = getUUID().substring(0, 8);
}
@ -1328,6 +1352,11 @@ export default {
if (!document.getElementById("inputDelay")) {
return;
}
this.validatePluginData(this.scenarioDefinition);
if (this.pluginDelStep) {
this.$error("场景包含插件步骤,对应场景已经删除不能编辑!");
return;
}
return new Promise((resolve) => {
document.getElementById("inputDelay").focus(); // input
this.$refs['currentScenario'].validate(async (valid) => {
@ -1352,6 +1381,7 @@ export default {
this.currentScenario.tags = JSON.parse(this.currentScenario.tags);
}
this.$emit('refresh', this.currentScenario);
this.pluginDelStep = false;
resolve();
});
}

View File

@ -304,6 +304,7 @@ export default {
}
} else {
this.request.enable = false;
this.request.plugin_del = true;
}
});
}