fix(接口自动化): 修复创建场景问题

This commit is contained in:
fit2-zhao 2020-12-15 19:02:35 +08:00
parent ff9ecf6ec3
commit 43fbccb2a6
3 changed files with 20 additions and 8 deletions

View File

@ -20,7 +20,7 @@
:name="item.name"
closable>
<div class="ms-api-scenario-div">
<ms-edit-api-scenario :currentScenario="item.currentScenario" :moduleOptions="moduleOptions"/>
<ms-edit-api-scenario @refresh="refresh" :currentScenario="item.currentScenario" :moduleOptions="moduleOptions"/>
</div>
</el-tab-pane>
@ -64,7 +64,7 @@
let label = this.$t('api_test.automation.add_scenario');
let name = getUUID().substring(0, 8);
this.activeName = name;
this.tabs.push({label: label, name: name, currentScenario: {}});
this.tabs.push({label: label, name: name, currentScenario: {apiScenarioModuleId: "", id: getUUID()}});
}
if (tab.name === 'edit') {
let label = this.$t('api_test.automation.add_scenario');

View File

@ -95,13 +95,21 @@
try {
let urlObject = new URL(this.request.url);
let url = urlObject.protocol + "//" + urlObject.host + "/";
if (url) {
let path = this.request.url.substr(url.length);
if (!path.startsWith('/')) {
path = "/" + path;
}
this.request.path = path;
} else {
this.request.url = this.request.path;
}
} catch (e) {
if (this.request.url) {
this.request.path = this.request.url;
} else {
this.request.url = this.request.path;
}
}
}
},

View File

@ -682,6 +682,7 @@
this.$success(this.$t('commons.save_success'));
this.path = "/api/automation/update";
this.currentScenario.tagId = JSON.parse(this.currentScenario.tagId);
this.$emit('refresh');
})
}
})
@ -708,6 +709,7 @@
},
setParameter() {
this.currentScenario.stepTotal = this.scenarioDefinition.length;
this.currentScenario.projectId = getCurrentProjectID();
this.currentScenario.modulePath = this.getPath(this.currentScenario.apiScenarioModuleId);
// 便
let scenario = {
@ -715,7 +717,9 @@
type: "scenario", referenced: 'Created', environmentId: this.currentEnvironmentId, hashTree: this.scenarioDefinition
};
this.currentScenario.scenarioDefinition = scenario;
if (this.currentScenario.tagId instanceof Array) {
this.currentScenario.tagId = JSON.stringify(this.currentScenario.tagId);
}
if (this.currentModule != null) {
this.currentScenario.modulePath = this.currentModule.method !== undefined ? this.currentModule.method : null;
this.currentScenario.apiScenarioModuleId = this.currentModule.id;