fix(测试计划): 修复测试计划用例步骤类型为文本描述新建缺陷缺陷内容获取不符

This commit is contained in:
xinxin.wu 2024-10-23 15:45:17 +08:00 committed by Craftsman
parent 93e8241275
commit 95ede5baad
1 changed files with 18 additions and 6 deletions

View File

@ -157,17 +157,29 @@ function getAssertTable(assertions: ResponseAssertionTableItem[]) {
export async function getCaseQuickContent(id: string) { export async function getCaseQuickContent(id: string) {
try { try {
const result = await getCaseDetail(id); const result = await getCaseDetail(id);
const { prerequisite, steps, expectedResult } = result; const { prerequisite, steps, expectedResult, caseEditType, textDescription } = result;
const getEmptyString = (value: string) => {
const emptyString = '<p style=""></p>';
return !value || emptyString.includes(value) ? '-' : value;
};
const stepData = getStepsTable(steps); const stepData = getStepsTable(steps);
const stepContent =
caseEditType === 'STEP'
? `<p style=""><strong>${t('system.orgTemplate.stepDescription')}</strong></p>
${stepData}`
: `
<p style=""><strong>${t('system.orgTemplate.textDescription')}</strong></p>
<p style="">${getEmptyString(textDescription)}</p>
<p style=""><strong>${t('system.orgTemplate.expectedResult')}</strong></p>
<p style="">${getEmptyString(expectedResult)}</p>
`;
// 处理步骤 // 处理步骤
const caseContent = ` const caseContent = `
<p style=""><strong>${t('system.orgTemplate.precondition')}</strong></p> <p style=""><strong>${t('system.orgTemplate.precondition')}</strong></p>
<p style="">${prerequisite || '-'}</p> <p style="">${getEmptyString(prerequisite)}</p>
<p style=""><strong>${t('system.orgTemplate.stepDescription')}</strong></p> ${stepContent}
${stepData}
<p style=""><strong>${t('system.orgTemplate.expectedResult')}</strong></p>
<p style="">${expectedResult || '-'}</p>
<p style=""><strong>${t('system.orgTemplate.actualResult')}</strong></p> <p style=""><strong>${t('system.orgTemplate.actualResult')}</strong></p>
<p style="">-</p>`; <p style="">-</p>`;
detailContentMap[CaseLinkEnum.FUNCTIONAL] = caseContent; detailContentMap[CaseLinkEnum.FUNCTIONAL] = caseContent;