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

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

View File

@ -468,6 +468,7 @@ export default {
envGroupId: "", envGroupId: "",
environmentType: ENV_TYPE.JSON, environmentType: ENV_TYPE.JSON,
executeType: "", executeType: "",
pluginDelStep: false
} }
}, },
watch: { watch: {
@ -641,6 +642,7 @@ export default {
this.reqTotal = 0; this.reqTotal = 0;
this.reqSuccess = 0; this.reqSuccess = 0;
this.executeType = ""; this.executeType = "";
this.pluginDelStep = false;
}, },
clearResult(arr) { clearResult(arr) {
if (arr) { if (arr) {
@ -795,6 +797,11 @@ export default {
this.debug = false; this.debug = false;
this.saved = true; this.saved = true;
this.executeType = "Saved"; this.executeType = "Saved";
this.validatePluginData(this.scenarioDefinition);
if (this.pluginDelStep) {
this.$error("场景包含插件步骤,对应场景已经删除不能执行!");
return;
}
/*触发执行操作*/ /*触发执行操作*/
this.$refs['currentScenario'].validate(async (valid) => { this.$refs['currentScenario'].validate(async (valid) => {
if (valid) { if (valid) {
@ -823,6 +830,7 @@ export default {
}; };
this.reportId = getUUID().substring(0, 8); this.reportId = getUUID().substring(0, 8);
this.debugLoading = false; this.debugLoading = false;
this.pluginDelStep = false;
}) })
} }
}) })
@ -1138,6 +1146,11 @@ export default {
} }
this.stopDebug = ""; this.stopDebug = "";
this.clearDebug(); this.clearDebug();
this.validatePluginData(this.scenarioDefinition);
if (this.pluginDelStep) {
this.$error("场景包含插件步骤,对应场景已经删除不能调试!");
return;
}
this.clearResult(this.scenarioDefinition); this.clearResult(this.scenarioDefinition);
this.clearNodeStatus(this.$refs.stepTree.root.childNodes); this.clearNodeStatus(this.$refs.stepTree.root.childNodes);
this.sort(); this.sort();
@ -1256,10 +1269,25 @@ export default {
this.expandedNode.splice(this.expandedNode.indexOf(data.resourceId), 1); this.expandedNode.splice(this.expandedNode.indexOf(data.resourceId), 1);
} }
}, },
validatePluginData(steps) {
steps.forEach(step => {
if (step.plugin_del) {
this.pluginDelStep = true;
}
if (step.hashTree && step.hashTree.length > 0) {
this.validatePluginData(step.hashTree);
}
});
},
editScenario() { editScenario() {
if (!document.getElementById("inputDelay")) { if (!document.getElementById("inputDelay")) {
return; return;
} }
this.validatePluginData(this.scenarioDefinition);
if (this.pluginDelStep) {
this.$error("场景包含插件步骤,对应场景已经删除不能编辑!");
return;
}
return new Promise((resolve) => { return new Promise((resolve) => {
document.getElementById("inputDelay").focus(); // input document.getElementById("inputDelay").focus(); // input
this.$refs['currentScenario'].validate(async (valid) => { this.$refs['currentScenario'].validate(async (valid) => {
@ -1277,6 +1305,7 @@ export default {
this.currentScenario.tags = JSON.parse(this.currentScenario.tags); this.currentScenario.tags = JSON.parse(this.currentScenario.tags);
} }
this.$emit('refresh', this.currentScenario); this.$emit('refresh', this.currentScenario);
this.pluginDelStep = false;
resolve(); resolve();
}); });
} }

View File

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