This commit is contained in:
54
tests/e2e/route-detail-cross-floor.spec.ts
Normal file
54
tests/e2e/route-detail-cross-floor.spec.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import { expect, test } from '@playwright/test'
|
||||
|
||||
interface GuidePerformanceApi {
|
||||
summary: () => {
|
||||
operations: Array<{
|
||||
kind: string
|
||||
name: string
|
||||
count: number
|
||||
successCount: number
|
||||
failureCount: number
|
||||
p50Ms?: number
|
||||
p95Ms?: number
|
||||
maxMs?: number
|
||||
}>
|
||||
}
|
||||
}
|
||||
|
||||
test('plans a cross-floor route from the route detail start-floor picker', async ({ page }) => {
|
||||
test.setTimeout(240_000)
|
||||
await page.goto('/#/pages/route/detail?facilityId=5515&target=%E6%AF%8D%E5%A9%B4%E5%AE%A4')
|
||||
|
||||
await expect(page.locator('.indoor-guide-card')).toBeVisible({ timeout: 180_000 })
|
||||
await expect(page.locator('.start-point-select')).toBeVisible({ timeout: 30_000 })
|
||||
await page.locator('.start-point-select').click()
|
||||
await expect(page.locator('.route-point-picker')).toBeVisible({ timeout: 30_000 })
|
||||
|
||||
const firstFloor = page.locator('.picker-floor-option').filter({ hasText: '1F' }).first()
|
||||
await expect(firstFloor).toBeVisible({ timeout: 30_000 })
|
||||
await firstFloor.click()
|
||||
const startOption = page.locator('.point-column .picker-option').first()
|
||||
await expect(startOption).toBeVisible({ timeout: 30_000 })
|
||||
const startText = await startOption.locator('.option-meta').innerText()
|
||||
expect(startText).toContain('1F')
|
||||
await startOption.click()
|
||||
|
||||
await expect(page.locator('.route-point-picker')).toBeHidden({ timeout: 30_000 })
|
||||
await expect(page.locator('.start-point-select-value')).toContainText('1F')
|
||||
await page.getByText('查看位置关系', { exact: true }).click()
|
||||
|
||||
await expect(page.locator('.indoor-guide-desc')).toContainText('已生成', { timeout: 120_000 })
|
||||
const performance = await page.evaluate(() => (
|
||||
(window as Window & { __SGS_GUIDE_PERFORMANCE__?: GuidePerformanceApi })
|
||||
.__SGS_GUIDE_PERFORMANCE__?.summary()
|
||||
))
|
||||
const routePlan = performance?.operations.find((operation) => (
|
||||
operation.kind === 'interaction' && operation.name === 'route-plan'
|
||||
))
|
||||
expect(routePlan, 'cross-floor route-plan performance record is required').toMatchObject({
|
||||
count: 1,
|
||||
successCount: 1,
|
||||
failureCount: 0
|
||||
})
|
||||
console.log(`[cross-floor-route-performance] ${JSON.stringify(routePlan)}`)
|
||||
})
|
||||
Reference in New Issue
Block a user