mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-30 04:44:28 +00:00
test(webui): add playwright e2e framework with video player play/pause test
Add a Playwright UI integration test framework for the frame-accurate video player. Tests run against a backend-free harness served by Bun's native HTML bundler (matching the project's Bun-based dev/prod serving), so no database, auth or transcode pipeline is required. - Add @playwright/test with chromium/firefox/webkit projects; the browser is selectable via the Playwright --project flag (webkit = Safari engine). - Serve the harness with Bun.serve + bun-plugin-tailwind (no separate Vite toolchain); commit a deterministic 16x16/5s/30fps fixture video and matching AssetInfo. - Add a play/pause spec covering both the play control and clicking the video area, asserting the native video clock, seekbar fill and frame readout stay frame-locked after pause (settle-aware, tolerance-based assertions). - Mock all backend API calls (anchored /api/ and /files/ routes) for isolation. - Exclude e2e specs from Vitest; add a separate CI job (webkit on macOS).
This commit is contained in:
@@ -262,6 +262,7 @@ const ProgressBar: React.FC<ProgressBarProps> = ({
|
||||
onMouseLeave={handleMouseLeave}
|
||||
onMouseDown={handleMouseDown}
|
||||
onTouchStart={handleTouchStart}
|
||||
data-testid="seekbar"
|
||||
>
|
||||
{/* Hidden Preview Video Element */}
|
||||
<video
|
||||
@@ -316,6 +317,7 @@ const ProgressBar: React.FC<ProgressBarProps> = ({
|
||||
<div
|
||||
className="relative absolute top-0 left-0 h-full rounded-full bg-primary"
|
||||
style={{ width: `${progressPercent}%` }}
|
||||
data-testid="seekbar-fill"
|
||||
>
|
||||
{/* Thumb (Playhead) - visible on group hover or active */}
|
||||
<div
|
||||
|
||||
@@ -165,7 +165,13 @@ const ControlBar: React.FC<ControlBarProps> = ({
|
||||
>
|
||||
{/* Left Side: Play, Vol, Time */}
|
||||
<div className="flex items-center gap-4">
|
||||
<button onClick={togglePlay} className="hover:text-primary transition-colors">
|
||||
<button
|
||||
onClick={togglePlay}
|
||||
className="hover:text-primary transition-colors"
|
||||
data-testid="play-toggle"
|
||||
data-playing={state.isPlaying}
|
||||
aria-label={state.isPlaying ? 'Pause' : 'Play'}
|
||||
>
|
||||
{state.isPlaying ? (
|
||||
<Pause className="w-6 h-6 fill-current" />
|
||||
) : (
|
||||
@@ -206,7 +212,9 @@ const ControlBar: React.FC<ControlBarProps> = ({
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-1 text-sm font-medium tabular-nums select-none min-w-[100px]">
|
||||
<span className="text-muted-foreground font-mono">{displayString}</span>
|
||||
<span className="text-muted-foreground font-mono" data-testid="time-readout">
|
||||
{displayString}
|
||||
</span>
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<button className="h-6 w-6 inline-flex items-center justify-center rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer focus:outline-none">
|
||||
@@ -911,6 +919,7 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
|
||||
)}
|
||||
onClick={togglePlay}
|
||||
data-vjs-player
|
||||
data-testid="video-area"
|
||||
>
|
||||
{/* Hidden VideoJS container */}
|
||||
<div ref={videoContainerRef} className="absolute inset-0 z-[-1]" />
|
||||
|
||||
Reference in New Issue
Block a user