fix(video): preserve transcript seek timestamps

This commit is contained in:
yiling
2026-12-03 15:25:28 +08:00
parent 3952928b88
commit 5daa2a8f92
9 changed files with 262 additions and 44 deletions
@@ -32,6 +32,7 @@ test('reads, searches and follows a saved transcript in the video player', async
text: `Intervening segment ${index + 1}`,
})),
{ position: 29, startMs: 720, endMs: 980, text: 'Final signal.' },
{ position: 30, startMs: 995, endMs: 1000, text: 'Closing word.' },
],
},
},
@@ -122,6 +123,19 @@ test('reads, searches and follows a saved transcript in the video player', async
await expect(last).toHaveAttribute('aria-current', 'true')
await expect(video).toHaveJSProperty('paused', true)
const closingWord = panel.getByRole('button', { name: /Closing word\./ })
await closingWord.click()
await expect
.poll(() =>
video.evaluate((element) => {
const media = element as HTMLVideoElement
return { seeking: media.seeking, timeMs: Math.round(media.currentTime * 1000) }
}),
)
.toEqual({ seeking: false, timeMs: 995 })
await expect(closingWord).toHaveAttribute('aria-current', 'true')
await expect(video).toHaveJSProperty('paused', true)
await panel.getByRole('combobox', { name: 'Language' }).selectOption('zh')
await expect(panel.getByText('你好。')).toBeVisible()
await expect(last).toHaveCount(0)