fix(接口测试): 修复插件被删除后操作场景步骤提示问题
--bug=1008130 --user=赵勇 【接口测试】场景没有插件执行报错 https://www.tapd.cn/55049933/s/1093571
This commit is contained in:
parent
e143237ca0
commit
21a2240cca
|
@ -348,13 +348,13 @@
|
||||||
<scenario-diff
|
<scenario-diff
|
||||||
:old-data="currentScenario"
|
:old-data="currentScenario"
|
||||||
:new-data="newData"
|
:new-data="newData"
|
||||||
:custom-num = "customNum"
|
:custom-num="customNum"
|
||||||
:module-options="moduleOptions"
|
:module-options="moduleOptions"
|
||||||
:old-scenario-definition="scenarioDefinition"
|
:old-scenario-definition="scenarioDefinition"
|
||||||
:new-scenario-definition="newScenarioDefinition"
|
:new-scenario-definition="newScenarioDefinition"
|
||||||
:project-env-map = "projectEnvMap"
|
:project-env-map="projectEnvMap"
|
||||||
:new-project-env-map="newProjectEnvMap"
|
:new-project-env-map="newProjectEnvMap"
|
||||||
:type ="type"
|
:type="type"
|
||||||
></scenario-diff>
|
></scenario-diff>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
@ -511,10 +511,11 @@ export default {
|
||||||
environmentType: ENV_TYPE.JSON,
|
environmentType: ENV_TYPE.JSON,
|
||||||
executeType: "",
|
executeType: "",
|
||||||
versionData: [],
|
versionData: [],
|
||||||
newData:[],
|
newData: [],
|
||||||
dialogVisible:false,
|
dialogVisible: false,
|
||||||
newScenarioDefinition:[],
|
newScenarioDefinition: [],
|
||||||
currentItem: {},
|
currentItem: {},
|
||||||
|
pluginDelStep: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -692,6 +693,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) {
|
||||||
|
@ -863,6 +865,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) {
|
||||||
|
@ -891,10 +898,21 @@ export default {
|
||||||
};
|
};
|
||||||
this.reportId = getUUID().substring(0, 8);
|
this.reportId = getUUID().substring(0, 8);
|
||||||
this.debugLoading = false;
|
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() {
|
openHis() {
|
||||||
this.$refs.changeHistory.open(this.currentScenario.id, ["接口自动化", "Api automation", "接口自動化"]);
|
this.$refs.changeHistory.open(this.currentScenario.id, ["接口自动化", "Api automation", "接口自動化"]);
|
||||||
},
|
},
|
||||||
|
@ -1206,6 +1224,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();
|
||||||
|
@ -1249,6 +1272,7 @@ export default {
|
||||||
}
|
}
|
||||||
this.reportId = getUUID().substring(0, 8);
|
this.reportId = getUUID().substring(0, 8);
|
||||||
this.debug = true;
|
this.debug = true;
|
||||||
|
this.pluginDelStep = false;
|
||||||
} else {
|
} else {
|
||||||
this.clearMessage = getUUID().substring(0, 8);
|
this.clearMessage = getUUID().substring(0, 8);
|
||||||
}
|
}
|
||||||
|
@ -1328,6 +1352,11 @@ export default {
|
||||||
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) => {
|
||||||
|
@ -1352,6 +1381,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();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1710,33 +1740,33 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
compare(row) {
|
compare(row) {
|
||||||
this.$get('/api/automation/get/' + row.id+"/"+this.currentScenario.refId, response => {
|
this.$get('/api/automation/get/' + row.id + "/" + this.currentScenario.refId, response => {
|
||||||
this.$get("/api/automation/getApiScenario/" + response.data.id, res => {
|
this.$get("/api/automation/getApiScenario/" + response.data.id, res => {
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
if(res.data.scenarioDefinition != null){
|
if (res.data.scenarioDefinition != null) {
|
||||||
let obj = JSON.parse(res.data.scenarioDefinition);
|
let obj = JSON.parse(res.data.scenarioDefinition);
|
||||||
if(obj){
|
if (obj) {
|
||||||
if(obj.hashTree){
|
if (obj.hashTree) {
|
||||||
for (let i = 0; i < obj.hashTree.length; i++) {
|
for (let i = 0; i < obj.hashTree.length; i++) {
|
||||||
obj.hashTree[i].disabled = true;
|
obj.hashTree[i].disabled = true;
|
||||||
}
|
|
||||||
}
|
|
||||||
for (let i = 0; i < this.scenarioDefinition.length; i++) {
|
|
||||||
this.scenarioDefinition[i].disabled = true;
|
|
||||||
}
|
|
||||||
this.newScenarioDefinition = obj.hashTree;
|
|
||||||
if (response.data.environmentJson) {
|
|
||||||
this.newProjectEnvMap = objToStrMap(JSON.parse(response.data.environmentJson));
|
|
||||||
} else {
|
|
||||||
// 兼容历史数据
|
|
||||||
this.newProjectEnvMap.set(this.projectId, obj.environmentId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (let i = 0; i < this.scenarioDefinition.length; i++) {
|
||||||
|
this.scenarioDefinition[i].disabled = true;
|
||||||
|
}
|
||||||
|
this.newScenarioDefinition = obj.hashTree;
|
||||||
|
if (response.data.environmentJson) {
|
||||||
|
this.newProjectEnvMap = objToStrMap(JSON.parse(response.data.environmentJson));
|
||||||
|
} else {
|
||||||
|
// 兼容历史数据
|
||||||
|
this.newProjectEnvMap.set(this.projectId, obj.environmentId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.newData = res.data;
|
|
||||||
this.dialogVisible = true;
|
|
||||||
}
|
}
|
||||||
});
|
this.newData = res.data;
|
||||||
|
this.dialogVisible = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
checkout(row) {
|
checkout(row) {
|
||||||
|
|
|
@ -304,6 +304,7 @@ export default {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.request.enable = false;
|
this.request.enable = false;
|
||||||
|
this.request.plugin_del = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue