fix (接口定义): 完善需求3遗漏优化
This commit is contained in:
parent
a3b82d3b3f
commit
29763edbe9
|
@ -110,6 +110,7 @@
|
||||||
:selectDataRange="selectDataRange"
|
:selectDataRange="selectDataRange"
|
||||||
:is-read-only="isReadOnly"
|
:is-read-only="isReadOnly"
|
||||||
@runTest="runTest"
|
@runTest="runTest"
|
||||||
|
@handleTestCase="handleTestCase"
|
||||||
@refreshTree="refreshTree"
|
@refreshTree="refreshTree"
|
||||||
@changeSelectDataRangeAll="changeSelectDataRangeAll"
|
@changeSelectDataRangeAll="changeSelectDataRangeAll"
|
||||||
@editApi="editApi"
|
@editApi="editApi"
|
||||||
|
@ -141,7 +142,7 @@
|
||||||
:module-ids="selectNodeIds"/>
|
:module-ids="selectNodeIds"/>
|
||||||
</ms-tab-button>
|
</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
|
<ms-edit-complete-container
|
||||||
:syncTabs="syncTabs"
|
:syncTabs="syncTabs"
|
||||||
@runTest="runTest"
|
@runTest="runTest"
|
||||||
|
@ -153,7 +154,7 @@
|
||||||
:project-id="projectId"
|
:project-id="projectId"
|
||||||
:currentProtocol="currentProtocol"
|
:currentProtocol="currentProtocol"
|
||||||
:moduleOptions="moduleOptions"
|
:moduleOptions="moduleOptions"
|
||||||
|
:activeDom="activeTab"
|
||||||
@changeSelectDataRangeAll="changeSelectDataRangeAll"
|
@changeSelectDataRangeAll="changeSelectDataRangeAll"
|
||||||
@handleCase="handleCase"
|
@handleCase="handleCase"
|
||||||
@showExecResult="showExecResult"
|
@showExecResult="showExecResult"
|
||||||
|
@ -188,41 +189,6 @@
|
||||||
@refreshModule="refreshModule"
|
@refreshModule="refreshModule"
|
||||||
v-if="currentProtocol==='DUBBO'"/>
|
v-if="currentProtocol==='DUBBO'"/>
|
||||||
</div>
|
</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">
|
<div v-if="item.type=== 'SCHEDULE'" class="ms-api-div">
|
||||||
|
@ -367,6 +333,7 @@ export default {
|
||||||
initApiTableOpretion: 'init',
|
initApiTableOpretion: 'init',
|
||||||
param: {},
|
param: {},
|
||||||
useEnvironment: String,
|
useEnvironment: String,
|
||||||
|
activeTab: "api"
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
|
@ -609,6 +576,7 @@ export default {
|
||||||
name = this.$t('api_test.definition.request.title');
|
name = this.$t('api_test.definition.request.title');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.activeTab = "api";
|
||||||
if (row != null && row.tags != 'null' && row.tags != '' && row.tags != undefined) {
|
if (row != null && row.tags != 'null' && row.tags != '' && row.tags != undefined) {
|
||||||
if (Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object'
|
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') {
|
&& Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'array') {
|
||||||
|
@ -663,9 +631,26 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
runTest(data) {
|
runTest(data) {
|
||||||
|
this.activeTab = "test";
|
||||||
this.handleTabsEdit(this.$t("commons.api"), "TEST", data);
|
this.handleTabsEdit(this.$t("commons.api"), "TEST", data);
|
||||||
this.setTabTitle(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) {
|
mockConfig(data) {
|
||||||
let targetName = this.$t("commons.mock") + "-" + data.apiName;
|
let targetName = this.$t("commons.mock") + "-" + data.apiName;
|
||||||
this.handleMockTabsConfig(targetName, "MOCK", data);
|
this.handleMockTabsConfig(targetName, "MOCK", data);
|
||||||
|
|
|
@ -3,19 +3,19 @@
|
||||||
<ms-drawer :size="60" @close="apiCaseClose" direction="bottom">
|
<ms-drawer :size="60" @close="apiCaseClose" direction="bottom">
|
||||||
<template v-slot:header>
|
<template v-slot:header>
|
||||||
<api-case-header
|
<api-case-header
|
||||||
:api="api"
|
:api="api"
|
||||||
@getApiTest="getApiTest"
|
@getApiTest="getApiTest"
|
||||||
@setEnvironment="setEnvironment"
|
@setEnvironment="setEnvironment"
|
||||||
@addCase="addCase"
|
@addCase="addCase"
|
||||||
@selectAll="selectAll"
|
@selectAll="selectAll"
|
||||||
:condition="condition"
|
:condition="condition"
|
||||||
:priorities="priorities"
|
:priorities="priorities"
|
||||||
:apiCaseList="apiCaseList"
|
:apiCaseList="apiCaseList"
|
||||||
:is-read-only="isReadOnly"
|
:is-read-only="isReadOnly"
|
||||||
:project-id="projectId"
|
:project-id="projectId"
|
||||||
:useEnvironment="environment"
|
:useEnvironment="environment"
|
||||||
:is-case-edit="isCaseEdit"
|
:is-case-edit="isCaseEdit"
|
||||||
ref="header"
|
ref="header"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -215,27 +215,33 @@ export default {
|
||||||
sysAddition(apiCase) {
|
sysAddition(apiCase) {
|
||||||
this.condition.projectId = this.projectId;
|
this.condition.projectId = this.projectId;
|
||||||
this.condition.apiDefinitionId = this.api.id;
|
this.condition.apiDefinitionId = this.api.id;
|
||||||
this.$post("/api/testcase/list", this.condition, response => {
|
this.apiCaseList = [];
|
||||||
let data = response.data;
|
if (apiCase) {
|
||||||
data.forEach(apiCase => {
|
this.copyCase(apiCase);
|
||||||
if (apiCase.tags && apiCase.tags.length > 0) {
|
} else {
|
||||||
apiCase.tags = JSON.parse(apiCase.tags);
|
this.addCase();
|
||||||
this.$set(apiCase, 'selected', false);
|
}
|
||||||
}
|
// this.$post("/api/testcase/list", this.condition, response => {
|
||||||
if (Object.prototype.toString.call(apiCase.request).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object') {
|
// let data = response.data;
|
||||||
apiCase.request = JSON.parse(apiCase.request);
|
// data.forEach(apiCase => {
|
||||||
}
|
// if (apiCase.tags && apiCase.tags.length > 0) {
|
||||||
if (!apiCase.request.hashTree) {
|
// apiCase.tags = JSON.parse(apiCase.tags);
|
||||||
apiCase.request.hashTree = [];
|
// this.$set(apiCase, 'selected', false);
|
||||||
}
|
// }
|
||||||
});
|
// if (Object.prototype.toString.call(apiCase.request).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object') {
|
||||||
this.apiCaseList = data;
|
// apiCase.request = JSON.parse(apiCase.request);
|
||||||
if (apiCase) {
|
// }
|
||||||
this.copyCase(apiCase);
|
// if (!apiCase.request.hashTree) {
|
||||||
} else {
|
// apiCase.request.hashTree = [];
|
||||||
this.addCase();
|
// }
|
||||||
}
|
// });
|
||||||
});
|
// this.apiCaseList = data;
|
||||||
|
// if (apiCase) {
|
||||||
|
// this.copyCase(apiCase);
|
||||||
|
// } else {
|
||||||
|
// this.addCase();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
},
|
},
|
||||||
|
|
||||||
apiCaseClose() {
|
apiCaseClose() {
|
||||||
|
@ -503,7 +509,15 @@ export default {
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
}
|
}
|
||||||
this.selectdCases = [];
|
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) {
|
showHistory(id) {
|
||||||
|
|
|
@ -729,18 +729,8 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleTestCase(api) {
|
handleTestCase(api) {
|
||||||
this.selectApi = api;
|
this.$emit("handleTestCase",api)
|
||||||
let request = {};
|
// this.$refs.caseList.open(this.selectApi);
|
||||||
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);
|
|
||||||
},
|
},
|
||||||
handleDelete(api) {
|
handleDelete(api) {
|
||||||
if (this.trashEnable) {
|
if (this.trashEnable) {
|
||||||
|
|
Loading…
Reference in New Issue