fix(接口自动化): 修复场景导入,切换条件数据查不到问题
This commit is contained in:
parent
73bed3ccc1
commit
7911e24766
|
@ -50,7 +50,6 @@ import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
||||||
import io.metersphere.track.request.testplan.FileOperationRequest;
|
import io.metersphere.track.request.testplan.FileOperationRequest;
|
||||||
import io.metersphere.track.service.TestPlanScenarioCaseService;
|
import io.metersphere.track.service.TestPlanScenarioCaseService;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.collections.MapUtils;
|
|
||||||
import org.apache.commons.lang3.BooleanUtils;
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.ibatis.session.ExecutorType;
|
import org.apache.ibatis.session.ExecutorType;
|
||||||
|
@ -589,6 +588,9 @@ public class ApiAutomationService {
|
||||||
List<MsTestElement> hashTree = getScenarioHashTree(definition);
|
List<MsTestElement> hashTree = getScenarioHashTree(definition);
|
||||||
for (int i = 0; i < hashTree.size(); i++) {
|
for (int i = 0; i < hashTree.size(); i++) {
|
||||||
MsTestElement tr = hashTree.get(i);
|
MsTestElement tr = hashTree.get(i);
|
||||||
|
if (!tr.isEnable()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String referenced = tr.getReferenced();
|
String referenced = tr.getReferenced();
|
||||||
if (StringUtils.equals(MsTestElementConstants.REF.name(), referenced)) {
|
if (StringUtils.equals(MsTestElementConstants.REF.name(), referenced)) {
|
||||||
if (StringUtils.equals(tr.getType(), "HTTPSamplerProxy")) {
|
if (StringUtils.equals(tr.getType(), "HTTPSamplerProxy")) {
|
||||||
|
@ -603,7 +605,7 @@ public class ApiAutomationService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (http.isEnable()) {
|
if (http.isEnable()) {
|
||||||
if (StringUtils.isBlank(http.getUrl()) || !tr.isURL(http.getUrl())) {
|
if (http.getIsRefEnvironment()) {
|
||||||
env.getProjectIds().add(http.getProjectId());
|
env.getProjectIds().add(http.getProjectId());
|
||||||
env.setFullUrl(false);
|
env.setFullUrl(false);
|
||||||
}
|
}
|
||||||
|
@ -635,7 +637,7 @@ public class ApiAutomationService {
|
||||||
// 校验是否是全路径
|
// 校验是否是全路径
|
||||||
MsHTTPSamplerProxy httpSamplerProxy = (MsHTTPSamplerProxy) tr;
|
MsHTTPSamplerProxy httpSamplerProxy = (MsHTTPSamplerProxy) tr;
|
||||||
if (httpSamplerProxy.isEnable()) {
|
if (httpSamplerProxy.isEnable()) {
|
||||||
if (StringUtils.isBlank(httpSamplerProxy.getUrl()) || !tr.isURL(httpSamplerProxy.getUrl())) {
|
if (httpSamplerProxy.getIsRefEnvironment()) {
|
||||||
env.getProjectIds().add(httpSamplerProxy.getProjectId());
|
env.getProjectIds().add(httpSamplerProxy.getProjectId());
|
||||||
env.setFullUrl(false);
|
env.setFullUrl(false);
|
||||||
}
|
}
|
||||||
|
@ -644,9 +646,7 @@ public class ApiAutomationService {
|
||||||
env.getProjectIds().add(tr.getProjectId());
|
env.getProjectIds().add(tr.getProjectId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!tr.isEnable()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (StringUtils.equals(tr.getType(), "scenario")) {
|
if (StringUtils.equals(tr.getType(), "scenario")) {
|
||||||
env.getProjectIds().add(tr.getProjectId());
|
env.getProjectIds().add(tr.getProjectId());
|
||||||
}
|
}
|
||||||
|
@ -663,6 +663,9 @@ public class ApiAutomationService {
|
||||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
for (int i = 0; i < tree.size(); i++) {
|
for (int i = 0; i < tree.size(); i++) {
|
||||||
MsTestElement tr = tree.get(i);
|
MsTestElement tr = tree.get(i);
|
||||||
|
if (!tr.isEnable()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String referenced = tr.getReferenced();
|
String referenced = tr.getReferenced();
|
||||||
if (StringUtils.equals(MsTestElementConstants.REF.name(), referenced)) {
|
if (StringUtils.equals(MsTestElementConstants.REF.name(), referenced)) {
|
||||||
if (StringUtils.equals(tr.getType(), "HTTPSamplerProxy")) {
|
if (StringUtils.equals(tr.getType(), "HTTPSamplerProxy")) {
|
||||||
|
@ -675,7 +678,7 @@ public class ApiAutomationService {
|
||||||
http.setUrl(apiDefinition.getPath());
|
http.setUrl(apiDefinition.getPath());
|
||||||
}
|
}
|
||||||
if (http.isEnable()) {
|
if (http.isEnable()) {
|
||||||
if (StringUtils.isBlank(http.getUrl()) || !tr.isURL(http.getUrl())) {
|
if (http.getIsRefEnvironment()) {
|
||||||
env.setFullUrl(false);
|
env.setFullUrl(false);
|
||||||
env.getProjectIds().add(http.getProjectId());
|
env.getProjectIds().add(http.getProjectId());
|
||||||
}
|
}
|
||||||
|
@ -715,9 +718,6 @@ public class ApiAutomationService {
|
||||||
env.getProjectIds().add(tr.getProjectId());
|
env.getProjectIds().add(tr.getProjectId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!tr.isEnable()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (StringUtils.equals(tr.getType(), "scenario")) {
|
if (StringUtils.equals(tr.getType(), "scenario")) {
|
||||||
env.getProjectIds().add(tr.getProjectId());
|
env.getProjectIds().add(tr.getProjectId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -489,6 +489,9 @@ export default {
|
||||||
if(this.needRefreshModule()){
|
if(this.needRefreshModule()){
|
||||||
this.$emit('refreshTree');
|
this.$emit('refreshTree');
|
||||||
}
|
}
|
||||||
|
if(this.selectProjectId){
|
||||||
|
projectId = this.selectProjectId;
|
||||||
|
}
|
||||||
this.selectRows = new Set();
|
this.selectRows = new Set();
|
||||||
this.condition.moduleIds = this.selectNodeIds;
|
this.condition.moduleIds = this.selectNodeIds;
|
||||||
if (this.trashEnable) {
|
if (this.trashEnable) {
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
@edit="editScenario"
|
@edit="editScenario"
|
||||||
@selection="setData"
|
@selection="setData"
|
||||||
:referenced="true"
|
:referenced="true"
|
||||||
|
:select-project-id="cuurentProjectId"
|
||||||
ref="apiScenarioList"/>
|
ref="apiScenarioList"/>
|
||||||
|
|
||||||
<el-button style="float: right;margin: 10px" @click="importApiScenario" type="primary">{{ $t('api_test.scenario.reference') }}</el-button>
|
<el-button style="float: right;margin: 10px" @click="importApiScenario" type="primary">{{ $t('api_test.scenario.reference') }}</el-button>
|
||||||
|
@ -40,6 +41,7 @@
|
||||||
currentScenario: [],
|
currentScenario: [],
|
||||||
currentScenarioIds: [],
|
currentScenarioIds: [],
|
||||||
moduleOptions: {},
|
moduleOptions: {},
|
||||||
|
cuurentProjectId: "",
|
||||||
scenarioDefinition: Object,
|
scenarioDefinition: Object,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -84,6 +86,7 @@
|
||||||
this.moduleOptions = data;
|
this.moduleOptions = data;
|
||||||
},
|
},
|
||||||
refresh(data) {
|
refresh(data) {
|
||||||
|
this.cuurentProjectId = data;
|
||||||
this.$refs.apiScenarioList.search(data);
|
this.$refs.apiScenarioList.search(data);
|
||||||
},
|
},
|
||||||
editScenario(row) {
|
editScenario(row) {
|
||||||
|
|
Loading…
Reference in New Issue