feat(接口自动化): 添加接口引用功能
This commit is contained in:
parent
5e22b003df
commit
53458630d8
|
@ -237,7 +237,7 @@
|
|||
|
||||
<!--接口列表-->
|
||||
<el-drawer :visible.sync="apiListVisible" :destroy-on-close="true" direction="ltr" :withHeader="false" :title="$t('api_test.automation.api_list_import')" :modal="false" size="90%">
|
||||
<ms-api-definition :visible="true" :currentRow="currentRow"/>
|
||||
<ms-api-definition :visible="visibleRef" :currentRow="currentRow"/>
|
||||
<el-button style="float: right;margin: 0px 20px 0px" type="primary" @click="copyApi('REF')">{{$t('api_test.scenario.reference')}}</el-button>
|
||||
<el-button style="float: right;" type="primary" @click="copyApi('Copy')">{{ $t('commons.copy') }}</el-button>
|
||||
</el-drawer>
|
||||
|
@ -348,6 +348,7 @@
|
|||
debugData: {},
|
||||
reportId: "",
|
||||
projectId: "",
|
||||
visibleRef: "",
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -417,6 +418,7 @@
|
|||
this.reload();
|
||||
},
|
||||
apiListImport() {
|
||||
this.visibleRef = getUUID();
|
||||
this.apiListVisible = true;
|
||||
},
|
||||
recursiveSorting(arr) {
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
<el-card style="margin-top: 5px">
|
||||
<el-row>
|
||||
<el-col :span="1">
|
||||
<el-checkbox v-if="visible" @change="caseChecked(item)"/>
|
||||
<el-checkbox v-model="item.checked" @change="caseChecked(item)"/>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<div class="el-step__icon is-text ms-api-col">
|
||||
|
@ -169,10 +169,8 @@
|
|||
api: {
|
||||
type: Object
|
||||
},
|
||||
createCase: String,
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
type: String,
|
||||
},
|
||||
loaded: Boolean,
|
||||
refreshSign: String,
|
||||
|
@ -202,7 +200,7 @@
|
|||
api() {
|
||||
this.getApiTest();
|
||||
},
|
||||
createCase() {
|
||||
visible() {
|
||||
this.getApiTest();
|
||||
}
|
||||
},
|
||||
|
@ -212,21 +210,6 @@
|
|||
this.getApiTest();
|
||||
},
|
||||
methods: {
|
||||
sysAddition() {
|
||||
let condition = {};
|
||||
condition.projectId = this.api.projectId;
|
||||
condition.apiDefinitionId = this.api.id;
|
||||
condition.priority = this.priorityValue;
|
||||
condition.name = this.name;
|
||||
this.$post("/api/testcase/list", condition, response => {
|
||||
for (let index in response.data) {
|
||||
let test = response.data[index];
|
||||
test.request = JSON.parse(test.request);
|
||||
}
|
||||
this.apiCaseList = response.data;
|
||||
this.addCase();
|
||||
});
|
||||
},
|
||||
getResult(data) {
|
||||
if (RESULT_MAP.get(data)) {
|
||||
return RESULT_MAP.get(data);
|
||||
|
@ -352,21 +335,27 @@
|
|||
return bodyUploadFiles;
|
||||
},
|
||||
getApiTest() {
|
||||
if (this.currentRow) {
|
||||
this.currentRow.cases = [];
|
||||
}
|
||||
let condition = {};
|
||||
condition.projectId = this.api.projectId;
|
||||
condition.apiDefinitionId = this.api.id;
|
||||
condition.priority = this.priorityValue;
|
||||
condition.name = this.name;
|
||||
this.$post("/api/testcase/list", condition, response => {
|
||||
for (let index in response.data) {
|
||||
let test = response.data[index];
|
||||
test.request = JSON.parse(test.request);
|
||||
if (this.api) {
|
||||
this.checkedCases = new Set();
|
||||
this.loading = true;
|
||||
if (this.currentRow) {
|
||||
this.currentRow.cases = [];
|
||||
}
|
||||
this.apiCaseList = response.data;
|
||||
});
|
||||
let condition = {};
|
||||
condition.projectId = this.projectId;
|
||||
condition.apiDefinitionId = this.api.id;
|
||||
condition.priority = this.priorityValue;
|
||||
condition.name = this.name;
|
||||
this.$post("/api/testcase/list", condition, response => {
|
||||
for (let index in response.data) {
|
||||
let test = response.data[index];
|
||||
test.checked = false;
|
||||
test.request = JSON.parse(test.request);
|
||||
}
|
||||
this.loading = false;
|
||||
this.apiCaseList = response.data;
|
||||
});
|
||||
}
|
||||
},
|
||||
validate(row) {
|
||||
if (!row.name) {
|
||||
|
@ -383,7 +372,7 @@
|
|||
});
|
||||
let hasEnvironment = false;
|
||||
for (let i in this.environments) {
|
||||
if (this.environments[i].id === this.api.environmentId) {
|
||||
if (this.api && this.environments[i].id === this.api.environmentId) {
|
||||
hasEnvironment = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -50,8 +50,7 @@
|
|||
},
|
||||
props: {
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
type: String,
|
||||
},
|
||||
currentRow: {
|
||||
type: Object,
|
||||
|
|
|
@ -142,8 +142,7 @@
|
|||
currentProtocol: String,
|
||||
currentModule: Object,
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
type: String,
|
||||
},
|
||||
currentRow: {
|
||||
type: Object,
|
||||
|
@ -161,6 +160,10 @@
|
|||
this.initApiTable();
|
||||
this.apiCaseClose();
|
||||
},
|
||||
visible() {
|
||||
this.initApiTable();
|
||||
this.apiCaseClose();
|
||||
},
|
||||
currentProtocol() {
|
||||
this.initApiTable();
|
||||
this.apiCaseClose();
|
||||
|
@ -321,8 +324,8 @@
|
|||
});
|
||||
},
|
||||
apiCaseClose() {
|
||||
this.selectApi = {};
|
||||
let h = window.screen.height;
|
||||
|
||||
let svgTop = document.getElementById("svgTop");
|
||||
svgTop.style.height = h - 200 + "px";
|
||||
|
||||
|
|
Loading…
Reference in New Issue