137 lines
4.4 KiB
TypeScript
137 lines
4.4 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
|
|
test("案例库列表和人味文案详情可查看", async ({ page }) => {
|
|
await page.route("**/api/cases", async (route) => {
|
|
await route.fulfill({
|
|
status: 200,
|
|
contentType: "application/json",
|
|
body: JSON.stringify({
|
|
cases: [
|
|
{
|
|
id: "case_copy_1",
|
|
case_type: "human_copy",
|
|
title: "人味文案优化:朋友圈",
|
|
summary: "原始文案摘要",
|
|
status: "optimized",
|
|
customer_name: "客户A",
|
|
brand_name: "品牌B",
|
|
project_tags: ["朋友圈"],
|
|
notes: "",
|
|
publish_target: "朋友圈",
|
|
source_excerpt: "原始文案摘要",
|
|
result_excerpt: "优化后文案摘要",
|
|
latest_result_version_id: "ver_copy_1",
|
|
latest_version_number: 1,
|
|
last_error_stage: null,
|
|
last_error_summary: null,
|
|
archived_at: null,
|
|
created_at: "2026-07-08T10:00:00.000Z",
|
|
updated_at: "2026-07-08T10:05:00.000Z",
|
|
},
|
|
],
|
|
}),
|
|
});
|
|
});
|
|
await page.route("**/api/cases/case_copy_1", async (route) => {
|
|
await route.fulfill({
|
|
status: 200,
|
|
contentType: "application/json",
|
|
body: JSON.stringify({
|
|
case: {
|
|
id: "case_copy_1",
|
|
case_type: "human_copy",
|
|
title: "人味文案优化:朋友圈",
|
|
summary: "原始文案摘要",
|
|
status: "optimized",
|
|
customer_name: "客户A",
|
|
brand_name: "品牌B",
|
|
project_tags: ["朋友圈"],
|
|
notes: "",
|
|
publish_target: "朋友圈",
|
|
source_excerpt: "原始文案摘要",
|
|
result_excerpt: "优化后文案摘要",
|
|
latest_result_version_id: "ver_copy_1",
|
|
latest_version_number: 1,
|
|
last_error_stage: null,
|
|
last_error_summary: null,
|
|
archived_at: null,
|
|
created_at: "2026-07-08T10:00:00.000Z",
|
|
updated_at: "2026-07-08T10:05:00.000Z",
|
|
},
|
|
input: {
|
|
case_id: "case_copy_1",
|
|
case_type: "human_copy",
|
|
article_job_id: null,
|
|
payload: {
|
|
source_text: "原始文案",
|
|
goal: "自然一点",
|
|
intensity: "light",
|
|
user_instructions: "",
|
|
publish_target: "朋友圈",
|
|
},
|
|
created_at: "2026-07-08T10:00:00.000Z",
|
|
updated_at: "2026-07-08T10:00:00.000Z",
|
|
},
|
|
versions: [
|
|
{
|
|
id: "ver_copy_1",
|
|
case_id: "case_copy_1",
|
|
case_type: "human_copy",
|
|
version: 1,
|
|
status: "optimized",
|
|
article_job_id: null,
|
|
article_revision: null,
|
|
result_summary: "优化后文案摘要",
|
|
payload: {
|
|
optimized_text: "优化后文案",
|
|
change_notes: [
|
|
{
|
|
original: "原始文案",
|
|
revised: "优化后文案",
|
|
reason: "减少书面腔。",
|
|
confidence: "confident",
|
|
revertible: false,
|
|
},
|
|
],
|
|
ai_taste_checks: [
|
|
{
|
|
rule_id: "promotion_tone",
|
|
status: "pass",
|
|
evidence: "没有新增宣传腔。",
|
|
suggestion: "",
|
|
},
|
|
],
|
|
warnings: [],
|
|
},
|
|
process_summary: [],
|
|
llm_audit_summary: [],
|
|
error_stage: null,
|
|
error_summary: null,
|
|
created_at: "2026-07-08T10:05:00.000Z",
|
|
},
|
|
],
|
|
}),
|
|
});
|
|
});
|
|
await page.route(
|
|
"**/api/cases/case_copy_1/versions/ver_copy_1/publications",
|
|
async (route) => {
|
|
await route.fulfill({
|
|
status: 200,
|
|
contentType: "application/json",
|
|
body: JSON.stringify({ publications: [] }),
|
|
});
|
|
},
|
|
);
|
|
|
|
await page.goto("/cases");
|
|
await expect(page.getByRole("heading", { name: "案例库" })).toBeVisible();
|
|
await expect(page.getByText("人味文案优化:朋友圈")).toBeVisible();
|
|
await page.getByRole("link", { name: "人味文案优化:朋友圈" }).click();
|
|
await expect(
|
|
page.locator(".copy-result").filter({ hasText: "优化后文案" }),
|
|
).toBeVisible();
|
|
await expect(page.getByText("AI 味检查")).toBeVisible();
|
|
await expect(page.getByText("发布表现")).toBeVisible();
|
|
});
|