clipwright/dashboard/e2e/specs/thumbnail-studio.spec.js
pedro-bento 97f813553d test: add full E2E coverage (API, pipeline, browser)
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.
2026-10-04 22:12:21 +01:00

43 lines
2 KiB
JavaScript

import { test, expect } from '@playwright/test';
import { openApp } from '../fixtures/app.js';
test.describe('thumbnail studio', () => {
test('manual title -> generate -> describe -> publish to YouTube', async ({ page }) => {
await openApp(page, {
hash: '#app?tab=thumbnails',
seed: { postizUrl: 'http://postiz.e2e.local', postizKey: 'postiz-e2e-key' },
});
await expect(page.getByRole('heading', { name: /youtube studio/i })).toBeVisible();
// Mode B: write a title by hand.
await page.getByPlaceholder(/Enter your YouTube title/i).fill('My manual e2e title');
await page.getByRole('button', { name: /use this title/i }).click();
await page.getByRole('button', { name: /continue to thumbnails/i }).click();
// Step 2: generate thumbnails.
const generatePromise = page.waitForRequest(
(r) => r.method() === 'POST' && r.url().includes('/api/thumbnail/generate'),
);
await page.getByRole('button', { name: /generate thumbnails/i }).click();
await generatePromise;
await expect(page.getByAltText('Thumbnail 1')).toBeVisible();
await page.getByAltText('Thumbnail 1').click({ force: true });
await page.getByRole('button', { name: /next: description/i }).click();
// Step 3: write a description and continue.
await page.locator('textarea').first().fill('A hand written e2e description.');
await page.getByRole('button', { name: /next: publish/i }).click();
// Step 4: publish (Postiz is configured).
const publishPromise = page.waitForRequest(
(r) => r.method() === 'POST' && r.url().includes('/api/thumbnail/publish'),
);
await page.getByRole('button', { name: /publish to youtube/i }).click();
const publish = await publishPromise;
expect(publish.postDataBuffer().toString('latin1')).toContain('My manual e2e title');
await expect(page.getByText(/published successfully/i)).toBeVisible();
});
});