fix(接口测试): 修复多次点击调试执行结果重复问题

--bug=1013414 --user=赵勇 [接口测试]github #13851快速点击多次接口自动化调试,自定义请求会产生循环 https://www.tapd.cn/55049933/s/1163618
This commit is contained in:
fit2-zhao 2022-05-25 11:45:52 +08:00 committed by f2c-ci-robot[bot]
parent 195471b807
commit b3c092cfb6
2 changed files with 16 additions and 8 deletions

View File

@ -21,6 +21,7 @@ import io.metersphere.notice.annotation.SendNotice;
import io.metersphere.task.service.TaskService;
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
import io.metersphere.track.request.testplan.FileOperationRequest;
import io.metersphere.websocket.c.to.c.WebSocketUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@ -332,6 +333,8 @@ public class ApiAutomationController {
taskRequest.setReportId(reportId);
taskRequest.setType("SCENARIO");
reportIds.add(taskRequest);
WebSocketUtils.onClose(reportId);
taskService.stop(reportIds);
}
}

View File

@ -516,7 +516,6 @@ export default {
buttonData: [],
stepFilter: new STEP,
plugins: [],
clearMessage: "",
runScenario: undefined,
showFollow: false,
envGroupId: "",
@ -815,10 +814,9 @@ export default {
},
stop() {
if (this.reportId) {
this.debugLoading = false;
try {
if (this.messageWebSocket) {
this.messageWebSocket.close();
this.messageWebSocket.close();
}
this.clearNodeStatus(this.$refs.stepTree.root.childNodes);
this.clearDebug();
@ -830,6 +828,9 @@ export default {
// jmeter
let url = "/api/automation/stop/" + this.reportId;
this.$get(url, response => {
this.debugLoading = false;
},error =>{
this.debugLoading = false;
});
}
},
@ -1413,13 +1414,19 @@ export default {
this.reportId = this.debugReportId;
},
runDebug(runScenario) {
if(this.debugLoading){
return;
}
this.debugLoading = true;
if (this.scenarioDefinition.length < 1) {
this.debugLoading = false;
return;
}
this.stopDebug = "";
this.clearDebug();
this.validatePluginData(this.scenarioDefinition);
if (this.pluginDelStep) {
this.debugLoading = false;
this.$error("场景包含插件步骤,对应场景已经删除不能调试!");
return;
}
@ -1435,8 +1442,7 @@ export default {
await this.$refs.envPopover.initEnv();
const sign = await this.$refs.envPopover.checkEnv(this.isFullUrl);
if (!sign) {
this.buttonIsLoading = false;
this.clearMessage = getUUID().substring(0, 8);
this.debugLoading = false;
return;
}
let scenario = undefined;
@ -1467,8 +1473,8 @@ export default {
this.pluginDelStep = false;
//
this.initMessageSocket();
} else {
this.clearMessage = getUUID().substring(0, 8);
}else{
this.debugLoading = false;
}
})
},
@ -1810,7 +1816,6 @@ export default {
this.loading = false;
this.runScenario = undefined;
this.message = "stop";
this.clearMessage = getUUID().substring(0, 8);
this.debugData = {};
},
showScenarioParameters() {