e2e: update tests for weekly-timetable grid layout (days × slots)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-02 09:17:34 +08:00
parent b16556ca63
commit ef7674cede
+22 -15
View File
@@ -44,7 +44,7 @@ test.describe('排课双视图切换(阿难账号)', () => {
await expect(calBtn).toHaveClass(/van-button--primary/); await expect(calBtn).toHaveClass(/van-button--primary/);
}); });
test('切换到矩阵视图后显示时段和日期', async ({ page }) => { test('切换到矩阵视图后显示时段和日期', async ({ page }) => {
await loginAsTeacher(page); await loginAsTeacher(page);
await page.goto('/clazz', { waitUntil: 'domcontentloaded', timeout: 60_000 }); await page.goto('/clazz', { waitUntil: 'domcontentloaded', timeout: 60_000 });
await expect(page.locator('#app')).toBeVisible({ timeout: 60_000 }); await expect(page.locator('#app')).toBeVisible({ timeout: 60_000 });
@@ -59,18 +59,26 @@ test.describe('排课双视图切换(阿难账号)', () => {
const matrixContainer = page.locator('.matrix-container'); const matrixContainer = page.locator('.matrix-container');
await expect(matrixContainer).toBeVisible({ timeout: 10_000 }); await expect(matrixContainer).toBeVisible({ timeout: 10_000 });
// Should show header with date+time columns // Header should show time slot labels (第一节 ~ 第四节)
const header = page.locator('.matrix-header'); const headerCells = page.locator('.header-cell');
await expect(header).toBeVisible(); await expect(headerCells.first()).toBeVisible();
const count = await headerCells.count();
await expect(count).toBeGreaterThanOrEqual(4);
// Should have at least one header column // Each header cell should have slot label + time
const headerCols = header.locator('.header-col'); const firstHeader = headerCells.first();
expect(await headerCols.count()).toBeGreaterThanOrEqual(1); await expect(firstHeader.locator('.header-label')).toBeVisible();
await expect(firstHeader.locator('.header-time')).toBeVisible();
// Each header column should have date and time labels // Day sidebar should show weekday labels (周一 ~ 周日)
const firstCol = headerCols.first(); const dayCells = page.locator('.day-cell');
await expect(firstCol.locator('.header-date')).toBeVisible(); await expect(dayCells.first()).toBeVisible();
await expect(firstCol.locator('.header-time')).toBeVisible(); expect(await dayCells.count()).toBe(7);
// Each day cell should have day name + date
const firstDay = dayCells.first();
await expect(firstDay.locator('.day-name')).toBeVisible();
await expect(firstDay.locator('.day-date')).toBeVisible();
}); });
test('矩阵视图导航栏可操作(上一周/本周/下一周)', async ({ page }) => { test('矩阵视图导航栏可操作(上一周/本周/下一周)', async ({ page }) => {
@@ -106,8 +114,8 @@ test.describe('排课双视图切换(阿难账号)', () => {
await page.locator('.view-toolbar button', { hasText: '矩阵' }).click(); await page.locator('.view-toolbar button', { hasText: '矩阵' }).click();
await page.waitForTimeout(1500); await page.waitForTimeout(1500);
// Check event blocks exist in the body // Check event blocks exist in the grid
const eventBlocks = page.locator('.matrix-body .event-block'); const eventBlocks = page.locator('.event-block');
const count = await eventBlocks.count(); const count = await eventBlocks.count();
if (count === 0) { if (count === 0) {
@@ -115,7 +123,7 @@ test.describe('排课双视图切换(阿难账号)', () => {
return; return;
} }
// First block should show info // First block should show course name
const first = eventBlocks.first(); const first = eventBlocks.first();
await expect(first.locator('.ev-title')).toBeVisible(); await expect(first.locator('.ev-title')).toBeVisible();
@@ -144,7 +152,6 @@ test.describe('排课双视图切换(阿难账号)', () => {
await page.waitForTimeout(1500); await page.waitForTimeout(1500);
// Calendar (FullCalendar) should be visible // Calendar (FullCalendar) should be visible
const calendarView = page.locator('.calendar.fc'); // FullCalendar root
await expect(page.locator('.fc')).toBeVisible({ timeout: 10_000 }); await expect(page.locator('.fc')).toBeVisible({ timeout: 10_000 });
}); });
}); });