refactor(接口测试): 场景步骤快捷添加优化,请求支持同级添加步骤
--story=1007710 --user=赵勇 接口自动化添加步骤优化 https://www.tapd.cn/55049933/s/1159490
This commit is contained in:
parent
fe5d336638
commit
a7caa51135
|
@ -136,7 +136,7 @@ public class ApiScenarioEnvService {
|
||||||
if (!StringUtils.equalsIgnoreCase(httpSamplerProxy.getReferenced(), "Created") || (httpSamplerProxy.getIsRefEnvironment() != null &&
|
if (!StringUtils.equalsIgnoreCase(httpSamplerProxy.getReferenced(), "Created") || (httpSamplerProxy.getIsRefEnvironment() != null &&
|
||||||
httpSamplerProxy.getIsRefEnvironment())) {
|
httpSamplerProxy.getIsRefEnvironment())) {
|
||||||
env.getProjectIds().add(httpSamplerProxy.getProjectId());
|
env.getProjectIds().add(httpSamplerProxy.getProjectId());
|
||||||
env.setFullUrl(false);
|
env.setFullUrl(httpSamplerProxy.getIsRefEnvironment() == null ? true : false);
|
||||||
}
|
}
|
||||||
} else if (StringUtils.equals(testElement.getType(), "JDBCSampler") || StringUtils.equals(testElement.getType(), "TCPSampler")) {
|
} else if (StringUtils.equals(testElement.getType(), "JDBCSampler") || StringUtils.equals(testElement.getType(), "TCPSampler")) {
|
||||||
env.getProjectIds().add(testElement.getProjectId());
|
env.getProjectIds().add(testElement.getProjectId());
|
||||||
|
|
|
@ -1151,13 +1151,14 @@ export default {
|
||||||
setComponent(type, this, plugin);
|
setComponent(type, this, plugin);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
nodeClick(data, node) {
|
nodeClick(data, node) {
|
||||||
if ((data.referenced != 'REF' && data.referenced != 'Deleted' && !data.disabled && this.stepFilter) || data.refType === 'CASE') {
|
if ((data.referenced != 'REF' && data.referenced != 'Deleted' && !data.disabled && this.stepFilter) || data.refType === 'CASE') {
|
||||||
this.operatingElements = this.stepFilter.get(data.type);
|
this.operatingElements = this.stepFilter.get(data.type);
|
||||||
} else {
|
} else {
|
||||||
this.operatingElements = [];
|
this.operatingElements = [];
|
||||||
}
|
}
|
||||||
if (!this.operatingElements && this.stepFilter) {
|
if ((!this.operatingElements && this.stepFilter)|| this.stepFilter.get("AllSamplerProxy").indexOf(data.type) !== -1) {
|
||||||
this.operatingElements = this.stepFilter.get("ALL");
|
this.operatingElements = this.stepFilter.get("ALL");
|
||||||
}
|
}
|
||||||
this.selectedTreeNode = data;
|
this.selectedTreeNode = data;
|
||||||
|
@ -1227,9 +1228,14 @@ export default {
|
||||||
addCustomizeApi(request) {
|
addCustomizeApi(request) {
|
||||||
this.customizeVisible = false;
|
this.customizeVisible = false;
|
||||||
request.enable === undefined ? request.enable = true : request.enable;
|
request.enable === undefined ? request.enable = true : request.enable;
|
||||||
if (this.selectedTreeNode !== undefined) {
|
if(this.selectedTreeNode !== undefined){
|
||||||
this.selectedTreeNode.hashTree.push(request);
|
if(this.stepFilter.get("AllSamplerProxy").indexOf(this.selectedTreeNode.type) !== -1){
|
||||||
} else {
|
this.scenarioDefinition.splice(this.selectedTreeNode.index,0,request);
|
||||||
|
this.$store.state.forceRerenderIndex = getUUID();
|
||||||
|
}else{
|
||||||
|
this.selectedTreeNode.hashTree.push(request) ;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
this.scenarioDefinition.push(request);
|
this.scenarioDefinition.push(request);
|
||||||
}
|
}
|
||||||
this.customizeRequest = {};
|
this.customizeRequest = {};
|
||||||
|
@ -1250,9 +1256,14 @@ export default {
|
||||||
this.resetResourceId(item.hashTree);
|
this.resetResourceId(item.hashTree);
|
||||||
item.enable === undefined ? item.enable = true : item.enable;
|
item.enable === undefined ? item.enable = true : item.enable;
|
||||||
item.variableEnable = item.variableEnable === undefined ? true : item.variableEnable;
|
item.variableEnable = item.variableEnable === undefined ? true : item.variableEnable;
|
||||||
if (this.selectedTreeNode !== undefined) {
|
if(this.selectedTreeNode !== undefined){
|
||||||
this.selectedTreeNode.hashTree.push(item);
|
if(this.stepFilter.get("AllSamplerProxy").indexOf(this.selectedTreeNode.type) !== -1){
|
||||||
} else {
|
this.scenarioDefinition.splice(this.selectedTreeNode.index,0,item);
|
||||||
|
this.$store.state.forceRerenderIndex = getUUID();
|
||||||
|
}else{
|
||||||
|
this.selectedTreeNode.hashTree.push(item) ;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
this.scenarioDefinition.push(item);
|
this.scenarioDefinition.push(item);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1297,9 +1308,14 @@ export default {
|
||||||
if (referenced === 'REF' && request.hashTree) {
|
if (referenced === 'REF' && request.hashTree) {
|
||||||
this.recursiveSorting(request.hashTree);
|
this.recursiveSorting(request.hashTree);
|
||||||
}
|
}
|
||||||
if (this.selectedTreeNode !== undefined) {
|
if(this.selectedTreeNode !== undefined){
|
||||||
this.selectedTreeNode.hashTree.push(request);
|
if(this.stepFilter.get("AllSamplerProxy").indexOf(this.selectedTreeNode.type) !== -1){
|
||||||
} else {
|
this.scenarioDefinition.splice(this.selectedTreeNode.index,0,request);
|
||||||
|
this.$store.state.forceRerenderIndex = getUUID();
|
||||||
|
}else{
|
||||||
|
this.selectedTreeNode.hashTree.push(request) ;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
this.scenarioDefinition.push(request);
|
this.scenarioDefinition.push(request);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -145,56 +145,56 @@ export function buttons(this_) {
|
||||||
];
|
];
|
||||||
return buttons.filter(btn => btn.show);
|
return buttons.filter(btn => btn.show);
|
||||||
}
|
}
|
||||||
|
export function setNode(_this,node) {
|
||||||
|
if(_this.selectedTreeNode !== undefined){
|
||||||
|
if(_this.stepFilter.get("AllSamplerProxy").indexOf(_this.selectedTreeNode.type) !== -1){
|
||||||
|
_this.scenarioDefinition.splice(_this.selectedTreeNode.index,0,node);
|
||||||
|
_this.$store.state.forceRerenderIndex = getUUID();
|
||||||
|
}else{
|
||||||
|
_this.selectedTreeNode.hashTree.push(node) ;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
_this.scenarioDefinition.push(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
export function setComponent(type, _this, plugin) {
|
export function setComponent(type, _this, plugin) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ELEMENT_TYPE.IfController:
|
case ELEMENT_TYPE.IfController:
|
||||||
_this.selectedTreeNode !== undefined ? _this.selectedTreeNode.hashTree.push(new IfController()) :
|
setNode(_this,new IfController());
|
||||||
_this.scenarioDefinition.push(new IfController());
|
|
||||||
break;
|
break;
|
||||||
case ELEMENT_TYPE.ConstantTimer:
|
case ELEMENT_TYPE.ConstantTimer:
|
||||||
_this.selectedTreeNode !== undefined ? _this.selectedTreeNode.hashTree.push(new ConstantTimer({label: "SCENARIO-REF-STEP"})) :
|
setNode(_this,new ConstantTimer({label: "SCENARIO-REF-STEP"}));
|
||||||
_this.scenarioDefinition.push(new ConstantTimer());
|
|
||||||
break;
|
break;
|
||||||
case ELEMENT_TYPE.JSR223Processor:
|
case ELEMENT_TYPE.JSR223Processor:
|
||||||
_this.selectedTreeNode !== undefined ? _this.selectedTreeNode.hashTree.push(new JSR223Processor({label: "SCENARIO-REF-STEP"})) :
|
setNode(_this,new JSR223Processor({label: "SCENARIO-REF-STEP"}));
|
||||||
_this.scenarioDefinition.push(new JSR223Processor());
|
|
||||||
break;
|
break;
|
||||||
case ELEMENT_TYPE.JSR223PreProcessor:
|
case ELEMENT_TYPE.JSR223PreProcessor:
|
||||||
_this.selectedTreeNode !== undefined ? _this.selectedTreeNode.hashTree.push(new JSR223Processor({type: "JSR223PreProcessor", label: "SCENARIO-REF-STEP"})) :
|
setNode(_this, new JSR223Processor({type: "JSR223PreProcessor", label: "SCENARIO-REF-STEP"}));
|
||||||
_this.scenarioDefinition.push(new JSR223Processor({type: "JSR223PreProcessor"}));
|
|
||||||
break;
|
break;
|
||||||
case ELEMENT_TYPE.JSR223PostProcessor:
|
case ELEMENT_TYPE.JSR223PostProcessor:
|
||||||
_this.selectedTreeNode !== undefined ? _this.selectedTreeNode.hashTree.push(new JSR223Processor({type: "JSR223PostProcessor", label: "SCENARIO-REF-STEP"})) :
|
setNode(_this, new JSR223Processor({type: "JSR223PostProcessor", label: "SCENARIO-REF-STEP"}));
|
||||||
_this.scenarioDefinition.push(new JSR223Processor({type: "JSR223PostProcessor"}));
|
|
||||||
break;
|
break;
|
||||||
case ELEMENT_TYPE.JDBCPreProcessor:
|
case ELEMENT_TYPE.JDBCPreProcessor:
|
||||||
_this.selectedTreeNode !== undefined ? _this.selectedTreeNode.hashTree.push(new JDBCProcessor({type: "JDBCPreProcessor", label: "SCENARIO-REF-STEP"})) :
|
setNode(_this, new JDBCProcessor({type: "JDBCPreProcessor", label: "SCENARIO-REF-STEP"}));
|
||||||
_this.scenarioDefinition.push(new JDBCProcessor({type: "JDBCPreProcessor"}));
|
|
||||||
break;
|
break;
|
||||||
case ELEMENT_TYPE.JDBCPostProcessor:
|
case ELEMENT_TYPE.JDBCPostProcessor:
|
||||||
_this.selectedTreeNode !== undefined ? _this.selectedTreeNode.hashTree.push(new JDBCProcessor({type: "JDBCPostProcessor", label: "SCENARIO-REF-STEP"})) :
|
setNode(_this, new JDBCProcessor({type: "JDBCPostProcessor", label: "SCENARIO-REF-STEP"}));
|
||||||
_this.scenarioDefinition.push(new JDBCProcessor({type: "JDBCPostProcessor"}));
|
|
||||||
break;
|
break;
|
||||||
case ELEMENT_TYPE.Assertions:
|
case ELEMENT_TYPE.Assertions:
|
||||||
_this.selectedTreeNode !== undefined ? _this.selectedTreeNode.hashTree.push(new Assertions({label: "SCENARIO-REF-STEP", id: getUUID()})) :
|
setNode(_this, new Assertions({label: "SCENARIO-REF-STEP", id: getUUID()}));
|
||||||
_this.scenarioDefinition.push(new Assertions());
|
|
||||||
break;
|
break;
|
||||||
case ELEMENT_TYPE.Extract:
|
case ELEMENT_TYPE.Extract:
|
||||||
_this.selectedTreeNode !== undefined ? _this.selectedTreeNode.hashTree.push(new Extract({label: "SCENARIO-REF-STEP", id: getUUID()})) :
|
setNode(_this, new Extract({label: "SCENARIO-REF-STEP", id: getUUID()}));
|
||||||
_this.scenarioDefinition.push(new Extract());
|
|
||||||
break;
|
break;
|
||||||
case ELEMENT_TYPE.CustomizeReq:
|
case ELEMENT_TYPE.CustomizeReq:
|
||||||
_this.customizeRequest = {protocol: "HTTP", type: "API", hashTree: [], referenced: 'Created', active: false};
|
_this.customizeRequest = {protocol: "HTTP", type: "API", hashTree: [], referenced: 'Created', active: false};
|
||||||
_this.customizeVisible = true;
|
_this.customizeVisible = true;
|
||||||
break;
|
break;
|
||||||
case ELEMENT_TYPE.LoopController:
|
case ELEMENT_TYPE.LoopController:
|
||||||
_this.selectedTreeNode !== undefined ? _this.selectedTreeNode.hashTree.push(new LoopController()) :
|
setNode(_this, new LoopController());
|
||||||
_this.scenarioDefinition.push(new LoopController());
|
|
||||||
break;
|
break;
|
||||||
case ELEMENT_TYPE.TransactionController:
|
case ELEMENT_TYPE.TransactionController:
|
||||||
_this.selectedTreeNode !== undefined ? _this.selectedTreeNode.hashTree.push(new TransactionController()) :
|
setNode(_this, new TransactionController());
|
||||||
_this.scenarioDefinition.push(new TransactionController());
|
|
||||||
break;
|
break;
|
||||||
case ELEMENT_TYPE.scenario:
|
case ELEMENT_TYPE.scenario:
|
||||||
_this.isBtnHide = true;
|
_this.isBtnHide = true;
|
||||||
|
|
Loading…
Reference in New Issue