mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-04 23:24:21 +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:
@@ -0,0 +1,57 @@
|
||||
import { defineConfig, devices } from '@playwright/test'
|
||||
|
||||
/**
|
||||
* Playwright configuration for the webui UI integration tests.
|
||||
*
|
||||
* The suite runs against a backend-free harness (packages/webui/e2e) served by
|
||||
* Bun's native HTML bundler, so no database, auth or transcode pipeline is
|
||||
* required.
|
||||
*
|
||||
* Browser selection: pass `--project=<name>` to pick an engine, e.g.
|
||||
* bun run test:e2e --project=webkit # WebKit (Safari engine), used on macOS CI
|
||||
* bun run test:e2e --project=chromium
|
||||
* bun run test:e2e --project=firefox
|
||||
*/
|
||||
export default defineConfig({
|
||||
testDir: './packages/webui/e2e/tests',
|
||||
testMatch: '**/*.spec.ts',
|
||||
fullyParallel: true,
|
||||
forbidOnly: !!process.env.CI,
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
workers: process.env.CI ? 1 : undefined,
|
||||
reporter: process.env.CI ? [['list'], ['html', { open: 'never' }]] : 'list',
|
||||
timeout: 60_000,
|
||||
expect: { timeout: 10_000 },
|
||||
|
||||
use: {
|
||||
// `baseURL` is Playwright's required option key and cannot be renamed.
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
baseURL: 'http://localhost:5199',
|
||||
trace: 'on-first-retry',
|
||||
video: 'retain-on-failure',
|
||||
},
|
||||
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
},
|
||||
{
|
||||
name: 'firefox',
|
||||
use: { ...devices['Desktop Firefox'] },
|
||||
},
|
||||
{
|
||||
name: 'webkit',
|
||||
use: { ...devices['Desktop Safari'] },
|
||||
},
|
||||
],
|
||||
|
||||
// Launch the isolated harness dev server (Bun's native HTML bundler) before
|
||||
// the tests.
|
||||
webServer: {
|
||||
command: 'bun run packages/webui/e2e/harness/serve.ts',
|
||||
url: 'http://localhost:5199',
|
||||
reuseExistingServer: !process.env.CI,
|
||||
timeout: 120_000,
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user