This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user