fix(接口自动化): 修复创建场景问题
This commit is contained in:
parent
ff9ecf6ec3
commit
43fbccb2a6
|
@ -20,7 +20,7 @@
|
||||||
:name="item.name"
|
:name="item.name"
|
||||||
closable>
|
closable>
|
||||||
<div class="ms-api-scenario-div">
|
<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>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
let label = this.$t('api_test.automation.add_scenario');
|
let label = this.$t('api_test.automation.add_scenario');
|
||||||
let name = getUUID().substring(0, 8);
|
let name = getUUID().substring(0, 8);
|
||||||
this.activeName = name;
|
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') {
|
if (tab.name === 'edit') {
|
||||||
let label = this.$t('api_test.automation.add_scenario');
|
let label = this.$t('api_test.automation.add_scenario');
|
||||||
|
|
|
@ -95,13 +95,21 @@
|
||||||
try {
|
try {
|
||||||
let urlObject = new URL(this.request.url);
|
let urlObject = new URL(this.request.url);
|
||||||
let url = urlObject.protocol + "//" + urlObject.host + "/";
|
let url = urlObject.protocol + "//" + urlObject.host + "/";
|
||||||
let path = this.request.url.substr(url.length);
|
if (url) {
|
||||||
if (!path.startsWith('/')) {
|
let path = this.request.url.substr(url.length);
|
||||||
path = "/" + path;
|
if (!path.startsWith('/')) {
|
||||||
|
path = "/" + path;
|
||||||
|
}
|
||||||
|
this.request.path = path;
|
||||||
|
} else {
|
||||||
|
this.request.url = this.request.path;
|
||||||
}
|
}
|
||||||
this.request.path = path;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.request.path = this.request.url;
|
if (this.request.url) {
|
||||||
|
this.request.path = this.request.url;
|
||||||
|
} else {
|
||||||
|
this.request.url = this.request.path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -682,6 +682,7 @@
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
this.path = "/api/automation/update";
|
this.path = "/api/automation/update";
|
||||||
this.currentScenario.tagId = JSON.parse(this.currentScenario.tagId);
|
this.currentScenario.tagId = JSON.parse(this.currentScenario.tagId);
|
||||||
|
this.$emit('refresh');
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -708,6 +709,7 @@
|
||||||
},
|
},
|
||||||
setParameter() {
|
setParameter() {
|
||||||
this.currentScenario.stepTotal = this.scenarioDefinition.length;
|
this.currentScenario.stepTotal = this.scenarioDefinition.length;
|
||||||
|
this.currentScenario.projectId = getCurrentProjectID();
|
||||||
this.currentScenario.modulePath = this.getPath(this.currentScenario.apiScenarioModuleId);
|
this.currentScenario.modulePath = this.getPath(this.currentScenario.apiScenarioModuleId);
|
||||||
// 构建一个场景对象 方便引用处理
|
// 构建一个场景对象 方便引用处理
|
||||||
let scenario = {
|
let scenario = {
|
||||||
|
@ -715,7 +717,9 @@
|
||||||
type: "scenario", referenced: 'Created', environmentId: this.currentEnvironmentId, hashTree: this.scenarioDefinition
|
type: "scenario", referenced: 'Created', environmentId: this.currentEnvironmentId, hashTree: this.scenarioDefinition
|
||||||
};
|
};
|
||||||
this.currentScenario.scenarioDefinition = scenario;
|
this.currentScenario.scenarioDefinition = scenario;
|
||||||
this.currentScenario.tagId = JSON.stringify(this.currentScenario.tagId);
|
if (this.currentScenario.tagId instanceof Array) {
|
||||||
|
this.currentScenario.tagId = JSON.stringify(this.currentScenario.tagId);
|
||||||
|
}
|
||||||
if (this.currentModule != null) {
|
if (this.currentModule != null) {
|
||||||
this.currentScenario.modulePath = this.currentModule.method !== undefined ? this.currentModule.method : null;
|
this.currentScenario.modulePath = this.currentModule.method !== undefined ? this.currentModule.method : null;
|
||||||
this.currentScenario.apiScenarioModuleId = this.currentModule.id;
|
this.currentScenario.apiScenarioModuleId = this.currentModule.id;
|
||||||
|
|
Loading…
Reference in New Issue