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 { + // 无弹窗 — 已有身份 } // 导航到排课页面