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

View File

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

View File

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

View File

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

View File

@ -42,6 +42,7 @@
v-model:model-value="record.lastExecResult"
:placeholder="t('common.pleaseSelect')"
class="param-input w-full"
@change="() => handleEditLastExecResult(record)"
>
<template #label>
<span class="text-[var(--color-text-2)]"><ExecuteResult :execute-result="record.lastExecResult" /></span>
@ -182,6 +183,7 @@
batchExecuteCase,
batchUpdateCaseExecutor,
disassociateCase,
editLastExecResult,
getPlanDetailFeatureCaseList,
sortFeatureCase,
} 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);
async function handleDisassociateCase(record: PlanDetailFeatureCaseItem, done?: () => void) {
@ -570,7 +588,7 @@
//
function handleTableBatch(event: BatchActionParams, params: BatchActionQueryParams) {
tableSelected.value = params?.selectedIds || [];
batchParams.value = params;
batchParams.value = { ...params, selectIds: params?.selectedIds };
switch (event.eventTag) {
case 'execute':
batchExecuteModalVisible.value = true;

View File

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