Three-level end-to-end suite, all deterministic (no retries, no sleeps, no unmocked network): - tests/e2e/api (209 tests): every route in clipwright/api/app.py + free_tools — health/config, uploads, process submit matrix + worker/webhook/ auto-retry/resume, status/source/download-all, edit/effects, transcript/EDL/ rerender, scenes/reframe, subtitle, hook, Postiz, thumbnails, free tools, and the security/path guards. - tests/e2e/pipeline (136 tests): every stage with real ffmpeg and stubbed Gemini/yt-dlp/ASR/ML — download, transcribe, scene detect, selection, layout, reframe/render, subtitles, hooks, watermark, thumbnails, plus the real CLI full pipeline via stub_env. - dashboard/e2e (19 Playwright specs): route-interception state machine covering every dashboard flow; one real-backend spec left test.fixme. - Foundation: tests/e2e/conftest.py (state isolation, no-network guard, ffmpeg media factory, disk-seeded jobs), FakePopen worker harness, child-process stub_env, architecture-consistent fixtures. - CI: unit + backend-e2e + dashboard-e2e jobs in the python+node container; ffmpeg + Playwright installed in-job; no setup-node/cache (act runner). Verified: unit 790 passed; API E2E 209 passed; pipeline E2E 136 passed; Playwright 19 passed / 1 skipped.
52 lines
2.4 KiB
JavaScript
52 lines
2.4 KiB
JavaScript
import { test, expect } from '@playwright/test';
|
|
import { openApp } from '../fixtures/app.js';
|
|
import { SIXTY_MP4 } from '../fixtures/media.js';
|
|
|
|
test.describe('generate flow', () => {
|
|
test('uploads a file, posts it to /api/process and renders the clips', async ({ page }) => {
|
|
await openApp(page, { mocks: { statusSequence: ['processing', 'completed'] } });
|
|
|
|
await page.setInputFiles('input[type="file"][accept="video/*"]', SIXTY_MP4);
|
|
await page.locator('form input[type="checkbox"]').first().check();
|
|
|
|
const requestPromise = page.waitForRequest(
|
|
(r) => r.method() === 'POST' && r.url().includes('/api/process'),
|
|
);
|
|
await page.getByRole('button', { name: /generate clips/i }).click();
|
|
const request = await requestPromise;
|
|
|
|
expect(request.headers()['x-gemini-key']).toBe('e2e-gemini-key');
|
|
expect(request.headers()['content-type']).toContain('multipart/form-data');
|
|
// The multipart body carries the chosen file and the attestation.
|
|
const body = request.postDataBuffer().toString('latin1');
|
|
expect(body).toContain('sixty.mp4');
|
|
expect(body).toContain('acknowledged');
|
|
|
|
// Polling is driven by the app's own 2s interval; auto-wait absorbs it.
|
|
await expect(page.getByRole('heading', { name: 'First viral clip' })).toBeVisible();
|
|
await expect(page.getByRole('heading', { name: 'Second viral clip' })).toBeVisible();
|
|
await expect(page.getByText('2 Clips')).toBeVisible();
|
|
});
|
|
|
|
test('submits a YouTube URL as JSON with the Gemini header', async ({ page }) => {
|
|
await openApp(page);
|
|
|
|
await page.getByRole('button', { name: /video url/i }).click();
|
|
await page.getByPlaceholder(/paste a video link/i).fill('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
|
|
await page.locator('form input[type="checkbox"]').first().check();
|
|
|
|
const requestPromise = page.waitForRequest(
|
|
(r) => r.method() === 'POST' && r.url().includes('/api/process'),
|
|
);
|
|
await page.getByRole('button', { name: /generate clips/i }).click();
|
|
const request = await requestPromise;
|
|
|
|
expect(request.postDataJSON()).toMatchObject({
|
|
url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
|
|
acknowledged: true,
|
|
force_low_quality: false,
|
|
});
|
|
|
|
await expect(page.getByRole('heading', { name: 'First viral clip' })).toBeVisible();
|
|
});
|
|
});
|