feat(测试计划): 联调测试计划报告用例明细执行历史列表&执行步骤

This commit is contained in:
xinxin.wu 2024-07-04 14:22:18 +08:00 committed by 刘瑞斌
parent 15cb455620
commit 25c844cd3b
7 changed files with 82 additions and 58 deletions

View File

@ -2,7 +2,7 @@ import MSR from '@/api/http';
import * as reportUrl from '@/api/requrls/test-plan/report'; import * as reportUrl from '@/api/requrls/test-plan/report';
import type { GetShareId } from '@/models/apiTest/report'; import type { GetShareId } from '@/models/apiTest/report';
import { ReportDetail, ReportStepDetail } from "@/models/apiTest/report"; import { ReportDetail, ReportStepDetail } from '@/models/apiTest/report';
import { CommonList, TableQueryParams } from '@/models/common'; import { CommonList, TableQueryParams } from '@/models/common';
import { import {
ApiOrScenarioCaseItem, ApiOrScenarioCaseItem,
@ -10,6 +10,7 @@ import {
ReportBugItem, ReportBugItem,
UpdateReportDetailParams, UpdateReportDetailParams,
} from '@/models/testPlan/report'; } from '@/models/testPlan/report';
import type { ExecuteHistoryItem } from '@/models/testPlan/testPlan';
import { PlanReportDetail } from '@/models/testPlan/testPlanReport'; import { PlanReportDetail } from '@/models/testPlan/testPlanReport';
// 报告列表 // 报告列表
@ -150,4 +151,14 @@ export function reportCaseStepDetail(reportId: string, stepId: string, shareId?:
return MSR.get<ReportStepDetail[]>({ url: `${reportUrl.ReportDetailApiUrl}/${reportId}/${stepId}` }); return MSR.get<ReportStepDetail[]>({ url: `${reportUrl.ReportDetailApiUrl}/${reportId}/${stepId}` });
} }
// 报告详情-用例明细-执行历史步骤
export function getFunctionalExecuteStep(data: { reportId: string; shareId?: string }) {
if (data.shareId) {
return MSR.get<ExecuteHistoryItem>({
url: `${reportUrl.ReportShareFunctionalStepUrl}/${data.shareId}/${data.reportId}`,
});
}
return MSR.get<ExecuteHistoryItem>({ url: `${reportUrl.ReportFunctionalStepUrl}/${data.reportId}` });
}
export default {}; export default {};

View File

@ -58,3 +58,7 @@ export const ReportScenarioUrl = '/test-plan/api/scenario/report/get';
export const ReportDetailScenarioUrl = '/test-plan/api/scenario/report/get/detail'; export const ReportDetailScenarioUrl = '/test-plan/api/scenario/report/get/detail';
// 测试计划-报告-报告富文本预览压缩图 // 测试计划-报告-报告富文本预览压缩图
export const ReportPlanPreviewImageUrl = '/test-plan/report/preview/md'; export const ReportPlanPreviewImageUrl = '/test-plan/report/preview/md';
// 测试计划-报告-详情-功能用例明细-执行历史步骤
export const ReportFunctionalStepUrl = '/test-plan/report/detail/functional/case/step';
// 测试计划-报告-详情-功能用例明细-执行历史步骤-分享
export const ReportShareFunctionalStepUrl = '/test-plan/report/share/detail/functional/case/step';

View File

