test: 修复浏览器回归 fixture 契约漂移
CI / Static checks (pull_request) Successful in 5m52s
CI / Production build (pull_request) Successful in 5m35s
CI / Browser smoke (pull_request) Successful in 3m0s
CI / API integration (pull_request) Successful in 3m41s

- 补齐 trust content 与模板版本 fixture 的必填字段\n- mock template-operations/failures 的完整响应结构\n- 补全完整浏览器回归的启动步骤与 CORS 要求\n\n完整回归 32 个用例全部通过。
This commit is contained in:
que01 committed 2026-10-21 16:37:31 +08:00
1 parent 18bcdbeb00
commit 84522a8908
5 files changed
+65 -6

No files matched your search

@@ -712,6 +712,9 @@ test("林境模板支持首页和主理人区域点选", async ({ page }) => {
title: "专业资历",
summary: "建筑与门系统经验",
content: "持续服务私宅项目",
sortOrder: 0,
isPublished: true,
coverUrl: null,
config: {
pillars: editorialPillars,
serviceFlow: editorialFlow,
@@ -11,13 +11,17 @@ const manifest = JSON.parse(
);
const version = {
id: "preview-browser-version",
templatePackageId: "preview-browser-package",
packageKey: manifest.packageKey,
version: manifest.version,
displayName: manifest.displayName,
status: "imported",
contentChecksum: "fixture-checksum",
archiveChecksum: "fixture-archive-checksum",
importedAt: "2026-10-21T00:00:00.000Z",
updatedAt: "2026-10-21T00:00:00.000Z",
manifestSnapshot: manifest,
importedBy: { displayName: "模板管理员" },
importedBy: { id: "template-admin", username: "admin", displayName: "模板管理员" },
validationReport: {},
manifestSummary: { supportedIndustryTemplates: manifest.supportedIndustryTemplates },
};
@@ -103,6 +107,16 @@ test("模板管理可重试预览,并切换我的、详情和禁止提交的
}
if (url.pathname.endsWith("/admin/templates"))
return route.fulfill({ json: { items: [version], page: 1, pageSize: 20, total: 1 } });
if (url.pathname.endsWith("/admin/template-operations/failures"))
return route.fulfill({
json: {
since: "2026-09-21T00:00:00.000Z",
until: "2026-10-21T00:00:00.000Z",
days: 30,
backfilled: true,
failures: [],
},
});
if (url.pathname.endsWith("/admin/brands")) return route.fulfill({ json: [] });
return route.fulfill({ json: { name: "测试工作区" } });
});
@@ -18,12 +18,15 @@ type PackedChecksums = {
type PreviewVersion = {
id: string;
templatePackageId: string;
packageKey: string;
version: string;
displayName: string;
status: "imported";
manifestSnapshot: PackedManifest;
importedBy: { displayName: string };
importedBy: { id: string; username: string; displayName: string };
importedAt: string;
updatedAt: string;
validationReport: Record<string, unknown>;
manifestSummary: { supportedIndustryTemplates: string[] };
artifactPath: string;
@@ -88,12 +91,15 @@ async function buildPreviewFixture(mediaCase: MediaCase) {
const archivePath = path.join(temporary, archive);
const version: PreviewVersion = {
id: `preview-media-${mediaCase.packageKey}-${mediaCase.industry}`,
templatePackageId: `preview-media-package-${mediaCase.packageKey}`,
packageKey: manifest.packageKey,
version: manifest.version,
displayName: manifest.displayName,
status: "imported",
manifestSnapshot: manifest,
importedBy: { displayName: "模板管理员" },
importedBy: { id: "template-admin", username: "admin", displayName: "模板管理员" },
importedAt: "2026-10-21T00:00:00.000Z",
updatedAt: "2026-10-21T00:00:00.000Z",
validationReport: {},
manifestSummary: { supportedIndustryTemplates: manifest.supportedIndustryTemplates },
artifactPath: archivePath,
@@ -216,6 +222,16 @@ test("导入包预览矩阵展示身份、资源和完整媒体槽位", async ({
total: 1,
},
});
if (url.pathname.endsWith("/admin/template-operations/failures"))
return route.fulfill({
json: {
since: "2026-09-21T00:00:00.000Z",
until: "2026-10-21T00:00:00.000Z",
days: 30,
backfilled: true,
failures: [],
},
});
if (url.pathname.endsWith("/admin/brands")) return route.fulfill({ json: [] });
return route.fulfill({ json: { name: "测试工作区" } });
});