test: add clazz UI and audit log E2E tests
- Add clazz calendar page load tests - Add audit log API reachability test Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import { expect, test } from './fixtures';
|
||||
|
||||
test.describe('排课页面 UI', () => {
|
||||
test('排课日历页应正常加载(无JS崩溃)', async ({ page }) => {
|
||||
await page.goto('/clazz', { waitUntil: 'domcontentloaded', timeout: 60_000 });
|
||||
await expect(page.locator('#app')).toBeVisible({ timeout: 60_000 });
|
||||
// FullCalendar 应初始化
|
||||
await expect(page.locator('.fc')).toBeVisible({ timeout: 30_000 });
|
||||
});
|
||||
|
||||
test('排课日历无报错', async ({ page }) => {
|
||||
const errors: string[] = [];
|
||||
page.on('pageerror', (err) => errors.push(err.message));
|
||||
|
||||
await page.goto('/clazz', { waitUntil: 'domcontentloaded', timeout: 60_000 });
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// 不应有 JS 运行时错误
|
||||
expect(errors.filter(e => !e.includes('ResizeObserver') && !e.includes('not implemented'))).toEqual([]);
|
||||
});
|
||||
|
||||
test('排课日历初始化后应显示基本骨架', async ({ page }) => {
|
||||
await page.goto('/clazz', { waitUntil: 'domcontentloaded', timeout: 60_000 });
|
||||
await expect(page.locator('#app')).toBeVisible({ timeout: 60_000 });
|
||||
|
||||
// FullCalendar 应有视图容器 (timeGridWeek)
|
||||
await expect(page.locator('.fc-timegrid')).toBeVisible({ timeout: 30_000 });
|
||||
// 应有表头
|
||||
await expect(page.locator('.fc-toolbar')).toBeVisible({ timeout: 15_000 });
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('审计日志 API', () => {
|
||||
test('审计日志列表API应返回200', async ({ request }) => {
|
||||
const resp = await request.get('/api/v1/clazz/audit-log/list?clazz_id=nonexistent');
|
||||
// 未带有效 auth 应返回 401 或 400, 但不应 500
|
||||
expect([400, 401, 403]).toContain(resp.status());
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user