clipwright/dashboard/e2e/specs/free-tools.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

45 lines
1.9 KiB
JavaScript

import { test, expect } from '@playwright/test';
import { installApiMocks } from '../fixtures/app.js';
// The free tools are static, no-React pages emitted by vite-plugin-seo. They
// talk to the same /api origin, so the same route mocks apply.
test.describe('free tools', () => {
test('youtube transcript generator renders captions', async ({ page }) => {
await installApiMocks(page);
await page.goto('/youtube-transcript-generator.html');
const requestPromise = page.waitForRequest(
(r) => r.url().includes('/api/tools/youtube-transcript'),
);
await page.fill('#yt-url', 'https://www.youtube.com/watch?v=dQw4w9WgXcQ');
await page.click('#yt-form button[type="submit"]');
const request = await requestPromise;
expect(new URL(request.url()).searchParams.get('url'))
.toBe('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
await expect(page.locator('#yt-title')).toHaveText('Mock Video');
await expect(page.locator('#yt-result')).toBeVisible();
await expect(page.locator('#yt-text')).toContainText('Hello world');
});
test('youtube tag generator returns tags', async ({ page }) => {
await installApiMocks(page);
await page.goto('/youtube-tag-generator.html');
await page.fill('#md-topic', 'A detailed topic sentence about sourdough bread for beginners.');
await page.click('#md-go');
await expect(page.locator('#md-out')).toBeVisible();
await expect(page.locator('#md-out')).toContainText('mock');
await expect(page.locator('#md-out')).toContainText('tags');
});
test('video aspect ratio converter loads its client-side tool', async ({ page }) => {
await installApiMocks(page);
await page.goto('/video-aspect-ratio-converter.html');
await expect(page.locator('#vc-file')).toBeAttached();
await expect(page.locator('#vc-drop')).toBeVisible();
});
});