import { expect, test } from '@playwright/test' const stops = Array.from({ length: 21 }, (_, index) => ({ stopId: `stop-${index + 1}`, name: `讲解对象${index + 1}`, imageStatus: index === 0 ? 'READY' : 'MISSING', coverImageUrl: index === 0 ? '/one.jpg' : undefined, playTargetType: 'STOP' as const, playTargetId: `target-${index + 1}` })) test('hall goes directly to paged guide objects without outline requests', async ({ page }) => { const requests: string[] = [] await page.route('**/app-api/gis/guide/catalog/**', async (route) => { const url = route.request().url() requests.push(url) if (url.includes('/catalog/halls?')) { await route.fulfill({ json: { code: 0, data: [{ id: 'hall-1', name: '恐龙厅', floorId: 'L1', stopCount: 21 }] } }) return } if (url.includes('/halls/hall-1/stops/page')) { const pageNo = new URL(url).searchParams.get('pageNo') await route.fulfill({ json: { code: 0, data: { total: 21, list: pageNo === '1' ? stops.slice(0, 20) : stops.slice(20) } } }) return } await route.fulfill({ status: 404, json: { code: 404, msg: 'unexpected request' } }) }) await page.goto('/#/pages/explain/list') await page.getByText('恐龙厅', { exact: true }).click() await expect(page).toHaveURL(/guide-stop-list\?hallId=hall-1/) await expect(page.getByText('讲解对象1', { exact: true })).toBeVisible() await page.locator('.explain-scroll').hover() await page.mouse.wheel(0, 10000) await expect(page.getByText('讲解对象21', { exact: true })).toBeVisible() await page.getByText('讲解对象1', { exact: true }).click() await expect(page).toHaveURL(/pages\/exhibit\/detail\?.*targetType=STOP.*targetId=target-1/) expect(requests.some((url) => url.includes('/outlines'))).toBe(false) expect(requests.filter((url) => url.includes('/stops/page')).map((url) => new URL(url).searchParams.get('pageNo'))).toEqual(['1', '2']) })