fix(接口测试): 修复用例频繁执行socket连接问题
--bug=1012793 --user=赵勇 【接口测试】接口定义-接口case中query参数值是json文件-执行多次卡住 https://www.tapd.cn/55049933/s/1150087
This commit is contained in:
parent
aca4456755
commit
321b5fe422
|
@ -511,7 +511,6 @@ export default {
|
|||
isTop: false,
|
||||
stepSize: 0,
|
||||
message: "",
|
||||
websocket: {},
|
||||
messageWebSocket: {},
|
||||
buttonData: [],
|
||||
stepFilter: new STEP,
|
||||
|
@ -559,9 +558,10 @@ export default {
|
|||
},
|
||||
],
|
||||
reloadTree: "",
|
||||
newCreateTime:0,
|
||||
oldCreateTime:0,
|
||||
oldUserName:''
|
||||
newCreateTime: 0,
|
||||
oldCreateTime: 0,
|
||||
oldUserName: '',
|
||||
debugReportId: ""
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -816,9 +816,6 @@ export default {
|
|||
if (this.messageWebSocket) {
|
||||
this.messageWebSocket.close();
|
||||
}
|
||||
if (this.websocket) {
|
||||
this.websocket.close();
|
||||
}
|
||||
this.clearNodeStatus(this.$refs.stepTree.root.childNodes);
|
||||
this.clearDebug();
|
||||
this.$success(this.$t('report.test_stop_success'));
|
||||
|
@ -902,8 +899,11 @@ export default {
|
|||
}
|
||||
},
|
||||
initMessageSocket() {
|
||||
this.messageWebSocket = getReportMessageSocket(this.reportId);
|
||||
this.debugReportId = getUUID().substring(0, 8);
|
||||
this.messageWebSocket = getReportMessageSocket(this.debugReportId);
|
||||
this.messageWebSocket.onmessage = this.onDebugMessage;
|
||||
// 开始执行
|
||||
this.messageWebSocket.onopen = this.run();
|
||||
},
|
||||
runningEditParent(node) {
|
||||
if (node.parent && node.parent.data && node.parent.data.id) {
|
||||
|
@ -1361,6 +1361,9 @@ export default {
|
|||
this.$store.state.forceRerenderIndex = getUUID();
|
||||
});
|
||||
},
|
||||
run() {
|
||||
this.reportId = this.debugReportId;
|
||||
},
|
||||
runDebug(runScenario) {
|
||||
if (this.scenarioDefinition.length < 1) {
|
||||
return;
|
||||
|
@ -1412,9 +1415,10 @@ export default {
|
|||
} else {
|
||||
this.debugLoading = true;
|
||||
}
|
||||
this.reportId = getUUID().substring(0, 8);
|
||||
this.debug = true;
|
||||
this.pluginDelStep = false;
|
||||
// 建立消息链接
|
||||
this.initMessageSocket();
|
||||
} else {
|
||||
this.clearMessage = getUUID().substring(0, 8);
|
||||
}
|
||||
|
@ -1733,8 +1737,6 @@ export default {
|
|||
if (!this.debug) {
|
||||
this.debugVisible = true;
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.initMessageSocket();
|
||||
}
|
||||
},
|
||||
errorRefresh(error) {
|
||||
|
|
|
@ -34,9 +34,9 @@ export default {
|
|||
},
|
||||
|
||||
watch: {
|
||||
// 初始化
|
||||
reportId() {
|
||||
this.run()
|
||||
// 开启链接
|
||||
this.socketSyncResult();
|
||||
},
|
||||
isStop() {
|
||||
if (!this.isStop && this.websocket && this.websocket.close instanceof Function) {
|
||||
|
@ -53,6 +53,8 @@ export default {
|
|||
const uri = protocol + window.location.host + "/ws/" + this.reportId;
|
||||
this.websocket = new WebSocket(uri);
|
||||
this.websocket.onmessage = this.onMessages;
|
||||
// 开始执行
|
||||
this.websocket.onopen = this.run();
|
||||
},
|
||||
onMessages(e) {
|
||||
if (e.data && e.data.startsWith("result_")) {
|
||||
|
@ -127,7 +129,6 @@ export default {
|
|||
if (!this.debug) {
|
||||
reqObj.syncResult = true;
|
||||
}
|
||||
this.socketSyncResult();
|
||||
this.$fileUpload(url, null, bodyFiles, reqObj, response => {
|
||||
this.requestResult = response.data;
|
||||
this.$emit('autoCheckStatus'); // 执行结束后,自动更新计划状态
|
||||
|
|
Loading…
Reference in New Issue