This commit is contained in:
@@ -60,7 +60,13 @@ interface VisualStabilityApi {
|
||||
getFloors: () => FloorReport[]
|
||||
switchFloor: (floorId: string) => Promise<void>
|
||||
showOverview: () => Promise<void>
|
||||
resetToViewBaseline: (options: {
|
||||
view: 'overview' | 'floor'
|
||||
floorId?: string
|
||||
reason: 'poi-detail-close' | 'manual-reset' | 'floor-reset'
|
||||
}) => Promise<boolean>
|
||||
resetToInitialState: () => Promise<boolean>
|
||||
getFloorBaseline: (floorId: string) => CameraReport | null
|
||||
getFloorPois: (floorId: string) => Promise<PoiFocusCandidate[]>
|
||||
focusTargetPoi: (request: {
|
||||
requestId: number | string
|
||||
@@ -432,3 +438,34 @@ test('reset invalidates an in-flight cross-floor focus before it can overwrite t
|
||||
expect(report.hasPendingTargetFocus).toBe(false)
|
||||
expect(report.focus).toBeNull()
|
||||
})
|
||||
|
||||
test('floor view baseline is deterministic across repeated resets', async ({ page }) => {
|
||||
await page.goto('/')
|
||||
await Promise.all([
|
||||
page.waitForURL(/tab=guide/, { timeout: 30_000 }),
|
||||
page.getByText('馆内', { exact: true }).click()
|
||||
])
|
||||
await expect.poll(async () => (await getApiState(page))?.floors.length ?? 0, { timeout: 180_000 }).toBeGreaterThan(0)
|
||||
const state = await getApiState(page)
|
||||
expect(state).not.toBeNull()
|
||||
|
||||
for (const floor of state!.floors) {
|
||||
await page.evaluate(async (floorId) => {
|
||||
const api = (window as Window & { __GUIDE_3D_VISUAL_STABILITY__?: VisualStabilityApi })
|
||||
.__GUIDE_3D_VISUAL_STABILITY__
|
||||
if (!api) throw new Error('ThreeMap visual stability diagnostics unavailable')
|
||||
await api.resetToViewBaseline({ view: 'floor', floorId, reason: 'floor-reset' })
|
||||
}, floor.floorId)
|
||||
const first = await getReport(page)
|
||||
await page.evaluate(async (floorId) => {
|
||||
const api = (window as Window & { __GUIDE_3D_VISUAL_STABILITY__?: VisualStabilityApi })
|
||||
.__GUIDE_3D_VISUAL_STABILITY__
|
||||
if (!api) throw new Error('ThreeMap visual stability diagnostics unavailable')
|
||||
await api.resetToViewBaseline({ view: 'floor', floorId, reason: 'floor-reset' })
|
||||
}, floor.floorId)
|
||||
const second = await getReport(page)
|
||||
expect(second.activeView).toBe('floor')
|
||||
expect(second.floorId).toBe(floor.floorId)
|
||||
expect(getMaximumCameraDelta(first.camera, second.camera)).toBeLessThan(1e-6)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user