From 3dcab584aee7f6161d1f0fa0e653ce125e6709cd Mon Sep 17 00:00:00 2001 From: yiling Date: Fri, 3 Jul 2026 19:20:17 +0800 Subject: [PATCH] test(webui): add frame-accurate comment seek roundtrip e2e MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend the backend-free video-player harness with the app's real comment↔player wiring (onTimeUpdate capture, player.currentTime(second) seek on comment click, and a remount to simulate a second user) and add a Playwright spec. User A comments on 5 distinct random frames (regenerated each run); user B reloads and clicks each comment. Asserts the seconds-based roundtrip is loss-free: frameA -> second=frameA/fps -> seek(second) -> floor(second*fps+0.45) == frameA, so the comment is stored at the frame the author saw and the reader lands on that exact frame. --- packages/webui/e2e/harness/main.tsx | 152 +++++++++++-- packages/webui/e2e/pages/comment-seek.page.ts | 200 ++++++++++++++++++ packages/webui/e2e/tests/comment-seek.spec.ts | 110 ++++++++++ 3 files changed, 446 insertions(+), 16 deletions(-) create mode 100644 packages/webui/e2e/pages/comment-seek.page.ts create mode 100644 packages/webui/e2e/tests/comment-seek.spec.ts diff --git a/packages/webui/e2e/harness/main.tsx b/packages/webui/e2e/harness/main.tsx index acbba458..153d7f5a 100644 --- a/packages/webui/e2e/harness/main.tsx +++ b/packages/webui/e2e/harness/main.tsx @@ -1,7 +1,10 @@ +import { type ReactElement, useCallback, useRef, useState } from 'react' import ReactDOM from 'react-dom/client' +import type Player from 'video.js/dist/types/player' import VideoPlayer from '@/ui/components/viewers/video-player' +import { calculateFrameCenterTime } from '@/ui/components/viewers/utils' import { useUiStore } from '@/ui/stores/ui' -import { sampleVideoAsset } from './fixture' +import { SAMPLE_FRAME_RATE, sampleVideoAsset } from './fixture' /** * Backend-free harness page that mounts the *real* VideoPlayer component with a @@ -12,26 +15,143 @@ import { sampleVideoAsset } from './fixture' * We force the time readout into "frames" mode so specs can parse the exact * integer frame index the UI is displaying and assert it against the native *