fix: TAPD缺陷修复

TAPD缺陷修复
This commit is contained in:
song-tianyang 2021-04-25 18:23:43 +08:00 committed by 刘瑞斌
parent fa8bb155fe
commit 4f0751788f
9 changed files with 182 additions and 147 deletions

View File

@ -413,8 +413,10 @@ public class ApiAutomationService {
http.setUrl(null); http.setUrl(null);
} else { } else {
ApiDefinition apiDefinition = apiDefinitionService.get(tr.getId()); ApiDefinition apiDefinition = apiDefinitionService.get(tr.getId());
if (apiDefinition != null) {
http.setUrl(apiDefinition.getPath()); http.setUrl(apiDefinition.getPath());
} }
}
if (http.isEnable()) { if (http.isEnable()) {
if (StringUtils.isBlank(http.getUrl()) || !tr.isURL(http.getUrl())) { if (StringUtils.isBlank(http.getUrl()) || !tr.isURL(http.getUrl())) {
env.getProjectIds().add(http.getProjectId()); env.getProjectIds().add(http.getProjectId());
@ -424,11 +426,15 @@ public class ApiAutomationService {
} else if (StringUtils.equals(tr.getType(), "JDBCSampler") || StringUtils.equals(tr.getType(), "TCPSampler")) { } else if (StringUtils.equals(tr.getType(), "JDBCSampler") || StringUtils.equals(tr.getType(), "TCPSampler")) {
if (StringUtils.equals(tr.getRefType(), "CASE")) { if (StringUtils.equals(tr.getRefType(), "CASE")) {
ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = apiTestCaseService.get(tr.getId()); ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = apiTestCaseService.get(tr.getId());
if (apiTestCaseWithBLOBs != null) {
env.getProjectIds().add(apiTestCaseWithBLOBs.getProjectId()); env.getProjectIds().add(apiTestCaseWithBLOBs.getProjectId());
}
} else { } else {
ApiDefinition apiDefinition = apiDefinitionService.get(tr.getId()); ApiDefinition apiDefinition = apiDefinitionService.get(tr.getId());
if (apiDefinition != null) {
env.getProjectIds().add(apiDefinition.getProjectId()); env.getProjectIds().add(apiDefinition.getProjectId());
} }
}
} else if (StringUtils.equals(tr.getType(), "scenario")) { } else if (StringUtils.equals(tr.getType(), "scenario")) {
if (tr.isEnable()) { if (tr.isEnable()) {
ApiScenarioWithBLOBs apiScenario = getApiScenario(tr.getId()); ApiScenarioWithBLOBs apiScenario = getApiScenario(tr.getId());

View File

@ -429,7 +429,8 @@
this.setTabTitle(data); this.setTabTitle(data);
}, },
mockConfig(data) { mockConfig(data) {
this.handleMockTabsConfig(this.$t("commons.mock"), "MOCK", data); let targetName = this.$t("commons.mock") + "-" + data.apiName;
this.handleMockTabsConfig(targetName, "MOCK", data);
}, },
saveApi(data) { saveApi(data) {
this.setTabTitle(data); this.setTabTitle(data);

View File

@ -2,7 +2,6 @@
<div class="card-container"> <div class="card-container">
<el-card class="card-content" v-loading="httpForm.loading"> <el-card class="card-content" v-loading="httpForm.loading">
<el-form :model="httpForm" :rules="rule" ref="httpForm" label-width="80px" label-position="right"> <el-form :model="httpForm" :rules="rule" ref="httpForm" label-width="80px" label-position="right">
<!-- 操作按钮 --> <!-- 操作按钮 -->
<div style="float: right;margin-right: 20px"> <div style="float: right;margin-right: 20px">
@ -190,6 +189,10 @@
return this.mockBaseUrl + "/mock/" + this.projectId; return this.mockBaseUrl + "/mock/" + this.projectId;
} else { } else {
let path = this.httpForm.path; let path = this.httpForm.path;
let prefix = "";
if (path.endsWith("/")) {
prefix = "/";
}
let protocol = this.httpForm.method; let protocol = this.httpForm.method;
if (protocol === 'GET' || protocol === 'DELETE') { if (protocol === 'GET' || protocol === 'DELETE') {
if (this.httpForm.request != null && this.httpForm.request.rest != null) { if (this.httpForm.request != null && this.httpForm.request.rest != null) {
@ -215,7 +218,8 @@
} }
} }
} }
return this.mockBaseUrl + "/mock/" + this.projectId + path;
return this.mockBaseUrl + "/mock/" + this.projectId + path + prefix;
} }
} }
}, },
@ -316,6 +320,7 @@
this.$post('/mockConfig/genMockConfig', mockParam, response => { this.$post('/mockConfig/genMockConfig', mockParam, response => {
let mockConfig = response.data; let mockConfig = response.data;
mockConfig.apiName = this.httpForm.name;
this.$emit('mockConfig', mockConfig); this.$emit('mockConfig', mockConfig);
}); });
} }

