fix: 收口模板契约与安全门禁
统一模板包 visual 契约并补齐完成证据;修复 release 版本一致性、管理员 token 撤销、CORS 与默认品牌配置;收敛依赖安全风险并完成全量回归验证。
This commit is contained in:
1 parent
456171aa85
commit
4f0b50c7f1
84 files changed
+7367
-5180
No files matched your search
@@ -31,8 +31,15 @@ type PreviewVersion = {
|
||||
contentChecksum: string;
|
||||
};
|
||||
|
||||
type PreviewWorkspace = {
|
||||
offerings: unknown[];
|
||||
trustItems: unknown[];
|
||||
inquiryForms: unknown[];
|
||||
trustPresentation: Record<string, unknown>;
|
||||
};
|
||||
|
||||
type PreviewBundle = {
|
||||
preview: Record<string, unknown>;
|
||||
preview: Record<string, unknown> & { workspace: PreviewWorkspace };
|
||||
version: PreviewVersion;
|
||||
};
|
||||
|
||||
@@ -158,7 +165,13 @@ test("导入包预览矩阵展示身份、资源和完整媒体槽位", async ({
|
||||
localStorage.setItem("adminToken", "fixture-token");
|
||||
localStorage.setItem("adminPlatformTemplateRole", "template_admin");
|
||||
});
|
||||
const emptyPreview = structuredClone(preview);
|
||||
emptyPreview.workspace.offerings = [];
|
||||
emptyPreview.workspace.trustItems = [];
|
||||
emptyPreview.workspace.inquiryForms = [];
|
||||
emptyPreview.workspace.trustPresentation = {};
|
||||
let attempts = 0;
|
||||
let serveEmptyPreview = false;
|
||||
const writes: string[] = [];
|
||||
await page.route("**/api/**", async (route) => {
|
||||
const url = new URL(route.request().url());
|
||||
@@ -170,7 +183,9 @@ test("导入包预览矩阵展示身份、资源和完整媒体槽位", async ({
|
||||
json:
|
||||
attempts === 1
|
||||
? { error: { code: "HTTP_400", message: "预览测试失败,请重试" } }
|
||||
: preview,
|
||||
: serveEmptyPreview
|
||||
? emptyPreview
|
||||
: preview,
|
||||
});
|
||||
}
|
||||
if (url.pathname.endsWith("/admin/templates"))
|
||||
@@ -224,6 +239,23 @@ test("导入包预览矩阵展示身份、资源和完整媒体槽位", async ({
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
// 清空业务记录后重新打开真实包预览,验证空态不是仅在源码中存在。
|
||||
serveEmptyPreview = true;
|
||||
await modal.getByRole("button", { name: "关闭" }).click();
|
||||
await expect(modal).toBeHidden();
|
||||
await page.getByRole("button", { name: /预览/ }).click();
|
||||
await expect(modal.locator(".component-template-preview .runtime-state")).toContainText(
|
||||
/正在整理中/,
|
||||
);
|
||||
if (evidenceDirectory) {
|
||||
await page.screenshot({
|
||||
path: path.join(
|
||||
evidenceDirectory,
|
||||
`empty-${String(sequence).padStart(2, "0")}-${mediaCase.packageKey}-${mediaCase.industry}.png`,
|
||||
),
|
||||
});
|
||||
}
|
||||
await page.unroute("**/api/**");
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user