@ -16,6 +16,7 @@ export interface FeatureCaseItem {
executeResult: string; executeResult: string;
executeUserName: string; executeUserName: string;
bugCount: number; bugCount: number;
reportId: string;
} }
export interface UpdateReportDetailParams { export interface UpdateReportDetailParams {

View File

@ -127,6 +127,7 @@ const functionalList: FeatureCaseItem = {
executeResult: 'SUCCESS', executeResult: 'SUCCESS',
executeUserName: '', executeUserName: '',
bugCount: 0, bugCount: 0,
reportId: '',
}; };
// 缺陷明细 // 缺陷明细
const bugList: ReportBugItem = { const bugList: ReportBugItem = {

View File

@ -8,7 +8,7 @@
</template> </template>
<template #lastExecResult="{ record }"> <template #lastExecResult="{ record }">
<ExecuteResult :execute-result="record.executeResult" /> <ExecuteResult :execute-result="record.executeResult" />
<MsButton class="ml-[8px]" :disabled="!props.isPreview" @click="openExecuteHistory(record)">{{ <MsButton class="ml-[8px]" :disabled="!props.isPreview || !record.reportId" @click="openExecuteHistory(record)">{{
t('common.detail') t('common.detail')
}}</MsButton> }}</MsButton>
</template> </template>
@ -21,15 +21,9 @@
no-content-padding no-content-padding
unmount-on-close unmount-on-close
> >
<!-- TODO 等待联调 后台没出接口 --> <div class="p-[16px]">
<ExecutionHistory <ExecutionHistory show-step-result :loading="executeLoading" :execute-list="executeList" />
:extra-params="{ </div>
caseId: '',
id: '',
testPlanId: '',
}"
:load-list-fun="executeHistory"
/>
</MsDrawer> </MsDrawer>
</template> </template>
@ -45,11 +39,15 @@
import ExecuteResult from '@/components/business/ms-case-associate/executeResult.vue'; import ExecuteResult from '@/components/business/ms-case-associate/executeResult.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 { getReportFeatureCaseList, getReportShareFeatureCaseList } from '@/api/modules/test-plan/report'; import {
import { executeHistory } from '@/api/modules/test-plan/testPlan'; getFunctionalExecuteStep,
getReportFeatureCaseList,
getReportShareFeatureCaseList,
} from '@/api/modules/test-plan/report';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { FeatureCaseItem } from '@/models/testPlan/report'; import { FeatureCaseItem } from '@/models/testPlan/report';
import type { ExecuteHistoryItem } from '@/models/testPlan/testPlan';
import { FilterSlotNameEnum } from '@/enums/tableFilterEnum'; import { FilterSlotNameEnum } from '@/enums/tableFilterEnum';
import { ReportCardTypeEnum } from '@/enums/testPlanReportEnum'; import { ReportCardTypeEnum } from '@/enums/testPlanReportEnum';
@ -150,10 +148,28 @@
const showDetailVisible = ref<boolean>(false); const showDetailVisible = ref<boolean>(false);
const detailRecord = ref(); const executeReportId = ref<string>('');
const executeList = ref<ExecuteHistoryItem[]>([]);
const executeLoading = ref<boolean>(false);
//
async function getExecuteStep() {
executeLoading.value = true;
try {
const res = await getFunctionalExecuteStep({
reportId: executeReportId.value,
shareId: props.shareId,
});
executeList.value = [res];
} catch (error) {
console.log(error);
} finally {
executeLoading.value = false;
}
}
function openExecuteHistory(record: FeatureCaseItem) { function openExecuteHistory(record: FeatureCaseItem) {
detailRecord.value = record; executeReportId.value = record.reportId;
showDetailVisible.value = true; showDetailVisible.value = true;
getExecuteStep();
} }
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<a-spin :loading="loading" class="w-full"> <a-spin :loading="loading" class="w-full">
<div class="execute-history-list"> <div class="execute-history-list">
<div v-for="item of executeHistoryList" :key="item.status" class="execute-history-list-item"> <div v-for="item of props.executeList" :key="item.status" class="execute-history-list-item">
<div class="flex items-center"> <div class="flex items-center">
<MsAvatar :avatar="item.userLogo" /> <MsAvatar :avatar="item.userLogo" />
<div class="ml-[8px] flex items-center"> <div class="ml-[8px] flex items-center">
@ -44,7 +44,7 @@
</div> </div>
</div> </div>
</div> </div>
<MsEmpty v-if="executeHistoryList.length === 0" /> <MsEmpty v-if="props.executeList.length === 0" />
</div> </div>
</a-spin> </a-spin>
</template> </template>
@ -60,35 +60,16 @@
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { characterLimit } from '@/utils'; import { characterLimit } from '@/utils';
import type { ExecuteHistoryItem, ExecuteHistoryType } from '@/models/testPlan/testPlan'; import type { ExecuteHistoryItem } from '@/models/testPlan/testPlan';
const { t } = useI18n(); const { t } = useI18n();
const props = defineProps<{ const props = defineProps<{
loadListFun: (params: ExecuteHistoryType) => Promise<ExecuteHistoryItem[]>; executeList: ExecuteHistoryItem[];
extraParams: ExecuteHistoryType; loading: boolean;
showStepResult?: boolean; // showStepResult?: boolean; //
}>(); }>();
const executeHistoryList = ref<ExecuteHistoryItem[]>([]);
const loading = ref<boolean>(false);
async function initList() {
loading.value = true;
try {
if (props.loadListFun) {
executeHistoryList.value = await props.loadListFun({
...props.extraParams,
});
}
} catch (error) {
console.log(error);
} finally {
loading.value = false;
}
}
function getStepData(steps: string) { function getStepData(steps: string) {
if (steps) { if (steps) {
return JSON.parse(steps).map((item: any) => { return JSON.parse(steps).map((item: any) => {
@ -103,18 +84,6 @@
} }
return []; return [];
} }
watch(
() => props.extraParams.caseId,
(val) => {
if (val) {
initList();
}
},
{
immediate: true,
}
);
</script> </script>
<style scoped lang="less"> <style scoped lang="less">

View File

@ -193,12 +193,8 @@
/> />
<ExecutionHistory <ExecutionHistory
v-if="activeTab === 'executionHistory'" v-if="activeTab === 'executionHistory'"
:extra-params="{ :execute-list="executeHistoryList"
caseId:activeCaseId, :loading="executeLoading"
id: activeId,
testPlanId: route.query.id as string,
}"
:load-list-fun="executeHistory"
/> />
</div> </div>
</a-spin> </a-spin>
@ -261,7 +257,7 @@
import { hasAnyPermission } from '@/utils/permission'; import { hasAnyPermission } from '@/utils/permission';
import type { TableQueryParams } from '@/models/common'; import type { TableQueryParams } from '@/models/common';
import type { PlanDetailFeatureCaseItem, TestPlanDetail } from '@/models/testPlan/testPlan'; import type { ExecuteHistoryItem, PlanDetailFeatureCaseItem, TestPlanDetail } from '@/models/testPlan/testPlan';
import { LastExecuteResults } from '@/enums/caseEnum'; import { LastExecuteResults } from '@/enums/caseEnum';
import { CaseManagementRouteEnum } from '@/enums/routeEnum'; import { CaseManagementRouteEnum } from '@/enums/routeEnum';
@ -577,6 +573,23 @@
initBugList(); initBugList();
await loadCase(); await loadCase();
}); });
const executeLoading = ref<boolean>(false);
const executeHistoryList = ref<ExecuteHistoryItem[]>([]);
async function initExecuteHistory() {
executeLoading.value = true;
try {
executeHistoryList.value = await executeHistory({
caseId: activeCaseId.value,
id: activeId.value,
testPlanId: route.query.id as string,
});
} catch (error) {
console.log(error);
} finally {
executeLoading.value = false;
}
}
watch( watch(
() => activeId.value, () => activeId.value,
() => { () => {
@ -584,6 +597,15 @@
initBugList(); initBugList();
} }
); );
watch(
() => activeTab.value,
(val) => {
if (val === 'executionHistory') {
initExecuteHistory();
}
}
);
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>