From e8587576c76092f5e02a58dc8b724570b80b55a6 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 21 Jul 2026 07:45:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(e2e):=20=E7=B2=BE=E7=A1=AE=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=E5=88=9B=E5=BB=BA=E8=AE=A1=E5=88=92=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=B7=AF=E5=BE=84+=E5=8A=A0=E9=94=99=E8=AF=AF=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 将 waitForResponse 从模糊匹配 /template-editors 改为精确匹配路径末尾 避免匹配到 POST /template-editors/{id}/clips 等其他 POST 接口 2. 接口失败时打印 status/url/body 方便排查 --- apps/web/e2e/core-generation.spec.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/apps/web/e2e/core-generation.spec.ts b/apps/web/e2e/core-generation.spec.ts index f206a7255..c86a54a0f 100755 --- a/apps/web/e2e/core-generation.spec.ts +++ b/apps/web/e2e/core-generation.spec.ts @@ -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() -- 2.54.0