fix(e2e): 机构选择页用 .main h4 定位,避免 CI 上 getByText 失配
Made-with: Cursor
This commit is contained in:
@@ -209,16 +209,23 @@ test.describe('多机构数据隔离(会话与 token)', () => {
|
||||
await resolveOrgContextForCoursePage(page);
|
||||
|
||||
await page.goto('/org/select', {
|
||||
waitUntil: 'domcontentloaded',
|
||||
timeout: 60_000,
|
||||
waitUntil: 'load',
|
||||
timeout: 90_000,
|
||||
});
|
||||
await expect(page.locator('#app')).toBeVisible({ timeout: 60_000 });
|
||||
await page.waitForURL(/\/org\/select/, { timeout: 60_000 });
|
||||
await expect(page.getByText(/请选择机构|选择机构/)).toBeVisible({
|
||||
timeout: 60_000,
|
||||
await expect(page.locator('#app')).toBeVisible({ timeout: 90_000 });
|
||||
await page.waitForURL(/\/org\/select/, { timeout: 90_000 });
|
||||
// 与 `org/select.vue` 根节点一致;避免 getByText 在 Vant/拆行下偶发匹配不到
|
||||
await expect(page.locator('.main')).toBeVisible({ timeout: 90_000 });
|
||||
if (
|
||||
await page.getByText('暂无可用机构').isVisible().catch(() => false)
|
||||
) {
|
||||
test.skip(true, '机构接口无数据,跳过多机构切换断言');
|
||||
}
|
||||
await expect(page.locator('.main h4')).toContainText(/请选择机构/, {
|
||||
timeout: 90_000,
|
||||
});
|
||||
|
||||
const orgCells = page.locator('#app .van-cell-group .van-cell');
|
||||
const orgCells = page.locator('.main .van-cell-group .van-cell');
|
||||
const count = await orgCells.count();
|
||||
test.skip(
|
||||
count < 2,
|
||||
|
||||
Reference in New Issue
Block a user