clipwright/dashboard/e2e/specs/real-backend.spec.js
pedro-bento 91a5465f81
All checks were successful
CI / unit (push) Successful in 45s
CI / backend-e2e (push) Successful in 1m16s
CI / dashboard-e2e (push) Successful in 2m29s
chore: drop watermark feature, CLI, docs, design.md; consolidate requirements (#6)
- Remove the watermark feature end to end (watermarked.py, apply_watermark/
  mark_delivery/watermark_filter, WATERMARK env, assets/) and its tests; self-host
  delivery is now unconditionally clean.
- Delete the unused cli/ package and .github/workflows/publish-cli.yml.
- Delete docs/ (compliance) and design.md; drop the dangling references in the
  legal page and the design-token/ui comments.
- Consolidate requirements: requirements.txt (runtime) + requirements-test.txt
  (unit + E2E); remove requirements-e2e.txt and requirements-ml-e2e.txt and
  point both CI jobs at the single test file. Add libgl1 to the unit job
  (scenedetect -> opencv-python links libGL).

Verified in the CI container: unit 701 passed; API E2E 209; pipeline E2E 127;
Playwright 19 passed / 1 skipped.

Reviewed-on: #6
Co-authored-by: pedro-bento <mail@pbento.pt>
Co-committed-by: pedro-bento <mail@pbento.pt>
2026-10-05 11:11:37 +01:00

33 lines
1.8 KiB
JavaScript

import { test, expect } from '@playwright/test';
import { seedApp } from '../fixtures/app.js';
import { SIXTY_MP4 } from '../fixtures/media.js';
// Real-backend lane.
//
// Drives the built app against a real `uvicorn clipwright.api.app:app` whose
// pipeline runs the real CLI through tests/e2e/pipeline/stub_env (fake ML/ASR/
// Gemini, real ffmpeg). No route mocks: the preview server proxies /api,
// /videos and /thumbnails to the backend (vite.config.js preview.proxy), so
// every request in this spec is served by Python. The spec is only collected
// when CW_E2E_REAL is set; the `mock` lane ignores it.
test.describe('real backend', () => {
test('generates a clip against a real uvicorn + stub_env server', async ({ page }) => {
// Seed the BYOK Gemini key (and consent) exactly like the mock specs.
// No installApiMocks: this lane talks to the real server.
await seedApp(page, { geminiKey: 'e2e-gemini-key' });
await page.goto('/#app');
await expect(page.getByRole('heading', { name: /create viral shorts/i })).toBeVisible();
// Upload the ffmpeg-built fixture, attest rights, submit.
await page.setInputFiles('input[type="file"][accept="video/*"]', SIXTY_MP4);
await page.locator('form input[type="checkbox"]').first().check();
await page.getByRole('button', { name: /generate clips/i }).click();
// The app polls /api/status every 2s; the real pipeline (real ffmpeg,
// stubbed ML) finishes in well under a minute. Bounded auto-wait, no
// sleeps: the clip count badge only renders once results carry clips.
await expect(page.getByText(/\d+ Clips/)).toBeVisible({ timeout: 60_000 });
await expect(page.getByText('Clip 1', { exact: true })).toBeVisible({ timeout: 60_000 });
});
});