refactor(接口测试): 修复场景导入JMX时后置脚本步骤顺序错乱的问题

--bug=1014065 --user=宋天阳
【接口自动化】github#14803jmeter脚本导入MeterSphere的接口自动化场景中,后置操作的顺序与jmeter中不一致会导致运行失败
https://www.tapd.cn/55049933/s/1182430
This commit is contained in:
song-tianyang 2022-06-15 13:55:56 +08:00 committed by f2c-ci-robot[bot]
parent 772cc6709d
commit 77c4ba4cf1
1 changed files with 32 additions and 35 deletions

View File

@ -756,7 +756,7 @@ export default {
if (item && map.has(item.resourceId)) {
item.domain = map.get(item.resourceId);
item.resourceId = getUUID();
}else{
} else {
item.domain = "";
}
if (item && item.hashTree && item.hashTree.length > 0) {
@ -823,7 +823,7 @@ export default {
if (this.reportId) {
try {
if (this.messageWebSocket) {
this.messageWebSocket.close();
this.messageWebSocket.close();
}
this.clearNodeStatus(this.$refs.stepTree.root.childNodes);
this.clearDebug();
@ -836,7 +836,7 @@ export default {
let url = "/api/automation/stop/" + this.reportId;
this.$get(url, response => {
this.debugLoading = false;
},error =>{
}, error => {
this.debugLoading = false;
});
}
@ -991,7 +991,7 @@ export default {
},
onDebugMessage(e) {
//
if(e && e.data === "CONN_SUCCEEDED"){
if (e && e.data === "CONN_SUCCEEDED") {
this.run();
}
if (e.data && e.data.startsWith("result_")) {
@ -1196,7 +1196,7 @@ export default {
} else {
this.operatingElements = [];
}
if ((!this.operatingElements && this.stepFilter)|| this.stepFilter.get("SpecialSteps").indexOf(data.type) !== -1) {
if ((!this.operatingElements && this.stepFilter) || this.stepFilter.get("SpecialSteps").indexOf(data.type) !== -1) {
this.operatingElements = this.stepFilter.get("ALL");
}
this.selectedTreeNode = data;
@ -1266,14 +1266,14 @@ export default {
addCustomizeApi(request) {
this.customizeVisible = false;
request.enable === undefined ? request.enable = true : request.enable;
if(this.selectedTreeNode !== undefined){
if(this.stepFilter.get("SpecialSteps").indexOf(this.selectedTreeNode.type) !== -1){
this.scenarioDefinition.splice(this.selectedTreeNode.index,0,request);
if (this.selectedTreeNode !== undefined) {
if (this.stepFilter.get("SpecialSteps").indexOf(this.selectedTreeNode.type) !== -1) {
this.scenarioDefinition.splice(this.selectedTreeNode.index, 0, request);
this.$store.state.forceRerenderIndex = getUUID();
}else{
this.selectedTreeNode.hashTree.push(request) ;
} else {
this.selectedTreeNode.hashTree.push(request);
}
}else{
} else {
this.scenarioDefinition.push(request);
}
this.customizeRequest = {};
@ -1294,14 +1294,14 @@ export default {
this.resetResourceId(item.hashTree);
item.enable === undefined ? item.enable = true : item.enable;
item.variableEnable = item.variableEnable === undefined ? true : item.variableEnable;
if(this.selectedTreeNode !== undefined){
if(this.stepFilter.get("SpecialSteps").indexOf(this.selectedTreeNode.type) !== -1){
this.scenarioDefinition.splice(this.selectedTreeNode.index,0,item);
if (this.selectedTreeNode !== undefined) {
if (this.stepFilter.get("SpecialSteps").indexOf(this.selectedTreeNode.type) !== -1) {
this.scenarioDefinition.splice(this.selectedTreeNode.index, 0, item);
this.$store.state.forceRerenderIndex = getUUID();
}else{
this.selectedTreeNode.hashTree.push(item) ;
} else {
this.selectedTreeNode.hashTree.push(item);
}
}else{
} else {
this.scenarioDefinition.push(item);
}
})
@ -1346,14 +1346,14 @@ export default {
if (referenced === 'REF' && request.hashTree) {
this.recursiveSorting(request.hashTree);
}
if(this.selectedTreeNode !== undefined){
if(this.stepFilter.get("SpecialSteps").indexOf(this.selectedTreeNode.type) !== -1){
this.scenarioDefinition.splice(this.selectedTreeNode.index,0,request);
if (this.selectedTreeNode !== undefined) {
if (this.stepFilter.get("SpecialSteps").indexOf(this.selectedTreeNode.type) !== -1) {
this.scenarioDefinition.splice(this.selectedTreeNode.index, 0, request);
this.$store.state.forceRerenderIndex = getUUID();
}else{
this.selectedTreeNode.hashTree.push(request) ;
} else {
this.selectedTreeNode.hashTree.push(request);
}
}else{
} else {
this.scenarioDefinition.push(request);
}
},
@ -1508,7 +1508,7 @@ export default {
this.pluginDelStep = false;
//
this.initMessageSocket();
}else{
} else {
this.debugLoading = false;
}
})
@ -1763,9 +1763,6 @@ export default {
for (let i in stepArray) {
if (stepArray[i].type === "Assertions") {
hisDataProcessing(stepArray, obj)
let assertions = stepArray[i];
stepArray.splice(i, 1);
stepArray.unshift(assertions);
this.sort();
}
let typeArray = ["JDBCPostProcessor", "JDBCSampler", "JDBCPreProcessor"]
@ -1898,15 +1895,15 @@ export default {
this.setDomain(true);
this.setStep(this.scenarioDefinition);
},
setStep(stepArray){
setStep(stepArray) {
for (let i in stepArray) {
let typeArray = ["JDBCPostProcessor", "JDBCSampler", "JDBCPreProcessor"]
if(typeArray.indexOf(stepArray[i].type) !== -1) {
if(stepArray[i].customizeReq ){
if(stepArray[i].isRefEnvironment){
if (typeArray.indexOf(stepArray[i].type) !== -1) {
if (stepArray[i].customizeReq) {
if (stepArray[i].isRefEnvironment) {
this.setStepEnv(stepArray[i]);
}
}else {
} else {
this.setStepEnv(stepArray[i]);
}
}
@ -1934,7 +1931,7 @@ export default {
envId = request.refEevMap.get(projectId);
}
}
if(envId === request.originalEnvironmentId && request.originalDataSourceId) {
if (envId === request.originalEnvironmentId && request.originalDataSourceId) {
request.dataSourceId = request.originalDataSourceId;
}
let targetDataSourceName = "";
@ -1954,9 +1951,9 @@ export default {
currentEnvironment = environment;
}
});
this.initDataSource(envId, currentEnvironment, targetDataSourceName,request);
this.initDataSource(envId, currentEnvironment, targetDataSourceName, request);
},
initDataSource(envId, currentEnvironment, targetDataSourceName,request) {
initDataSource(envId, currentEnvironment, targetDataSourceName, request) {
this.databaseConfigsOptions = [];
if (envId) {
request.environmentId = envId;