fix(环境组): 生成报告方式执行场景环境校验

--bug=1008280 --user=lyh 【接口测试】场景使用环境组,有不在环境组中的项目,点击调试-生成报告,可以执行
https://www.tapd.cn/55049933/s/1073387
This commit is contained in:
shiziyuan9527 2021-11-23 18:36:51 +08:00 committed by 刘瑞斌
parent 38a8538992
commit fa95490cb2
2 changed files with 25 additions and 28 deletions

View File

@ -851,36 +851,33 @@ export default {
handleCommand() {
this.debug = false;
/*触发执行操作*/
this.$refs['currentScenario'].validate((valid) => {
this.$refs['currentScenario'].validate(async (valid) => {
if (valid) {
this.debugLoading = true;
let definition = JSON.parse(JSON.stringify(this.currentScenario));
definition.hashTree = this.scenarioDefinition;
this.getEnv(JSON.stringify(definition)).then(() => {
let promise = this.$refs.envPopover.initEnv();
promise.then(() => {
let sign = this.$refs.envPopover.checkEnv(this.isFullUrl);
if (!sign) {
this.debugLoading = false;
return;
}
this.editScenario().then(() => {
this.debugData = {
id: this.currentScenario.id,
name: this.currentScenario.name,
type: "scenario",
variables: this.currentScenario.variables,
referenced: 'Created',
onSampleError: this.onSampleError,
enableCookieShare: this.enableCookieShare,
headers: this.currentScenario.headers,
environmentMap: this.projectEnvMap,
hashTree: this.scenarioDefinition
};
this.reportId = getUUID().substring(0, 8);
this.debugLoading = false;
})
})
await this.getEnv(JSON.stringify(definition));
await this.$refs.envPopover.initEnv();
const sign = await this.$refs.envPopover.checkEnv(this.isFullUrl);
if (!sign) {
this.debugLoading = false;
return;
}
this.editScenario().then(() => {
this.debugData = {
id: this.currentScenario.id,
name: this.currentScenario.name,
type: "scenario",
variables: this.currentScenario.variables,
referenced: 'Created',
onSampleError: this.onSampleError,
enableCookieShare: this.enableCookieShare,
headers: this.currentScenario.headers,
environmentMap: this.projectEnvMap,
hashTree: this.scenarioDefinition
};
this.reportId = getUUID().substring(0, 8);
this.debugLoading = false;
})
}
})

View File

@ -98,11 +98,11 @@
},
methods: {
submit(form) {
this.$refs[form].validate((valid) => {
this.$refs[form].validate(async (valid) => {
if (valid) {
this.form.projectEnvMap = this.projectEnvMap;
if (this.form.type === 'projectEnv') {
if (!this.$refs.envPopover.checkEnv()) {
if (! await this.$refs.envPopover.checkEnv()) {
return false;
}
this.form.map = this.map;