讲解对象页改为单列列表并补充移动端验证
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-17 23:02:09 +08:00
parent d8e5a84f02
commit 72d1f30c89
3 changed files with 220 additions and 0 deletions

View File

@@ -5,6 +5,9 @@ const stops = Array.from({ length: 21 }, (_, index) => ({
name: `讲解对象${index + 1}`,
imageStatus: index === 0 ? 'READY' : 'MISSING',
coverImageUrl: index === 0 ? '/one.jpg' : undefined,
audioStatus: index === 0 ? 'READY' : 'MISSING',
hasAudio: index === 0,
hasTextRecord: index !== 0,
playTargetType: 'STOP' as const,
playTargetId: `target-${index + 1}`
}))
@@ -30,6 +33,37 @@ test('hall goes directly to paged guide objects without outline requests', async
await page.getByText('恐龙厅', { exact: true }).click()
await expect(page).toHaveURL(/guide-stop-list\?hallId=hall-1/)
await expect(page.getByText('讲解对象1', { exact: true })).toBeVisible()
const cards = page.locator('.stop-card')
await expect(cards).toHaveCount(20)
for (const width of [375, 390, 430]) {
await page.setViewportSize({ width, height: 844 })
const layout = await page.locator('.stop-list').evaluate((list) => {
const cards = Array.from(list.querySelectorAll<HTMLElement>('.stop-card'))
const listRect = list.getBoundingClientRect()
const firstRect = cards[0].getBoundingClientRect()
const secondRect = cards[1].getBoundingClientRect()
return {
clientWidth: list.clientWidth,
scrollWidth: list.scrollWidth,
listWidth: listRect.width,
first: { x: firstRect.x, width: firstRect.width, bottom: firstRect.bottom },
second: { x: secondRect.x, y: secondRect.y }
}
})
expect(layout.scrollWidth).toBeLessThanOrEqual(layout.clientWidth)
expect(layout.first.x).toBeCloseTo(layout.second.x, 0)
expect(layout.first.width).toBeCloseTo(layout.listWidth, 0)
expect(layout.second.y).toBeGreaterThan(layout.first.bottom)
}
const search = page.getByRole('textbox')
await search.fill('讲解对象21')
await expect(page.getByText('讲解对象21', { exact: true })).toBeVisible()
await search.fill('')
const audioFilter = page.getByText('有音频', { exact: true })
await audioFilter.click()
await expect(page.getByText('讲解对象1', { exact: true })).toBeVisible()
await expect(page.getByText('讲解对象2', { exact: true })).not.toBeVisible()
await page.getByText('全部', { exact: true }).click()
await page.locator('.explain-scroll').hover()
await page.mouse.wheel(0, 10000)
await expect(page.getByText('讲解对象21', { exact: true })).toBeVisible()