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()