From e70777160fd31595d7928fe8afb6f7e078d55829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E7=94=B7?= Date: Sun, 3 May 2026 03:39:50 +0800 Subject: [PATCH] fix(clazz-e2e): increase role dialog wait in clazz-ui.spec.ts to 15s Same fix as e43b059: the 3-second waitForTimeout before checking the role selection dialog is insufficient in CI. Replaced with waitFor({ state: 'visible', timeout: 15_000 }). Co-Authored-By: Claude Opus 4.7 --- tests/clazz-ui.spec.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/clazz-ui.spec.ts b/tests/clazz-ui.spec.ts index 355eeab..7a1c794 100644 --- a/tests/clazz-ui.spec.ts +++ b/tests/clazz-ui.spec.ts @@ -32,11 +32,11 @@ test.describe('排课页面 UI', () => { const q = new URLSearchParams({ unionid: moicenUnionid, status: '2' }); await page.goto(`/?${q.toString()}`, { waitUntil: 'domcontentloaded', timeout: 60_000 }); await expect(page.locator('#app')).toBeVisible({ timeout: 60_000 }); - await page.waitForTimeout(3000); - // 选择身份(如果弹出) + // 等待身份选择弹窗(最多 15 秒) const rs = page.getByText('请选择您的登录身份'); - if (await rs.isVisible().catch(() => false)) { + try { + await rs.waitFor({ state: 'visible', timeout: 15_000 }); const items = page.locator('.van-grid-item'); const count = await items.count(); // items[0]=测试员, items[1]=学生, items[2]=教师 @@ -46,6 +46,8 @@ test.describe('排课页面 UI', () => { await items.first().click(); } await page.waitForTimeout(3000); + } catch { + // 无弹窗 — 已有身份 } // 导航到排课页面