View File

@ -26,15 +26,21 @@
@keyup.enter.native="initApiDocSimpleList()" v-model="apiSearch.name"/> @keyup.enter.native="initApiDocSimpleList()" v-model="apiSearch.name"/>
<api-document-batch-share v-xpack v-if="showXpackCompnent" @shareApiDocument="shareApiDocument" :project-id="projectId" :share-url="batchShareUrl" style="float: right;margin: 6px;font-size: 17px"/> <api-document-batch-share v-xpack v-if="showXpackCompnent" @shareApiDocument="shareApiDocument" :project-id="projectId" :share-url="batchShareUrl" style="float: right;margin: 6px;font-size: 17px"/>
</el-row> </el-row>
<el-row v-else style="margin-top: 0px;position: fixed;float: right;margin-right: 0px;margin-left: 400px;top: 150px; right: 90px;"> <el-row v-else
<el-select size="small" :placeholder="$t('api_test.definition.document.order')" v-model="apiSearch.orderCondition" style="float: right;width: 180px;margin-right: 5px" style="margin-top: 0px;position: fixed;float: right;margin-right: 0px;margin-left: 400px;top: 150px; right: 90px; z-index: 9999">
<el-select size="small" :placeholder="$t('api_test.definition.document.order')"
v-model="apiSearch.orderCondition" style="float: right;width: 180px;margin-right: 5px"
class="ms-api-header-select" @change="initApiDocSimpleList" clearable> class="ms-api-header-select" @change="initApiDocSimpleList" clearable>
<el-option key="createTimeDesc" :label="$t('api_test.definition.document.create_time_sort')" value="createTimeDesc" /> <el-option key="createTimeDesc" :label="$t('api_test.definition.document.create_time_sort')"
<el-option key="editTimeAsc" :label="$t('api_test.definition.document.edit_time_positive_sequence')" value="editTimeAsc"/> value="createTimeDesc"/>
<el-option key="editTimeDesc" :label="$t('api_test.definition.document.edit_time_Reverse_order')" value="editTimeDesc"/> <el-option key="editTimeAsc" :label="$t('api_test.definition.document.edit_time_positive_sequence')"
value="editTimeAsc"/>
<el-option key="editTimeDesc" :label="$t('api_test.definition.document.edit_time_Reverse_order')"
value="editTimeDesc"/>
</el-select> </el-select>
<el-select size="small" :placeholder="$t('api_test.definition.document.request_method')" v-model="apiSearch.type" style="float: right;width: 180px;margin-right: 5px" <el-select size="small" :placeholder="$t('api_test.definition.document.request_method')"
v-model="apiSearch.type" style="float: right;width: 180px;margin-right: 5px"
class="ms-api-header-select" @change="initApiDocSimpleList" clearable> class="ms-api-header-select" @change="initApiDocSimpleList" clearable>
<el-option key="ALL" :label="$t('api_test.definition.document.data_set.all')" value="ALL"/> <el-option key="ALL" :label="$t('api_test.definition.document.data_set.all')" value="ALL"/>
<el-option key="GET" :label="'GET '+$t('api_test.definition.document.request_interface')" value="GET"/> <el-option key="GET" :label="'GET '+$t('api_test.definition.document.request_interface')" value="GET"/>

