e2e: enable clazz-ui FullCalendar test, fix department-single-transparent
- Un-skip clazz-ui FullCalendar test by adding login + role selection - Use subjectPayload.current_department_id (JWT sub claim) for dept assertion instead of top-level payload - Add explicit auth token waits and /clazz navigation for reliability - Remove unnecessary timeouts and debug logging Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+31
-2
@@ -1,5 +1,8 @@
|
||||
import { expect, test } from './fixtures';
|
||||
|
||||
const moicenUnionid = (process.env.MOICEN_E2E_UNIONID || 'o66lo5iK98xBI9pX-0RBqveqDryI').trim();
|
||||
const ROLE_TEACHER = 2;
|
||||
|
||||
test.describe('排课页面 UI', () => {
|
||||
test('排课日历页应正常加载(无JS崩溃)', async ({ page }) => {
|
||||
await page.goto('/clazz', { waitUntil: 'domcontentloaded', timeout: 60_000 });
|
||||
@@ -22,9 +25,35 @@ test.describe('排课页面 UI', () => {
|
||||
expect(errors.filter(e => !e.includes('ResizeObserver') && !e.includes('not implemented'))).toEqual([]);
|
||||
});
|
||||
|
||||
test.fixme('排课日历 FullCalendar 应初始化(需已登录)', async ({ page }) => {
|
||||
// FullCalendar 在已登录状态下应渲染
|
||||
test('排课日历 FullCalendar 应初始化(需已登录)', async ({ page }) => {
|
||||
test.setTimeout(120_000);
|
||||
|
||||
// 登录
|
||||
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);
|
||||
|
||||
// 选择身份(如果弹出)
|
||||
const rs = page.getByText('请选择您的登录身份');
|
||||
if (await rs.isVisible().catch(() => false)) {
|
||||
const items = page.locator('.van-grid-item');
|
||||
const count = await items.count();
|
||||
// items[0]=测试员, items[1]=学生, items[2]=教师
|
||||
if (count >= 3) {
|
||||
await items.nth(ROLE_TEACHER).click();
|
||||
} else {
|
||||
await items.first().click();
|
||||
}
|
||||
await page.waitForTimeout(3000);
|
||||
}
|
||||
|
||||
// 导航到排课页面
|
||||
await page.goto('/clazz', { waitUntil: 'domcontentloaded', timeout: 60_000 });
|
||||
await expect(page.locator('#app')).toBeVisible({ timeout: 60_000 });
|
||||
await page.waitForTimeout(5000);
|
||||
|
||||
// FullCalendar 应渲染
|
||||
await expect(page.locator('.fc')).toBeVisible({ timeout: 30_000 });
|
||||
await expect(page.locator('.fc-timegrid')).toBeVisible({ timeout: 30_000 });
|
||||
await expect(page.locator('.fc-toolbar')).toBeVisible({ timeout: 15_000 });
|
||||
|
||||
Reference in New Issue
Block a user