refactor(接口测试): 增加接口用例保存并继续添加功能
--story=1013901 --user=赵勇 【接口测试】接口case新增“保存并继续添加”按钮 https://www.tapd.cn/55049933/s/1439638 Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
parent
e77efa3a19
commit
abf8af1c3d
|
@ -16,7 +16,7 @@
|
||||||
<el-col :span="9">
|
<el-col :span="9">
|
||||||
<div class="variable-combine">{{ api.name }}</div>
|
<div class="variable-combine">{{ api.name }}</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="6">
|
||||||
<div class="variable-combine" style="margin-left: 10px">
|
<div class="variable-combine" style="margin-left: 10px">
|
||||||
{{ api.path === null ? ' ' : api.path }}
|
{{ api.path === null ? ' ' : api.path }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
ref="environmentSelect"
|
ref="environmentSelect"
|
||||||
v-if="api.protocol === 'HTTP' || api.protocol === 'TCP'" />
|
v-if="api.protocol === 'HTTP' || api.protocol === 'TCP'" />
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="2">
|
<el-col :span="4">
|
||||||
<!-- 保存操作 -->
|
<!-- 保存操作 -->
|
||||||
<el-button
|
<el-button
|
||||||
v-if="!isXpack || !showUpdateRule"
|
v-if="!isXpack || !showUpdateRule"
|
||||||
|
@ -38,16 +38,30 @@
|
||||||
size="small"
|
size="small"
|
||||||
@click="saveTestCase()"
|
@click="saveTestCase()"
|
||||||
v-prevent-re-click
|
v-prevent-re-click
|
||||||
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_CASE']">
|
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_CASE']"
|
||||||
|
style="margin-left: -20px">
|
||||||
{{ saveButtonText }}
|
{{ saveButtonText }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
|
<el-button
|
||||||
|
v-if="!isXpack || !showUpdateRule"
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click="saveAndCreate()"
|
||||||
|
v-prevent-re-click
|
||||||
|
v-permission="['PROJECT_API_DEFINITION:READ+EDIT_CASE']"
|
||||||
|
style="margin-left: 2px">
|
||||||
|
{{ $t('home.dashboard.api_case.save_and_create') }}
|
||||||
|
</el-button>
|
||||||
|
|
||||||
<el-dropdown
|
<el-dropdown
|
||||||
v-else
|
v-else
|
||||||
style="margin-left: -15px"
|
style="margin-left: -17px"
|
||||||
v-permission="[
|
v-permission="[
|
||||||
'PROJECT_API_DEFINITION:READ+EDIT_CASE',
|
'PROJECT_API_DEFINITION:READ+EDIT_CASE',
|
||||||
'PROJECT_API_DEFINITION:READ+CREATE_CASE',
|
'PROJECT_API_DEFINITION:READ+CREATE_CASE',
|
||||||
'PROJECT_API_DEFINITION:READ+COPY_CASE']"
|
'PROJECT_API_DEFINITION:READ+COPY_CASE',
|
||||||
|
]"
|
||||||
split-button
|
split-button
|
||||||
type="primary"
|
type="primary"
|
||||||
size="small"
|
size="small"
|
||||||
|
@ -159,6 +173,9 @@ export default {
|
||||||
saveTestCase() {
|
saveTestCase() {
|
||||||
this.$emit('saveCase');
|
this.$emit('saveCase');
|
||||||
},
|
},
|
||||||
|
saveAndCreate() {
|
||||||
|
this.$emit('saveCase', false, true);
|
||||||
|
},
|
||||||
handleCommand(command) {
|
handleCommand(command) {
|
||||||
if (command === 'openSyncRule') {
|
if (command === 'openSyncRule') {
|
||||||
this.$EventBus.$emit('showXpackCaseSet', false);
|
this.$EventBus.$emit('showXpackCaseSet', false);
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<i class="el-icon-edit" style="cursor: pointer" @click="showInput(apiCase)" />
|
<i class="el-icon-edit" style="cursor: pointer" @click="showInput(apiCase)" />
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<div v-if="apiCase.id" style="color: #999999; font-size: 12px;margin-top: 8px;">
|
<div v-if="apiCase.id" style="color: #999999; font-size: 12px; margin-top: 8px">
|
||||||
<span style="margin-left: 10px">
|
<span style="margin-left: 10px">
|
||||||
{{ apiCase.updateTime | datetimeFormat }}
|
{{ apiCase.updateTime | datetimeFormat }}
|
||||||
{{ apiCase.updateUser }}
|
{{ apiCase.updateUser }}
|
||||||
|
@ -676,7 +676,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
saveCase(row, hideAlert) {
|
saveCase(row, hideAlert, created) {
|
||||||
this.isSave = true;
|
this.isSave = true;
|
||||||
let tmp = JSON.parse(JSON.stringify(row));
|
let tmp = JSON.parse(JSON.stringify(row));
|
||||||
this.isShowInput = false;
|
this.isShowInput = false;
|
||||||
|
@ -737,13 +737,16 @@ export default {
|
||||||
if (!hideAlert) {
|
if (!hideAlert) {
|
||||||
this.$emit('refresh');
|
this.$emit('refresh');
|
||||||
}
|
}
|
||||||
|
if (created) {
|
||||||
|
this.$emit('addCase');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
this.isSave = false;
|
this.isSave = false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
saveTestCase(row, hideAlert) {
|
saveTestCase(row, hideAlert, created) {
|
||||||
if (this.validate(row)) {
|
if (this.validate(row)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -762,7 +765,7 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.api.source = 'editCase';
|
this.api.source = 'editCase';
|
||||||
if (!this.isSave) {
|
if (!this.isSave) {
|
||||||
this.saveCase(row, hideAlert);
|
this.saveCase(row, hideAlert, created);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
@showExecResult="showExecResult"
|
@showExecResult="showExecResult"
|
||||||
@showHistory="showHistory"
|
@showHistory="showHistory"
|
||||||
@reLoadCase="reLoadCase"
|
@reLoadCase="reLoadCase"
|
||||||
|
@addCase="addCase"
|
||||||
:environment="environment"
|
:environment="environment"
|
||||||
:case-item-height="caseItemHeight"
|
:case-item-height="caseItemHeight"
|
||||||
@setSelectedCaseId="setSelectedCaseId"
|
@setSelectedCaseId="setSelectedCaseId"
|
||||||
|
@ -244,7 +245,7 @@ export default {
|
||||||
setSelectedCaseId(caseId) {
|
setSelectedCaseId(caseId) {
|
||||||
this.selectCaseId = caseId;
|
this.selectCaseId = caseId;
|
||||||
},
|
},
|
||||||
saveCase(hideAlert) {
|
saveCase(hideAlert, created) {
|
||||||
if (this.loaded) {
|
if (this.loaded) {
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
|
@ -258,7 +259,7 @@ export default {
|
||||||
}
|
}
|
||||||
if (this.apiCaseList && this.apiCaseList.length !== 0) {
|
if (this.apiCaseList && this.apiCaseList.length !== 0) {
|
||||||
let item = this.apiCaseList[index];
|
let item = this.apiCaseList[index];
|
||||||
this.$refs.apiCaseItem[index].saveTestCase(item, hideAlert);
|
this.$refs.apiCaseItem[index].saveTestCase(item, hideAlert, created);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
saveApiAndCase(api) {
|
saveApiAndCase(api) {
|
||||||
|
@ -450,7 +451,13 @@ export default {
|
||||||
if (this.$refs.apiCaseItem && this.$refs.apiCaseItem[0]) {
|
if (this.$refs.apiCaseItem && this.$refs.apiCaseItem[0]) {
|
||||||
this.$refs.apiCaseItem[0].reload();
|
this.$refs.apiCaseItem[0].reload();
|
||||||
}
|
}
|
||||||
store.currentApiCase = { refresh: true, id: data.id, status: status, passRate: passRate, reportId: data.threadName };
|
store.currentApiCase = {
|
||||||
|
refresh: true,
|
||||||
|
id: data.id,
|
||||||
|
status: status,
|
||||||
|
passRate: passRate,
|
||||||
|
reportId: data.threadName,
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -607,6 +614,7 @@ export default {
|
||||||
};
|
};
|
||||||
request.projectId = getCurrentProjectID();
|
request.projectId = getCurrentProjectID();
|
||||||
obj.request = request;
|
obj.request = request;
|
||||||
|
this.apiCaseList = [];
|
||||||
this.apiCaseList.unshift(obj);
|
this.apiCaseList.unshift(obj);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -645,7 +653,6 @@ export default {
|
||||||
row.request.projectId = this.projectId;
|
row.request.projectId = this.projectId;
|
||||||
row.request.id = row.id;
|
row.request.id = row.id;
|
||||||
this.runData.push(row.request);
|
this.runData.push(row.request);
|
||||||
/*触发执行操作*/
|
|
||||||
this.reportId = getUUID().substring(0, 8);
|
this.reportId = getUUID().substring(0, 8);
|
||||||
this.testCaseId = row.id ? row.id : row.request.id;
|
this.testCaseId = row.id ? row.id : row.request.id;
|
||||||
this.$emit('refreshCase', this.testCaseId);
|
this.$emit('refreshCase', this.testCaseId);
|
||||||
|
|
|
@ -85,6 +85,7 @@ const message = {
|
||||||
covered_rate: 'Api covered rate',
|
covered_rate: 'Api covered rate',
|
||||||
executed_rate: 'Executed rate',
|
executed_rate: 'Executed rate',
|
||||||
pass_rate: 'Pass rate',
|
pass_rate: 'Pass rate',
|
||||||
|
save_and_create: 'Save and add',
|
||||||
},
|
},
|
||||||
scenario: {
|
scenario: {
|
||||||
title: 'Scenario amount',
|
title: 'Scenario amount',
|
||||||
|
|
|
@ -81,6 +81,7 @@ const message = {
|
||||||
covered_rate: '接口覆盖率',
|
covered_rate: '接口覆盖率',
|
||||||
executed_rate: '用例执行率',
|
executed_rate: '用例执行率',
|
||||||
pass_rate: '用例通过率',
|
pass_rate: '用例通过率',
|
||||||
|
save_and_create: '保存并继续添加',
|
||||||
},
|
},
|
||||||
scenario: {
|
scenario: {
|
||||||
title: '场景用例数量统计',
|
title: '场景用例数量统计',
|
||||||
|
|
|
@ -81,6 +81,7 @@ const message = {
|
||||||
covered_rate: '接口覆蓋率',
|
covered_rate: '接口覆蓋率',
|
||||||
executed_rate: '用例執行率',
|
executed_rate: '用例執行率',
|
||||||
pass_rate: '用例通過率',
|
pass_rate: '用例通過率',
|
||||||
|
save_and_create: '保存並繼續添加',
|
||||||
},
|
},
|
||||||
scenario: {
|
scenario: {
|
||||||
title: '場景用例數量統計',
|
title: '場景用例數量統計',
|
||||||
|
|
Loading…
Reference in New Issue