mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-03 14:34:40 +00:00
fix(video): animate transcript playback scrolling
This commit is contained in:
@@ -121,7 +121,7 @@ apps/web/e2e/
|
||||
| Upload a txt file, wait for transcode, and create a comment with draw | `tests/file/txt-draw-comment.spec.ts` |
|
||||
| Upload an image file, wait for transcode, and create a comment with draw | `tests/file/image-draw-comment.spec.ts` |
|
||||
| Upload a video file, wait for transcode, and create a comment with draw at a non-zero timestamp | `tests/file/video-draw-comment.spec.ts` |
|
||||
| Read and search saved video transcripts, resize the desktop panel, jump to a segment, check early playback scrolling and resume sync, and verify mobile and version-stack behavior | `tests/file/view-transcript.spec.ts` |
|
||||
| Read and search saved video transcripts, resize the desktop panel, jump to a segment, verify smooth playback following and interruption, and check mobile and version-stack behavior | `tests/file/view-transcript.spec.ts` |
|
||||
| Upload an audio file, wait for transcode, and create a comment at a non-zero timestamp | `tests/file/audio-timestamp-comment.spec.ts` |
|
||||
| Create internal and public comments, verify internal comments are hidden on public share links | `tests/file/internal-comment-and-edit.spec.ts` |
|
||||
| Author edits comment text, switches to internal, removes timestamp, and updates attachments | `tests/file/internal-comment-and-edit.spec.ts` |
|
||||
|
||||
@@ -101,6 +101,14 @@ test('reads, searches and follows a saved transcript in the video player', async
|
||||
})
|
||||
if (!nearBottomId) throw new Error('Expected a visible segment in the bottom quarter')
|
||||
const nearBottom = panel.locator(`[data-segment-id="${nearBottomId}"]`).getByRole('button')
|
||||
await viewport.evaluate((element) => {
|
||||
let scrollSteps = 0
|
||||
const record = () => {
|
||||
element.setAttribute('data-test-scroll-steps', String(++scrollSteps))
|
||||
if (scrollSteps === 2) element.removeEventListener('scroll', record)
|
||||
}
|
||||
element.addEventListener('scroll', record)
|
||||
})
|
||||
await nearBottom.click()
|
||||
await expect(nearBottom).toHaveAttribute('aria-current', 'true')
|
||||
await expect
|
||||
@@ -112,12 +120,29 @@ test('reads, searches and follows a saved transcript in the video player', async
|
||||
}),
|
||||
)
|
||||
.toBeCloseTo(0.5, 1)
|
||||
await expect(viewport).toHaveAttribute('data-test-scroll-steps', '2')
|
||||
await expect(sync).toBeHidden()
|
||||
await page.emulateMedia({ reducedMotion: 'reduce' })
|
||||
await viewport.evaluate((element) => {
|
||||
let previousTop = element.scrollTop
|
||||
const record = () => {
|
||||
const top = element.scrollTop
|
||||
if (top < previousTop) {
|
||||
element.setAttribute('data-test-first-reverse-scroll-top', String(top))
|
||||
element.removeEventListener('scroll', record)
|
||||
}
|
||||
previousTop = top
|
||||
}
|
||||
element.addEventListener('scroll', record)
|
||||
})
|
||||
await video.evaluate((element) => {
|
||||
const media = element as HTMLVideoElement
|
||||
media.currentTime = 0
|
||||
})
|
||||
await expect(first).toHaveAttribute('aria-current', 'true')
|
||||
await expect(first).toBeInViewport()
|
||||
await expect(viewport).toHaveAttribute('data-test-first-reverse-scroll-top', '0')
|
||||
await page.emulateMedia({ reducedMotion: 'no-preference' })
|
||||
|
||||
await panel.getByRole('button', { name: 'Search transcript' }).click()
|
||||
const search = panel.getByRole('searchbox', { name: 'Search transcript' })
|
||||
@@ -155,6 +180,20 @@ test('reads, searches and follows a saved transcript in the video player', async
|
||||
await expect(sync).toBeVisible()
|
||||
await expect(last).not.toBeInViewport()
|
||||
await expect(last).toHaveAttribute('aria-current', 'true')
|
||||
await viewport.evaluate((element) => {
|
||||
element.addEventListener(
|
||||
'scroll',
|
||||
() => {
|
||||
element.dispatchEvent(new WheelEvent('wheel', { bubbles: true, deltaY: -120 }))
|
||||
element.setAttribute('data-test-follow-interrupted', 'true')
|
||||
},
|
||||
{ once: true },
|
||||
)
|
||||
})
|
||||
await sync.click()
|
||||
await expect(viewport).toHaveAttribute('data-test-follow-interrupted', 'true')
|
||||
await expect(sync).toBeVisible()
|
||||
await expect(last).not.toBeInViewport()
|
||||
await sync.click()
|
||||
await expect(last).toBeInViewport()
|
||||
await expect(sync).toBeHidden()
|
||||
|
||||
Reference in New Issue
Block a user