fix(e2e): 精确匹配创建计划接口路径 + 增加错误调试日志 #668
@@ -220,11 +220,16 @@ test.describe("Core generation flow", () => {
|
||||
await expect(page.getByRole("heading", { name: /确认生成/ })).toBeVisible()
|
||||
|
||||
// Wait for plan creation API to be called
|
||||
// 精确匹配 POST /template-editors(创建接口),排除所有子路径(/generate, /clips, /ai-recommend 等)
|
||||
const createPlanPromise = page.waitForResponse(
|
||||
(response) =>
|
||||
response.url().includes("/template-editors") &&
|
||||
response.request().method() === "POST" &&
|
||||
!response.url().includes("/generate"),
|
||||
(response) => {
|
||||
const url = response.url()
|
||||
const path = new URL(url).pathname
|
||||
return (
|
||||
response.request().method() === "POST" &&
|
||||
(path.endsWith("/template-editors") || path.endsWith("/template-editors/"))
|
||||
)
|
||||
},
|
||||
{ timeout: 30_000 },
|
||||
)
|
||||
|
||||
@@ -233,6 +238,12 @@ test.describe("Core generation flow", () => {
|
||||
|
||||
// Verify plan was created successfully
|
||||
const planResp = await createPlanPromise
|
||||
if (!planResp.ok()) {
|
||||
const body = await planResp.text()
|
||||
console.error(
|
||||
`[E2E DEBUG] 创建计划接口失败: status=${planResp.status()} url=${planResp.url()} body=${body.slice(0, 500)}`,
|
||||
)
|
||||
}
|
||||
expect(planResp.ok()).toBeTruthy()
|
||||
const planData = (await planResp.json()) as { id: string }
|
||||
expect(planData.id).toBeTruthy()
|
||||
|
||||
Reference in New Issue
Block a user