refactor(接口自动化): 调试时环境检查问题

--bug=1008520 --user=lyh
【github#6612】jmeter调试好的场景,有环境变量,导入MS还提示要选择场景变量。并且还识别不到HTTP请求头中的端口
https://www.tapd.cn/55049933/s/1077469
This commit is contained in:
shiziyuan9527 2021-12-02 19:00:41 +08:00 committed by shiziyuan9527
parent 309ab806a6
commit 0c6dfef88d
2 changed files with 18 additions and 10 deletions

View File

@ -933,7 +933,7 @@ public class ApiAutomationService {
// 校验是否是全路径
MsHTTPSamplerProxy httpSamplerProxy = (MsHTTPSamplerProxy) tr;
if (httpSamplerProxy.isEnable()) {
if (StringUtils.isBlank(httpSamplerProxy.getUrl()) || !ElementUtil.isURL(httpSamplerProxy.getUrl())) {
if (StringUtils.isBlank(httpSamplerProxy.getUrl()) || (httpSamplerProxy.getIsRefEnvironment() != null && httpSamplerProxy.getIsRefEnvironment())) {
env.setFullUrl(false);
env.getProjectIds().add(httpSamplerProxy.getProjectId());
}

View File

@ -135,15 +135,23 @@ export default {
},
checkEnv(data) {
return new Promise((resolve => {
if (this.environmentType === ENV_TYPE.JSON) {
let res = this.$refs.envSelect.checkEnv(data);
resolve(res);
} else if (this.environmentType === ENV_TYPE.GROUP) {
let res = !this.hasOptionGroup ? this.$refs.envGroup.checkEnv() :
this.$refs.envOptionGroup.checkEnv();
res.then(r => {
resolve(r);
})
if (data) {
//
resolve(true);
} else {
if (!this.environmentType) {
this.$warning("请选择环境!");
resolve(false);
} else if (this.environmentType === ENV_TYPE.JSON) {
let res = this.$refs.envSelect.checkEnv(data);
resolve(res);
} else if (this.environmentType === ENV_TYPE.GROUP) {
let res = !this.hasOptionGroup ? this.$refs.envGroup.checkEnv() :
this.$refs.envOptionGroup.checkEnv();
res.then(r => {
resolve(r);
})
}
}
}))
},