feat(测试计划): 测试计划详情-功能用例列表修改执行结果&功能用例详情步骤执行结果回显

This commit is contained in:
teukkk 2024-05-17 11:40:00 +08:00 committed by 刘瑞斌
parent 845cf6f65a
commit 952596f7d7
7 changed files with 49 additions and 8 deletions

View File

@ -15,6 +15,7 @@ import {
deletePlanUrl, deletePlanUrl,
DeleteTestPlanModuleUrl, DeleteTestPlanModuleUrl,
DisassociateCaseUrl, DisassociateCaseUrl,
EditCaseLastExecResultUrl,
followPlanUrl, followPlanUrl,
GetAssociatedBugUrl, GetAssociatedBugUrl,
GetFeatureCaseModuleCountUrl, GetFeatureCaseModuleCountUrl,
@ -32,6 +33,7 @@ import {
SortFeatureCaseUrl, SortFeatureCaseUrl,
TestPlanAssociateBugUrl, TestPlanAssociateBugUrl,
TestPlanCancelBugUrl, TestPlanCancelBugUrl,
TestPlanCaseDetailUrl,
updateTestPlanModuleUrl, updateTestPlanModuleUrl,
UpdateTestPlanUrl, UpdateTestPlanUrl,
} from '@/api/requrls/test-plan/testPlan'; } from '@/api/requrls/test-plan/testPlan';
@ -46,6 +48,7 @@ import type {
BatchFeatureCaseParams, BatchFeatureCaseParams,
BatchUpdateCaseExecutorParams, BatchUpdateCaseExecutorParams,
DisassociateCaseParams, DisassociateCaseParams,
EditLastExecResultParams,
FollowPlanParams, FollowPlanParams,
PassRateCountDetail, PassRateCountDetail,
PlanDetailBugItem, PlanDetailBugItem,
@ -171,6 +174,10 @@ export function getFeatureCaseModule(planId: string) {
export function disassociateCase(data: DisassociateCaseParams) { export function disassociateCase(data: DisassociateCaseParams) {
return MSR.post({ url: DisassociateCaseUrl, data }); return MSR.post({ url: DisassociateCaseUrl, data });
} }
// 计划详情-功能用例列表-编辑执行结果
export function editLastExecResult(data: EditLastExecResultParams) {
return MSR.post({ url: EditCaseLastExecResultUrl, data });
}
// 计划详情-功能用例列表-拖拽排序 // 计划详情-功能用例列表-拖拽排序
export const sortFeatureCase = (data: SortFeatureCaseParams) => { export const sortFeatureCase = (data: SortFeatureCaseParams) => {
return MSR.post({ url: SortFeatureCaseUrl, data }); return MSR.post({ url: SortFeatureCaseUrl, data });
@ -191,6 +198,10 @@ export function batchUpdateCaseExecutor(data: BatchUpdateCaseExecutorParams) {
export function runFeatureCase(data: RunFeatureCaseParams) { export function runFeatureCase(data: RunFeatureCaseParams) {
return MSR.post({ url: RunFeatureCaseUrl, data }); return MSR.post({ url: RunFeatureCaseUrl, data });
} }
// 计划详情-功能用例-详情
export function getCaseDetail(id: string) {
return MSR.get({ url: `${TestPlanCaseDetailUrl}/${id}` });
}
// 测试计划-用例详情-缺陷列表 // 测试计划-用例详情-缺陷列表
export function associatedBugPage(data: TableQueryParams) { export function associatedBugPage(data: TableQueryParams) {
return MSR.post({ url: GetAssociatedBugUrl, data }); return MSR.post({ url: GetAssociatedBugUrl, data });

View File

@ -50,6 +50,8 @@ export const GetFeatureCaseModuleCountUrl = '/test-plan/functional/case/module/c
export const GetFeatureCaseModuleUrl = '/test-plan/functional/case/tree'; export const GetFeatureCaseModuleUrl = '/test-plan/functional/case/tree';
// 计划详情-功能用例列表-拖拽排序 // 计划详情-功能用例列表-拖拽排序
export const SortFeatureCaseUrl = '/test-plan/functional/case/sort'; export const SortFeatureCaseUrl = '/test-plan/functional/case/sort';
// 计划详情-功能用例列表-编辑执行结果
export const EditCaseLastExecResultUrl = '/test-plan/functional/case/edit';
// 计划详情-功能用例-取消关联用例 // 计划详情-功能用例-取消关联用例
export const DisassociateCaseUrl = '/test-plan/functional/case/disassociate'; export const DisassociateCaseUrl = '/test-plan/functional/case/disassociate';
// 计划详情-功能用例-批量取消关联用例 // 计划详情-功能用例-批量取消关联用例
@ -58,6 +60,8 @@ export const BatchDisassociateCaseUrl = '/test-plan/functional/case/batch/disass
export const RunFeatureCaseUrl = '/test-plan/functional/case/run'; export const RunFeatureCaseUrl = '/test-plan/functional/case/run';
// 测试计划-用例详情-缺陷列表 // 测试计划-用例详情-缺陷列表
export const GetAssociatedBugUrl = '/test-plan/functional/case/has/associate/bug/page'; export const GetAssociatedBugUrl = '/test-plan/functional/case/has/associate/bug/page';
// 测试计划-用例详情
export const TestPlanCaseDetailUrl = '/test-plan/functional/case/detail';
// 测试计划-用例详情-关联缺陷 // 测试计划-用例详情-关联缺陷
export const TestPlanAssociateBugUrl = '/test-plan/functional/case/associate/bug'; export const TestPlanAssociateBugUrl = '/test-plan/functional/case/associate/bug';
// 测试计划-用例详情-取消关联缺陷 // 测试计划-用例详情-取消关联缺陷

View File

@ -41,7 +41,7 @@ export const defaultDetailCount: PassRateCountDetail = {
}; };
export const defaultExecuteForm = { export const defaultExecuteForm = {
lastExecResult: 'PASSED' as LastExecuteResults, lastExecResult: LastExecuteResults.SUCCESS,
content: '', content: '',
planCommentFileIds: [], planCommentFileIds: [],
notifier: [] as string[], notifier: [] as string[],

View File

@ -158,6 +158,10 @@ export interface DisassociateCaseParams {
id: string; id: string;
} }
export interface EditLastExecResultParams extends DisassociateCaseParams {
lastExecResult: string;
}
export interface BatchFeatureCaseParams extends BatchActionQueryParams { export interface BatchFeatureCaseParams extends BatchActionQueryParams {
testPlanId: string; testPlanId: string;
moduleIds?: string[]; moduleIds?: string[];

View File

@ -587,9 +587,10 @@
if (steps) { if (steps) {
stepData.value = JSON.parse(steps).map((item: any) => { stepData.value = JSON.parse(steps).map((item: any) => {
return { return {
id: item.id,
step: item.desc, step: item.desc,
expected: item.result, expected: item.result,
actualResult: item.actualResult ?? '', actualResult: item.actualResult,
executeResult: item.executeResult, executeResult: item.executeResult,
}; };
}); });

View File

@ -42,6 +42,7 @@
v-model:model-value="record.lastExecResult" v-model:model-value="record.lastExecResult"
:placeholder="t('common.pleaseSelect')" :placeholder="t('common.pleaseSelect')"
class="param-input w-full" class="param-input w-full"
@change="() => handleEditLastExecResult(record)"
> >
<template #label> <template #label>
<span class="text-[var(--color-text-2)]"><ExecuteResult :execute-result="record.lastExecResult" /></span> <span class="text-[var(--color-text-2)]"><ExecuteResult :execute-result="record.lastExecResult" /></span>
@ -182,6 +183,7 @@
batchExecuteCase, batchExecuteCase,
batchUpdateCaseExecutor, batchUpdateCaseExecutor,
disassociateCase, disassociateCase,
editLastExecResult,
getPlanDetailFeatureCaseList, getPlanDetailFeatureCaseList,
sortFeatureCase, sortFeatureCase,
} from '@/api/modules/test-plan/testPlan'; } from '@/api/modules/test-plan/testPlan';
@ -462,6 +464,22 @@
} }
} }
//
async function handleEditLastExecResult(record: PlanDetailFeatureCaseItem) {
try {
await editLastExecResult({
id: record.id,
testPlanId: props.planId,
lastExecResult: record.lastExecResult,
});
Message.success(t('common.updateSuccess'));
emit('refresh');
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
}
}
// //
const disassociateLoading = ref(false); const disassociateLoading = ref(false);
async function handleDisassociateCase(record: PlanDetailFeatureCaseItem, done?: () => void) { async function handleDisassociateCase(record: PlanDetailFeatureCaseItem, done?: () => void) {
@ -570,7 +588,7 @@
// //
function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) { function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) {
tableSelected.value = params?.selectedIds || []; tableSelected.value = params?.selectedIds || [];
batchParams.value = params; batchParams.value = { ...params, selectIds: params?.selectedIds };
switch (event.eventTag) { switch (event.eventTag) {
case 'execute': case 'execute':
batchExecuteModalVisible.value = true; batchExecuteModalVisible.value = true;

View File

@ -159,8 +159,7 @@
import EditCaseDetailDrawer from '@/views/case-management/caseReview/components/editCaseDetailDrawer.vue'; import EditCaseDetailDrawer from '@/views/case-management/caseReview/components/editCaseDetailDrawer.vue';
import ExecutionHistory from '@/views/test-plan/testPlan/detail/featureCase/detail/executionHistory/index.vue'; import ExecutionHistory from '@/views/test-plan/testPlan/detail/featureCase/detail/executionHistory/index.vue';
import { getCaseDetail } from '@/api/modules/case-management/featureCase'; import { getCaseDetail, getPlanDetailFeatureCaseList, getTestPlanDetail } from '@/api/modules/test-plan/testPlan';
import { getPlanDetailFeatureCaseList, getTestPlanDetail } from '@/api/modules/test-plan/testPlan';
import { testPlanDefaultDetail } from '@/config/testPlan'; import { testPlanDefaultDetail } from '@/config/testPlan';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
@ -278,7 +277,7 @@
async function loadCaseDetail() { async function loadCaseDetail() {
try { try {
caseDetailLoading.value = true; caseDetailLoading.value = true;
const res = await getCaseDetail(activeCaseId.value); const res = await getCaseDetail(activeId.value);
caseDetail.value = res; caseDetail.value = res;
descriptions.value = [ descriptions.value = [
{ {
@ -333,7 +332,7 @@
} }
} }
watch( watch(
() => activeCaseId.value, () => activeId.value,
() => { () => {
loadCaseDetail(); loadCaseDetail();
// TODO // TODO
@ -348,8 +347,12 @@
const caseTabDetailRef = ref<InstanceType<typeof CaseTabDetail>>(); const caseTabDetailRef = ref<InstanceType<typeof CaseTabDetail>>();
const stepExecutionResult = computed(() => { const stepExecutionResult = computed(() => {
const stepData = caseTabDetailRef.value?.stepData; const stepData = caseTabDetailRef.value?.stepData;
return stepData?.map((item) => { return stepData?.map((item, index) => {
return { return {
id: item.id,
num: index,
desc: item.step,
result: item.expected,
actualResult: item.actualResult, actualResult: item.actualResult,
executeResult: item.executeResult, executeResult: item.executeResult,
}; };