- 详情页路由入参统一为 stopId,废弃 targetType/targetId - ExplainDetailEntryRequest 与 GlobalAudioSource 移除 targetType/targetId 字段 - 播放器源匹配仅按 stopId 判定,移除 targetType 兜底 - 删除 explainDetailTarget 死代码 - 清理 guideStopInfoAdapter 中 stop/info、play-info、text-info 旧契约类型与转换函数 - 补充测试服务器 Nginx SSL 部署手册 - 同步更新单测与 e2e 用例 Made-with: Proma
This commit is contained in:
@@ -61,7 +61,7 @@ test('hall goes directly to paged guide objects without outline requests', async
|
||||
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/)
|
||||
await expect(page).toHaveURL(/pages\/exhibit\/detail\?.*stopId=stop-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'])
|
||||
})
|
||||
|
||||
@@ -150,7 +150,7 @@ describe('讲解详情音频优先布局', () => {
|
||||
global: { stubs: { GuidePageFrame: GuidePageFrameStub } }
|
||||
})
|
||||
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'en-US', targetType: 'STOP', targetId: 'stop-1' })
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'en-US', stopId: 'stop-1' })
|
||||
await flushPromises()
|
||||
|
||||
expect(wrapper.get('.detail-title').text()).toBe('Classical Astrolabe')
|
||||
@@ -174,7 +174,7 @@ describe('讲解详情音频优先布局', () => {
|
||||
global: { stubs: { GuidePageFrame: GuidePageFrameStub } }
|
||||
})
|
||||
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, targetType: 'STOP', targetId: 'stop-1' })
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, stopId: 'stop-1' })
|
||||
await flushPromises()
|
||||
|
||||
const state = wrapper.get('[data-testid="exhibit-detail-state"]')
|
||||
@@ -197,7 +197,7 @@ describe('讲解详情音频优先布局', () => {
|
||||
global: { stubs: { GuidePageFrame: GuidePageFrameStub } }
|
||||
})
|
||||
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'zh-CN', targetType: 'STOP', targetId: 'stop-1' })
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'zh-CN', stopId: 'stop-1' })
|
||||
await flushPromises()
|
||||
|
||||
const labels = wrapper.findAll('.language-option-text').map((node) => node.text())
|
||||
@@ -214,7 +214,7 @@ describe('讲解详情音频优先布局', () => {
|
||||
global: { stubs: { GuidePageFrame: GuidePageFrameStub } }
|
||||
})
|
||||
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'zh-CN', targetType: 'STOP', targetId: 'stop-1' })
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'zh-CN', stopId: 'stop-1' })
|
||||
await flushPromises()
|
||||
|
||||
expect(wrapper.find('.detail-language-bar').exists()).toBe(false)
|
||||
@@ -231,7 +231,7 @@ describe('讲解详情音频优先布局', () => {
|
||||
global: { stubs: { GuidePageFrame: GuidePageFrameStub } }
|
||||
})
|
||||
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'en-US', targetType: 'STOP', targetId: 'stop-1' })
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'en-US', stopId: 'stop-1' })
|
||||
await flushPromises()
|
||||
|
||||
expect(mocks.enterExplainDetail).toHaveBeenNthCalledWith(1, expect.objectContaining({ lang: 'en-US' }))
|
||||
@@ -246,7 +246,7 @@ describe('讲解详情音频优先布局', () => {
|
||||
global: { stubs: { GuidePageFrame: GuidePageFrameStub } }
|
||||
})
|
||||
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'en-US', targetType: 'STOP', targetId: 'stop-1' })
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'en-US', stopId: 'stop-1' })
|
||||
await flushPromises()
|
||||
await wrapper.get('.detail-audio-play').trigger('tap')
|
||||
|
||||
@@ -258,13 +258,13 @@ describe('讲解详情音频优先布局', () => {
|
||||
|
||||
it('加载中使用同一高度底栏和不确定进度', async () => {
|
||||
audioState.currentAudio.value = { id: 'audio-1' }
|
||||
audioState.currentSource.value = { targetType: 'STOP', targetId: 'stop-1', lang: 'en-US' }
|
||||
audioState.currentSource.value = { stopId: 'stop-1', lang: 'en-US' }
|
||||
audioState.loading.value = true
|
||||
const wrapper = mount(ExhibitDetail, {
|
||||
global: { stubs: { GuidePageFrame: GuidePageFrameStub } }
|
||||
})
|
||||
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'en-US', targetType: 'STOP', targetId: 'stop-1' })
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'en-US', stopId: 'stop-1' })
|
||||
await flushPromises()
|
||||
|
||||
expect(wrapper.get('.detail-audio-dock').classes()).toContain('is-loading')
|
||||
@@ -287,7 +287,7 @@ describe('讲解详情音频优先布局', () => {
|
||||
global: { stubs: { GuidePageFrame: GuidePageFrameStub } }
|
||||
})
|
||||
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'yue-HK', targetType: 'STOP', targetId: 'stop-1' })
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'yue-HK', stopId: 'stop-1' })
|
||||
await flushPromises()
|
||||
|
||||
expect(wrapper.get('.detail-audio-dock').classes()).toContain('is-unavailable')
|
||||
@@ -297,7 +297,7 @@ describe('讲解详情音频优先布局', () => {
|
||||
|
||||
it('播放失败显示错误并从当前详情音轨重试', async () => {
|
||||
audioState.currentAudio.value = { id: 'audio-1', audioUrl: exhibit.audioUrl }
|
||||
audioState.currentSource.value = { targetType: 'STOP', targetId: 'stop-1', lang: 'en-US' }
|
||||
audioState.currentSource.value = { stopId: 'stop-1', lang: 'en-US' }
|
||||
audioState.error.value = '音频暂时无法播放'
|
||||
mocks.selectAudioForExplainDetail.mockResolvedValue({
|
||||
playable: true,
|
||||
@@ -309,7 +309,7 @@ describe('讲解详情音频优先布局', () => {
|
||||
global: { stubs: { GuidePageFrame: GuidePageFrameStub } }
|
||||
})
|
||||
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'en-US', targetType: 'STOP', targetId: 'stop-1' })
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'en-US', stopId: 'stop-1' })
|
||||
await flushPromises()
|
||||
expect(wrapper.get('.detail-audio-dock').classes()).toContain('is-failed')
|
||||
expect(wrapper.find('.detail-audio-retry').exists()).toBe(false)
|
||||
@@ -348,7 +348,7 @@ describe('讲解详情音频优先布局', () => {
|
||||
global: { stubs: { GuidePageFrame: GuidePageFrameStub } }
|
||||
})
|
||||
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'en-US', targetType: 'STOP', targetId: 'stop-1' })
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'en-US', stopId: 'stop-1' })
|
||||
await flushPromises()
|
||||
|
||||
expect(wrapper.get('.detail-audio-speed').text()).toBe('1.0')
|
||||
@@ -380,12 +380,12 @@ describe('讲解详情音频优先布局', () => {
|
||||
|
||||
it('离开详情页时立即关闭当前讲解播放器', async () => {
|
||||
audioState.currentAudio.value = { id: 'audio-1', audioUrl: exhibit.audioUrl }
|
||||
audioState.currentSource.value = { targetType: 'STOP', targetId: 'stop-1', lang: 'en-US' }
|
||||
audioState.currentSource.value = { stopId: 'stop-1', lang: 'en-US' }
|
||||
const wrapper = mount(ExhibitDetail, {
|
||||
global: { stubs: { GuidePageFrame: GuidePageFrameStub } }
|
||||
})
|
||||
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'en-US', targetType: 'STOP', targetId: 'stop-1' })
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, lang: 'en-US', stopId: 'stop-1' })
|
||||
await flushPromises()
|
||||
|
||||
mocks.onHideHandler?.()
|
||||
@@ -403,8 +403,7 @@ describe('讲解详情音频优先布局', () => {
|
||||
await mocks.onLoadHandler?.({
|
||||
id: exhibit.id,
|
||||
lang: 'en-US',
|
||||
targetType: 'STOP',
|
||||
targetId: 'stop-1',
|
||||
stopId: 'stop-1',
|
||||
hallId: 'hall-1',
|
||||
hallName: '%2525E6%252581%252590%2525E9%2525BE%252599%2525E5%25258E%252585'
|
||||
})
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
toGuideStopInfo
|
||||
} from '@/data/adapters/guideStopInfoAdapter'
|
||||
import {
|
||||
canToggleGuideAudioGender,
|
||||
GUIDE_AUDIO_LANGUAGE_OPTIONS,
|
||||
@@ -46,36 +43,6 @@ const audioOptions: MuseumGuideAudioOption[] = [
|
||||
]
|
||||
|
||||
describe('guide audio options', () => {
|
||||
it('parses directly playable audio options from stop-info', () => {
|
||||
const stopInfo = toGuideStopInfo({
|
||||
available: true,
|
||||
targetType: 'STOP',
|
||||
targetId: '100',
|
||||
lang: 'zh-CN',
|
||||
title: '测试讲解',
|
||||
audioStatus: 'READY',
|
||||
audioOptionCount: 5,
|
||||
audioOptions: audioOptions.map((option) => ({
|
||||
...option,
|
||||
duration: 120
|
||||
}))
|
||||
}, {
|
||||
targetType: 'STOP',
|
||||
targetId: '100',
|
||||
lang: 'zh-CN'
|
||||
})
|
||||
|
||||
expect(stopInfo.audioOptions).toHaveLength(5)
|
||||
expect(stopInfo.audioOptions[1]).toMatchObject({
|
||||
channelCode: 'standard.zh-CN.male',
|
||||
languageCode: 'zh-CN',
|
||||
gender: 'male',
|
||||
playUrl: '/audio/zh-male.mp3',
|
||||
duration: 120
|
||||
})
|
||||
expect(stopInfo.supportedLanguages).toEqual(['zh-CN', 'en-US', 'yue-HK'])
|
||||
})
|
||||
|
||||
it('keeps tabs in Chinese, English, Cantonese order and defaults Chinese and English to male', () => {
|
||||
expect(GUIDE_AUDIO_LANGUAGE_OPTIONS.map((option) => option.value)).toEqual([
|
||||
'zh-CN',
|
||||
|
||||
Reference in New Issue
Block a user