From 3f27d199f53396aec48652813601a2136ab2ada2 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 16 Sep 2026 08:43:36 +0800 Subject: [PATCH] =?UTF-8?q?fix(e2e):=20=E5=8A=A0=E5=9B=BA=E6=A0=B8?= =?UTF-8?q?=E5=BF=83=E7=94=9F=E6=88=90=E5=90=91=E5=AF=BC=E5=86=92=E7=83=9F?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=EF=BC=88v2=EF=BC=9A=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D/=E7=AD=89=E5=BE=85/=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E9=A1=B5=E6=96=AD=E8=A8=80=EF=BC=89=20(#1950)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: xiaoxia Co-committed-by: xiaoxia --- apps/web/e2e/core-generation.spec.ts | 31 +++++++++++++++++----------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/apps/web/e2e/core-generation.spec.ts b/apps/web/e2e/core-generation.spec.ts index beabeaac2..48a198f40 100755 --- a/apps/web/e2e/core-generation.spec.ts +++ b/apps/web/e2e/core-generation.spec.ts @@ -51,7 +51,7 @@ type AssetListResponse = { test.describe("Core generation flow", () => { test.describe.configure({ timeout: 360_000 }) - test("walks through 5-step wizard and starts generation", async ({ page, request }) => { + test("walks through wizard with count modal and starts generation", async ({ page, request }) => { test.setTimeout(360_000) await routeBrowserApiToTestApi(page) @@ -215,19 +215,25 @@ test.describe("Core generation flow", () => { .waitFor({ state: "detached", timeout: 30_000 }) .catch(() => {}) - // Wait for generation API to be called - // 前端直接创建生成任务:POST /generation/tasks + // 定位底部操作栏的「✨ 确认生成视频」按钮(带 emoji 前缀,Playwright hasText 是子串匹配,无需写全) + // 使用底部操作栏 xx-step-actions 作用域,避免命中标题页内的"换一个""生成标题"等其他 primary 按钮 + const confirmBtn = page + .locator(".xx-step-actions .xx-btn-primary") + .filter({ hasText: "确认生成" }) + await expect(confirmBtn).toBeVisible({ timeout: 30_000 }) + await expect(confirmBtn).toBeEnabled({ timeout: 30_000 }) + + // Wait for generation API to be called — 先挂监听再点击,避免竞态 const generatePromise = page.waitForResponse( (response) => { const url = response.url() const path = new URL(url).pathname return response.request().method() === "POST" && path.endsWith("/generation/tasks") }, - { timeout: 30_000 }, + { timeout: 60_000 }, ) - // 点击「确认生成视频」 - await page.locator(".xx-btn-primary").filter({ hasText: "确认生成视频" }).first().click() + await confirmBtn.click() // Verify generation was triggered const genResp = await generatePromise @@ -247,16 +253,17 @@ test.describe("Core generation flow", () => { expect(genData.items.length).toBeGreaterThan(0) expect(genData.items[0].id).toBeTruthy() - // 单视频(N=1):点击「确认生成视频」后跳 Step 4「确认生成」,展示实时渲染进度 - await expect(page.getByRole("heading", { name: "🎬 确认生成" })).toBeVisible({ - timeout: 30_000, - }) + // 单视频(N=1):点击「确认生成视频」后跳步骤 4「确认生成」进度页,展示进度卡 + // 注意:Step4 内容只有进度卡/错误卡,没有 h3「🎬 确认生成」标题;标题由 StepsBar 展示 + await expect(page.getByText("视频渲染中")).toBeVisible({ timeout: 30_000 }) // 等待渲染完成:进度卡变为「视频生成完成」(最长等待 3 分钟) await expect(page.getByText("视频生成完成")).toBeVisible({ timeout: 180_000 }) - // 全部完成后「下一步:选择封面」解锁,点击进入 Step 5 - await page.getByRole("button", { name: /下一步:选择封面/ }).click() + // 全部完成后底部按钮变为「下一步:选择封面」,点击进入 Step 5 + const nextCoverBtn = page.getByRole("button", { name: /下一步:选择封面/ }) + await expect(nextCoverBtn).toBeVisible({ timeout: 30_000 }) + await nextCoverBtn.click() await expect(page.getByRole("heading", { name: /选择封面/ })).toBeVisible({ timeout: 30_000, })