fix (接口定义): 完善需求3遗漏优化
This commit is contained in:
parent
a3b82d3b3f
commit
29763edbe9
|
@ -110,6 +110,7 @@
|
|||
:selectDataRange="selectDataRange"
|
||||
:is-read-only="isReadOnly"
|
||||
@runTest="runTest"
|
||||
@handleTestCase="handleTestCase"
|
||||
@refreshTree="refreshTree"
|
||||
@changeSelectDataRangeAll="changeSelectDataRangeAll"
|
||||
@editApi="editApi"
|
||||
|
@ -141,7 +142,7 @@
|
|||
:module-ids="selectNodeIds"/>
|
||||
</ms-tab-button>
|
||||
<!-- 添加/编辑测试窗口-->
|
||||
<div v-if="item.type=== 'ADD'" class="ms-api-div">
|
||||
<div v-if="item.type=== 'ADD' ||item.type === 'TEST'" class="ms-api-div">
|
||||
<ms-edit-complete-container
|
||||
:syncTabs="syncTabs"
|
||||
@runTest="runTest"
|
||||
|
@ -153,7 +154,7 @@
|
|||
:project-id="projectId"
|
||||
:currentProtocol="currentProtocol"
|
||||
:moduleOptions="moduleOptions"
|
||||
|
||||
:activeDom="activeTab"
|
||||
@changeSelectDataRangeAll="changeSelectDataRangeAll"
|
||||
@handleCase="handleCase"
|
||||
@showExecResult="showExecResult"
|
||||
|
@ -188,41 +189,6 @@
|
|||
@refreshModule="refreshModule"
|
||||
v-if="currentProtocol==='DUBBO'"/>
|
||||
</div>
|
||||
<!-- 测试-->
|
||||
<div v-else-if="item.type=== 'TEST'" class="ms-api-div">
|
||||
<ms-run-test-http-page
|
||||
:syncTabs="syncTabs"
|
||||
:currentProtocol="currentProtocol"
|
||||
:api-data="item.api"
|
||||
:project-id="projectId"
|
||||
@saveAsApi="editApi"
|
||||
@refresh="refresh"
|
||||
v-if="currentProtocol==='HTTP'"/>
|
||||
<ms-run-test-tcp-page
|
||||
:syncTabs="syncTabs"
|
||||
:currentProtocol="currentProtocol"
|
||||
:api-data="item.api"
|
||||
:project-id="projectId"
|
||||
@saveAsApi="editApi"
|
||||
@refresh="refresh"
|
||||
v-if="currentProtocol==='TCP'"/>
|
||||
<ms-run-test-sql-page
|
||||
:syncTabs="syncTabs"
|
||||
:currentProtocol="currentProtocol"
|
||||
:api-data="item.api"
|
||||
:project-id="projectId"
|
||||
@saveAsApi="editApi"
|
||||
@refresh="refresh"
|
||||
v-if="currentProtocol==='SQL'"/>
|
||||
<ms-run-test-dubbo-page
|
||||
:syncTabs="syncTabs"
|
||||
:currentProtocol="currentProtocol"
|
||||
:api-data="item.api"
|
||||
:project-id="projectId"
|
||||
@saveAsApi="editApi"
|
||||
@refresh="refresh"
|
||||
v-if="currentProtocol==='DUBBO'"/>
|
||||
</div>
|
||||
|
||||
<!-- 定时任务 -->
|
||||
<div v-if="item.type=== 'SCHEDULE'" class="ms-api-div">
|
||||
|
@ -367,6 +333,7 @@ export default {
|
|||
initApiTableOpretion: 'init',
|
||||
param: {},
|
||||
useEnvironment: String,
|
||||
activeTab: "api"
|
||||
};
|
||||
},
|
||||
activated() {
|
||||
|
@ -609,6 +576,7 @@ export default {
|
|||
name = this.$t('api_test.definition.request.title');
|
||||
}
|
||||
}
|
||||
this.activeTab = "api";
|
||||
if (row != null && row.tags != 'null' && row.tags != '' && row.tags != undefined) {
|
||||
if (Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object'
|
||||
&& Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'array') {
|
||||
|
@ -663,9 +631,26 @@ export default {
|
|||
}
|
||||
},
|
||||
runTest(data) {
|
||||
this.activeTab = "test";
|
||||
this.handleTabsEdit(this.$t("commons.api"), "TEST", data);
|
||||
this.setTabTitle(data);
|
||||
},
|
||||
handleTestCase(row) {
|
||||
this.activeTab = "testCase";
|
||||
let name = "";
|
||||
if (row.name) {
|
||||
name = this.$t('api_test.definition.request.edit_api') + "-" + row.name;
|
||||
} else {
|
||||
name = this.$t('api_test.definition.request.title');
|
||||
}
|
||||
if (row != null && row.tags != 'null' && row.tags != '' && row.tags != undefined) {
|
||||
if (Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object'
|
||||
&& Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'array') {
|
||||
row.tags = JSON.parse(row.tags);
|
||||
}
|
||||
}
|
||||
this.handleTabsEdit(name, "ADD", row);
|
||||
},
|
||||
mockConfig(data) {
|
||||
let targetName = this.$t("commons.mock") + "-" + data.apiName;
|
||||
this.handleMockTabsConfig(targetName, "MOCK", data);
|
||||
|
|
|
@ -215,27 +215,33 @@ export default {
|
|||
sysAddition(apiCase) {
|
||||
this.condition.projectId = this.projectId;
|
||||
this.condition.apiDefinitionId = this.api.id;
|
||||
this.$post("/api/testcase/list", this.condition, response => {
|
||||
let data = response.data;
|
||||
data.forEach(apiCase => {
|
||||
if (apiCase.tags && apiCase.tags.length > 0) {
|
||||
apiCase.tags = JSON.parse(apiCase.tags);
|
||||
this.$set(apiCase, 'selected', false);
|
||||
}
|
||||
if (Object.prototype.toString.call(apiCase.request).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object') {
|
||||
apiCase.request = JSON.parse(apiCase.request);
|
||||
}
|
||||
if (!apiCase.request.hashTree) {
|
||||
apiCase.request.hashTree = [];
|
||||
}
|
||||
});
|
||||
this.apiCaseList = data;
|
||||
this.apiCaseList = [];
|
||||
if (apiCase) {
|
||||
this.copyCase(apiCase);
|
||||
} else {
|
||||
this.addCase();
|
||||
}
|
||||
});
|
||||
// this.$post("/api/testcase/list", this.condition, response => {
|
||||
// let data = response.data;
|
||||
// data.forEach(apiCase => {
|
||||
// if (apiCase.tags && apiCase.tags.length > 0) {
|
||||
// apiCase.tags = JSON.parse(apiCase.tags);
|
||||
// this.$set(apiCase, 'selected', false);
|
||||
// }
|
||||
// if (Object.prototype.toString.call(apiCase.request).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object') {
|
||||
// apiCase.request = JSON.parse(apiCase.request);
|
||||
// }
|
||||
// if (!apiCase.request.hashTree) {
|
||||
// apiCase.request.hashTree = [];
|
||||
// }
|
||||
// });
|
||||
// this.apiCaseList = data;
|
||||
// if (apiCase) {
|
||||
// this.copyCase(apiCase);
|
||||
// } else {
|
||||
// this.addCase();
|
||||
// }
|
||||
// });
|
||||
},
|
||||
|
||||
apiCaseClose() {
|
||||
|
@ -503,7 +509,15 @@ export default {
|
|||
this.$success(this.$t('commons.save_success'));
|
||||
}
|
||||
this.selectdCases = [];
|
||||
this.getApiTest();
|
||||
this.getResult();
|
||||
});
|
||||
},
|
||||
getResult() {
|
||||
this.apiCaseList.forEach(apiCase => {
|
||||
const index = this.runData.findIndex(d => d.name === apiCase.id);
|
||||
if (index !== -1) {
|
||||
apiCase.active = true;
|
||||
}
|
||||
});
|
||||
},
|
||||
showHistory(id) {
|
||||
|
|
|
@ -729,18 +729,8 @@ export default {
|
|||
});
|
||||
},
|
||||
handleTestCase(api) {
|
||||
this.selectApi = api;
|
||||
let request = {};
|
||||
if (Object.prototype.toString.call(api.request).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') {
|
||||
request = api.request;
|
||||
} else {
|
||||
request = JSON.parse(api.request);
|
||||
}
|
||||
if (!request.hashTree) {
|
||||
request.hashTree = [];
|
||||
}
|
||||
this.selectApi.url = request.path;
|
||||
this.$refs.caseList.open(this.selectApi);
|
||||
this.$emit("handleTestCase",api)
|
||||
// this.$refs.caseList.open(this.selectApi);
|
||||
},
|
||||
handleDelete(api) {
|
||||
if (this.trashEnable) {
|
||||
|
|
Loading…
Reference in New Issue