From ef7674cede45fc1a5b625e743af6d2462bc108d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E7=94=B7?= Date: Sat, 2 May 2026 09:17:34 +0800 Subject: [PATCH] =?UTF-8?q?e2e:=20update=20tests=20for=20weekly-timetable?= =?UTF-8?q?=20grid=20layout=20(days=20=C3=97=20slots)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- tests/clazz-dual-view.spec.ts | 37 +++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/tests/clazz-dual-view.spec.ts b/tests/clazz-dual-view.spec.ts index 77a058c..12712d8 100644 --- a/tests/clazz-dual-view.spec.ts +++ b/tests/clazz-dual-view.spec.ts @@ -44,7 +44,7 @@ test.describe('排课双视图切换(阿难账号)', () => { await expect(calBtn).toHaveClass(/van-button--primary/); }); - test('切换到矩阵视图后显示时段和日期列', async ({ page }) => { + test('切换到矩阵视图后显示时段列和日期行', async ({ page }) => { await loginAsTeacher(page); await page.goto('/clazz', { waitUntil: 'domcontentloaded', timeout: 60_000 }); await expect(page.locator('#app')).toBeVisible({ timeout: 60_000 }); @@ -59,18 +59,26 @@ test.describe('排课双视图切换(阿难账号)', () => { const matrixContainer = page.locator('.matrix-container'); await expect(matrixContainer).toBeVisible({ timeout: 10_000 }); - // Should show header with date+time columns - const header = page.locator('.matrix-header'); - await expect(header).toBeVisible(); + // Header should show time slot labels (第一节 ~ 第四节) + const headerCells = page.locator('.header-cell'); + await expect(headerCells.first()).toBeVisible(); + const count = await headerCells.count(); + await expect(count).toBeGreaterThanOrEqual(4); - // Should have at least one header column - const headerCols = header.locator('.header-col'); - expect(await headerCols.count()).toBeGreaterThanOrEqual(1); + // Each header cell should have slot label + time + const firstHeader = headerCells.first(); + await expect(firstHeader.locator('.header-label')).toBeVisible(); + await expect(firstHeader.locator('.header-time')).toBeVisible(); - // Each header column should have date and time labels - const firstCol = headerCols.first(); - await expect(firstCol.locator('.header-date')).toBeVisible(); - await expect(firstCol.locator('.header-time')).toBeVisible(); + // Day sidebar should show weekday labels (周一 ~ 周日) + const dayCells = page.locator('.day-cell'); + await expect(dayCells.first()).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 }) => { @@ -106,8 +114,8 @@ test.describe('排课双视图切换(阿难账号)', () => { await page.locator('.view-toolbar button', { hasText: '矩阵' }).click(); await page.waitForTimeout(1500); - // Check event blocks exist in the body - const eventBlocks = page.locator('.matrix-body .event-block'); + // Check event blocks exist in the grid + const eventBlocks = page.locator('.event-block'); const count = await eventBlocks.count(); if (count === 0) { @@ -115,7 +123,7 @@ test.describe('排课双视图切换(阿难账号)', () => { return; } - // First block should show info + // First block should show course name const first = eventBlocks.first(); await expect(first.locator('.ev-title')).toBeVisible(); @@ -144,7 +152,6 @@ test.describe('排课双视图切换(阿难账号)', () => { await page.waitForTimeout(1500); // Calendar (FullCalendar) should be visible - const calendarView = page.locator('.calendar.fc'); // FullCalendar root await expect(page.locator('.fc')).toBeVisible({ timeout: 10_000 }); }); });