fix(测试计划): 关联场景用例前环境判断

--bug=1008339 --user=lyh 【测试跟踪】测试计划关联场景用例的时候没选择环境也能关联了,也没提示
https://www.tapd.cn/55049933/s/1074891
This commit is contained in:
shiziyuan9527 2021-11-25 10:37:59 +08:00 committed by shiziyuan9527
parent 37da667c08
commit 75344ff3fc
1 changed files with 12 additions and 0 deletions

View File

@ -37,6 +37,7 @@
import MsApiScenarioList from "../../../../../api/automation/scenario/ApiScenarioList"; import MsApiScenarioList from "../../../../../api/automation/scenario/ApiScenarioList";
import MsApiScenarioModule from "../../../../../api/automation/scenario/ApiScenarioModule"; import MsApiScenarioModule from "../../../../../api/automation/scenario/ApiScenarioModule";
import RelevanceScenarioList from "./RelevanceScenarioList"; import RelevanceScenarioList from "./RelevanceScenarioList";
import {ENV_TYPE} from "@/common/js/constants";
export default { export default {
name: "TestCaseScenarioRelevance", name: "TestCaseScenarioRelevance",
@ -109,6 +110,17 @@
let map = this.$refs.apiScenarioList.map; let map = this.$refs.apiScenarioList.map;
let envType = this.$refs.apiScenarioList.environmentType; let envType = this.$refs.apiScenarioList.environmentType;
let envGroupId = this.$refs.apiScenarioList.envGroupId; let envGroupId = this.$refs.apiScenarioList.envGroupId;
if (!map || map.size < 1) {
this.$warning("请选择用例!");
return false;
}
if (envType === ENV_TYPE.JSON && (!envMap || envMap.size < 1)) {
this.$warning("请选择环境!");
return false;
} else if (envType === ENV_TYPE.GROUP && !envGroupId) {
this.$warning("请选择环境!");
return false;
}
param.planId = this.planId; param.planId = this.planId;
param.mapping = strMapToObj(map); param.mapping = strMapToObj(map);
param.envMap = strMapToObj(envMap); param.envMap = strMapToObj(envMap);