View File

@ -1,5 +1,6 @@
<template> <template>
<div> <div class="card-container">
<el-card class="card-content" v-loading="mockConfigData.loading">
<p class="tip">期望列表</p> <p class="tip">期望列表</p>
<div class="card"> <div class="card">
<el-input :placeholder="$t('commons.search_by_name')" class="search-input" size="small" <el-input :placeholder="$t('commons.search_by_name')" class="search-input" size="small"
@ -81,7 +82,8 @@
</el-row> </el-row>
<el-row> <el-row>
<div v-if="mockExpectConfig.request.jsonParam"> <div v-if="mockExpectConfig.request.jsonParam">
<ms-code-edit height="400px" :mode="'json'" ref="codeEdit" :data.sync="mockExpectConfig.request.jsonData" <ms-code-edit height="400px" :mode="'json'" ref="codeEdit"
:data.sync="mockExpectConfig.request.jsonData"
style="margin-top: 10px;"/> style="margin-top: 10px;"/>
</div> </div>
<div v-else> <div v-else>
@ -140,6 +142,7 @@
</div> </div>
</div> </div>
</el-form> </el-form>
</el-card>
</div> </div>
</template> </template>
@ -195,7 +198,7 @@ export default {
{max: 100, message: this.$t('test_track.length_less_than') + '100', trigger: 'blur'} {max: 100, message: this.$t('test_track.length_less_than') + '100', trigger: 'blur'}
], ],
response: { response: {
httpCode: [{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},], httpCode: [{required: true, message: this.$t('api_test.mock.rule.input_code'), trigger: 'blur'},],
delayed: [{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},], delayed: [{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},],
}, },
}, },

View File

@ -46,6 +46,11 @@ export function setUnSelectIds(tableData, condition, selectRows) {
return ids.indexOf(val) === -1; return ids.indexOf(val) === -1;
}); });
if (condition.unSelectIds) { if (condition.unSelectIds) {
//首先将选择的ID从unSelectIds中排除
condition.unSelectIds = condition.unSelectIds.filter(function (val) {
return ids.indexOf(val) === -1;
});
//去掉unselectIds中存在的ID
let needPushIds = thisUnSelectIds.filter(function (val) { let needPushIds = thisUnSelectIds.filter(function (val) {
return condition.unSelectIds.indexOf(val) === -1; return condition.unSelectIds.indexOf(val) === -1;
}); });

View File

@ -615,6 +615,9 @@ export default {
req_param: "Request params", req_param: "Request params",
rsp_param: "Response Params", rsp_param: "Response Params",
delete_mock_expect: "Confirm to delete this expect info ?", delete_mock_expect: "Confirm to delete this expect info ?",
rule: {
input_code: "Please input HTTP Code"
}
}, },
definition: { definition: {
api_title: "Api test", api_title: "Api test",

View File

@ -624,6 +624,9 @@ export default {
req_param: "请求参数", req_param: "请求参数",
rsp_param: "响应内容", rsp_param: "响应内容",
delete_mock_expect: "确认删除这条预期吗?", delete_mock_expect: "确认删除这条预期吗?",
rule: {
input_code: "请输入 HTTP Code"
}
}, },
definition: { definition: {
api_title: "接口列表", api_title: "接口列表",

View File

@ -614,6 +614,9 @@ export default {
req_param: "請求參賽", req_param: "請求參賽",
rsp_param: "響應內容", rsp_param: "響應內容",
delete_mock_expect: "確認刪除這條預期嗎?", delete_mock_expect: "確認刪除這條預期嗎?",
rule: {
input_code: "請輸入 HTTP Code"
}
}, },
definition: { definition: {
api_title: "接口列表", api_title: "接口列表",