commit 7f668b99bd0c6d9a716deb0a3def16ae29ed36f1 parent 0d81c67b86da1f9351118fbbe32511ba39d49d1c Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st> Date: Sat, 10 Oct 2026 13:59:22 -0400 e2e: S5a — every spec's test-data paths through testPaths(); the test server reads E2E_DATA_ROOT 107 spec and helper files named `test-transcripts`, `test-settings.json` and the disposable changelogs as literals relative to the editor directory (451 occurrences). They now take them from `testPaths()` (editor/e2e/testPaths.ts, re-exported by helpers.ts), and `dev:test` / `start:test` take the same root as `${E2E_DATA_ROOT:-$(pwd)}`, so a server and the specs that drive it agree by construction — the ground a server per worker (S5b) stands on. Nothing sets the variable yet: one worker, the editor directory, the paths of before. E2E_-prefixed, not TRANSCRIPTS_DIR / SETTINGS_FILE: a --share-data worktree's .worktree-env sets TRANSCRIPTS_DIR to the real corpus, and resetData() deletes this directory. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Diffstat:
113 files changed, 618 insertions(+), 483 deletions(-)
diff --git a/ENVIRONMENT.md b/ENVIRONMENT.md @@ -185,6 +185,7 @@ Read only by a test harness, a fake binary or a test-mode branch. Never set one | `E2E_TEST_ROUTES` | off | `1` opens the editor's `/api/test/*` routes and marks a test server at boot. Set by `editor/playwright.config.ts` on its test server, and by nothing else. | editor/app/api/test/_guard.ts, editor/instrumentation.ts | | `E2E_MODE` | `start` | `start`: the editor and umtool suites run against `next start` from a build `scripts/e2e-stamp.mjs` vouches for, rebuilt through the heavy slot when the tree moved. `dev`: against `next dev`, for iterating on one spec. The export and homepage suites always run `next dev` (static exports) and say so when asked for `start`. | editor/playwright.config.ts, umtool/playwright.config.ts, scripts/e2e-stamp.mjs | | `E2E_NEXT_DIST_DIR` | `.next` | The editor's build directory for the e2e suite's start mode (`.next/e2e`), so a test build never replaces the `.next` a running editor serves from. Set by `scripts/e2e-stamp.mjs` for its build and by `editor/playwright.config.ts` for its test server — and for the editor suite's export dev server (`.next/e2e-editor`), which then runs beside the export suite's own (Next allows one `next dev` per dist dir). | editor/next.config.ts, export/next.config.ts | +| `E2E_DATA_ROOT` | the editor directory | Where the editor test server's data lives: `test-transcripts/`, `test-settings.json` and the disposable changelogs sit under it. The test server's scripts and the specs' `testPaths()` read the same variable, so they agree by construction. E2E_-prefixed, never TRANSCRIPTS_DIR: a `--share-data` worktree's `.worktree-env` points that at the real corpus. | editor/package.json (dev:test, start:test), editor/e2e/testPaths.ts | | `E2E_BUILD_CHECKED` | — | Set by a suite's config once it has checked the start-mode build's stamp, so a worker's second load of the config does not check again. | editor/playwright.config.ts, umtool/playwright.config.ts | | `E2E_QUEUE` | on | `0` skips the machine-global e2e queue (the port check still runs). | scripts/queue-lock.mjs | | `E2E_PORT_CHECK` | on | `0` skips the pre-run check that the suite's ports are free. | scripts/queue-lock.mjs | diff --git a/common/lib/envVars.ts b/common/lib/envVars.ts @@ -183,6 +183,7 @@ const DECLARED: EnvVarDecl[] = [ { name: "E2E_TEST_ROUTES", audience: "test", default: "off", readBy: "editor/app/api/test/_guard.ts, editor/instrumentation.ts", doc: "`1` opens the editor's `/api/test/*` routes and marks a test server at boot. Set by `editor/playwright.config.ts` on its test server, and by nothing else." }, { name: "E2E_MODE", audience: "test", default: "`start`", readBy: "editor/playwright.config.ts, umtool/playwright.config.ts, scripts/e2e-stamp.mjs", doc: "`start`: the editor and umtool suites run against `next start` from a build `scripts/e2e-stamp.mjs` vouches for, rebuilt through the heavy slot when the tree moved. `dev`: against `next dev`, for iterating on one spec. The export and homepage suites always run `next dev` (static exports) and say so when asked for `start`." }, { name: "E2E_NEXT_DIST_DIR", audience: "test", default: "`.next`", readBy: "editor/next.config.ts, export/next.config.ts", doc: "The editor's build directory for the e2e suite's start mode (`.next/e2e`), so a test build never replaces the `.next` a running editor serves from. Set by `scripts/e2e-stamp.mjs` for its build and by `editor/playwright.config.ts` for its test server — and for the editor suite's export dev server (`.next/e2e-editor`), which then runs beside the export suite's own (Next allows one `next dev` per dist dir)." }, + { name: "E2E_DATA_ROOT", audience: "test", default: "the editor directory", readBy: "editor/package.json (dev:test, start:test), editor/e2e/testPaths.ts", doc: "Where the editor test server's data lives: `test-transcripts/`, `test-settings.json` and the disposable changelogs sit under it. The test server's scripts and the specs' `testPaths()` read the same variable, so they agree by construction. E2E_-prefixed, never TRANSCRIPTS_DIR: a `--share-data` worktree's `.worktree-env` points that at the real corpus." }, { name: "E2E_BUILD_CHECKED", audience: "test", default: "—", readBy: "editor/playwright.config.ts, umtool/playwright.config.ts", doc: "Set by a suite's config once it has checked the start-mode build's stamp, so a worker's second load of the config does not check again." }, { name: "E2E_QUEUE", audience: "test", default: "on", readBy: "scripts/queue-lock.mjs", doc: "`0` skips the machine-global e2e queue (the port check still runs)." }, { name: "E2E_PORT_CHECK", audience: "test", default: "on", readBy: "scripts/queue-lock.mjs", doc: "`0` skips the pre-run check that the suite's ports are free." }, diff --git a/editor/e2e/aliases.spec.ts b/editor/e2e/aliases.spec.ts @@ -1,5 +1,5 @@ import { expect, test } from "@playwright/test"; -import { resetData, writeSite, readJson } from "./helpers"; +import { resetData, writeSite, readJson, testPaths } from "./helpers"; // Search-aliases authoring on the site's Search aliases tab: the global // dictionary and the site's overrides, both. Global aliases seed with defaults; @@ -42,7 +42,7 @@ test.describe("search aliases authoring", () => { await expect(async () => { const cfg = await readJson<AliasFile>( - "test-transcripts/sites/testsite/search-aliases.json", + `${testPaths().transcriptsDir}/sites/testsite/search-aliases.json`, ); const entry = cfg.aliases.find((a) => a.id === "testconcept"); expect(entry).toBeTruthy(); @@ -62,7 +62,7 @@ test.describe("search aliases authoring", () => { await expect(async () => { const cfg = await readJson<AliasFile & { aliases: { suggestion: string }[] }>( - "test-transcripts/search-aliases.json", + `${testPaths().transcriptsDir}/search-aliases.json`, ); expect(cfg.aliases[0].suggestion).toBe("\\bCHANGED\\b"); }).toPass({ timeout: 5000 }); diff --git a/editor/e2e/attribution.spec.ts b/editor/e2e/attribution.spec.ts @@ -12,6 +12,7 @@ import { writeChannelConfig, writeDigestVideo, writeSettings, + testPaths, } from "./helpers"; import type { AttributionRecord } from "../../common/lib/attribution"; @@ -48,7 +49,7 @@ const TEXTONLY = "attrvid0002"; const SLOW = 120_000; function dataRel(videoId: string, file: string): string { - return join("test-transcripts", "channels", CHANNEL, "data", videoId, file); + return join(testPaths().transcriptsDir, "channels", CHANNEL, "data", videoId, file); } const DIARIZED_AT = "2026-08-06T00:00:00.000Z"; @@ -405,7 +406,7 @@ test("the stage card and the operation pages show attribution beside diarization test.setTimeout(SLOW); await seedChannel(); await writeSettings(attributionSettings()); - await rm(resolvePath(`test-transcripts/channels/${CHANNEL}/snapshot.json`), { + await rm(resolvePath(`${testPaths().transcriptsDir}/channels/${CHANNEL}/snapshot.json`), { force: true, }); await generateReport(page, CHANNEL); diff --git a/editor/e2e/audio-check-scenarios.spec.ts b/editor/e2e/audio-check-scenarios.spec.ts @@ -7,6 +7,7 @@ import { readJson, resetData, resolvePath, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; import type { @@ -14,7 +15,7 @@ import type { } from "../../common/lib/downloadOutcome"; const CHANNEL = "test-audio-check"; -const CHANNEL_ROOT = `test-transcripts/channels/${CHANNEL}`; +const CHANNEL_ROOT = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; // urlIdYouTube on "https://odysee.com/abc123" returns "abc123". const VIDEO_ID = "abc123"; diff --git a/editor/e2e/auto-queue.spec.ts b/editor/e2e/auto-queue.spec.ts @@ -8,6 +8,7 @@ import { resetData, resolvePath, writeSettings, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; @@ -53,7 +54,7 @@ const TWO_WORKERS = [ ]; async function makeChannel(slug: string, ids: string[]) { - const root = resolvePath(`test-transcripts/channels/${slug}`); + const root = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}`); await mkdir(`${root}/data`, { recursive: true }); await writeFile( `${root}/config.json`, @@ -108,7 +109,7 @@ function downloadAutoQueue(root: Group, maxWorkers: number | null = null) { // channels so the runner's per-platform gate serializes downloads → a // deterministic cross-channel order. async function makeDownloadChannel(slug: string, ids: string[]) { - const root = resolvePath(`test-transcripts/channels/${slug}`); + const root = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}`); await mkdir(`${root}/data`, { recursive: true }); await writeFile( `${root}/config.json`, @@ -205,7 +206,7 @@ function pickOrder( async function allTranscribed(slug: string, ids: string[]): Promise<boolean> { for (const id of ids) { if ( - !(await pathExists(`test-transcripts/channels/${slug}/data/${id}/transcript.json`)) + !(await pathExists(`${testPaths().transcriptsDir}/channels/${slug}/data/${id}/transcript.json`)) ) { return false; } @@ -281,9 +282,9 @@ test("respects the saved worker default: a disabled worker is never used", async // (.worker-defaults.json) enables only gpu — cpu must stay disabled, and the // runner must honor that (regression for the boot-time reconfigure() bug that // bypassed applyDefaults()). - await mkdir(resolvePath("test-transcripts/.workers"), { recursive: true }); + await mkdir(resolvePath(`${testPaths().transcriptsDir}/.workers`), { recursive: true }); await writeFile( - resolvePath("test-transcripts/.workers/defaults.json"), + resolvePath(`${testPaths().transcriptsDir}/.workers/defaults.json`), JSON.stringify({ enabledWorkerIds: ["gpu"] }), ); @@ -312,7 +313,7 @@ test("respects the saved worker default: a disabled worker is never used", async // Every transcription ran on gpu — cpu (disabled by the saved default) was never used. for (const id of ids) { const outcome = await readJson<{ worker?: { id?: string } }>( - `test-transcripts/channels/alpha/data/${id}/transcribe-outcome.json`, + `${testPaths().transcriptsDir}/channels/alpha/data/${id}/transcribe-outcome.json`, ); expect(outcome.worker?.id).toBe("gpu"); } @@ -398,7 +399,7 @@ test("UI: build a policy in the editor, save it, and start the runner", async ({ // The policy persisted to settings. const settings = await readJson<{ autoQueue: { transcription: { enabled: boolean; root: { children: { match?: { value?: string } }[] } } }; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(settings.autoQueue.transcription.enabled).toBe(true); expect( settings.autoQueue.transcription.root.children.some( @@ -475,7 +476,7 @@ test("UI: Move to top jumps a rule to the front of its siblings", async ({ autoQueue: { transcription: { root: { children: { match?: { value?: string } }[] } }; }; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect( settings.autoQueue.transcription.root.children.map((c) => c.match?.value), ).toEqual(["gamma", "alpha", "beta"]); @@ -635,7 +636,7 @@ test("Drain completes when an auto-transcribe unit is parked behind a busy worke // fixture runs ~50s when the video id contains "slowop", so a manual transcribe // holds the only worker long enough for the auto unit to park and for us to // drain. "alpha": a normal pending video the auto-runner will pick. - const busy = resolvePath("test-transcripts/channels/busy"); + const busy = resolvePath(`${testPaths().transcriptsDir}/channels/busy`); await mkdir(`${busy}/data/slowop1`, { recursive: true }); await writeFile( `${busy}/config.json`, @@ -739,7 +740,7 @@ test("Drain completes (and lets the unit finish) when an auto-transcribe unit is ) .toBe(true); expect( - await pathExists("test-transcripts/channels/alpha/data/slowop1/transcript.json"), + await pathExists(`${testPaths().transcriptsDir}/channels/alpha/data/slowop1/transcript.json`), ).toBe(false); // 2) Drain the runner. Pre-fix this hung forever (event-loop starvation); @@ -814,7 +815,7 @@ async function makeFilteredDownloadChannel( ids: string[], unscanned: number, ) { - const root = resolvePath(`test-transcripts/channels/${slug}`); + const root = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}`); await mkdir(`${root}/data`, { recursive: true }); await writeFile( `${root}/config.json`, @@ -873,13 +874,13 @@ test("the download lane scans a filtered channel before it downloads from it", a await startRunner(request, "download"); const invocationsPath = - "test-transcripts/channels/filtered/fake-ytdlp.invocations"; + `${testPaths().transcriptsDir}/channels/filtered/fake-ytdlp.invocations`; await expect .poll( async () => (await readText(invocationsPath)).includes("prefetch:") || (await pathExists( - "test-transcripts/channels/filtered/data/guestvid0001/transcript.en.vtt", + `${testPaths().transcriptsDir}/channels/filtered/data/guestvid0001/transcript.en.vtt`, )), { timeout: 60_000 }, ) @@ -899,7 +900,7 @@ test("the download lane scans a filtered channel before it downloads from it", a // that window is a race with the regen, not a fact about the feature. The // settlement itself is pinned in title-filter.spec.ts. const scan = await readJson<{ entries: Record<string, unknown> }>( - "test-transcripts/channels/filtered/metadata-scan.json", + `${testPaths().transcriptsDir}/channels/filtered/metadata-scan.json`, ); expect(Object.keys(scan.entries).sort()).toEqual([ "guestvid0001", @@ -979,7 +980,7 @@ test("UI: the order select round-trips through save", async ({ page }) => { async () => { const s = await readJson<{ autoQueue?: { transcription?: { order?: string } }; - }>("test-settings.json").catch(() => null); + }>(testPaths().settingsFile).catch(() => null); return s?.autoQueue?.transcription?.order ?? null; }, { timeout: 10_000 }, @@ -1320,7 +1321,7 @@ test("UI: each operation page carries its own lane, and the rail as context", as const downloadsPaused = async () => ( await readJson<{ autoQueue?: { download?: { held?: boolean } } }>( - "test-settings.json", + testPaths().settingsFile, ).catch(() => ({}) as { autoQueue?: { download?: { held?: boolean } } }) ).autoQueue?.download?.held ?? false; const pause = download.getByRole("button", { name: "Pause Downloads" }); @@ -1421,7 +1422,7 @@ test("the digest lane offers Shortest first, and has no Reach axis", async ({ ( await readJson<{ autoQueue?: { digest?: { held?: boolean } }; - }>("test-settings.json").catch(() => null) + }>(testPaths().settingsFile).catch(() => null) )?.autoQueue?.digest?.held ?? null, { timeout: 15_000 }, ) @@ -1439,7 +1440,7 @@ test("the digest lane offers Shortest first, and has no Reach axis", async ({ const s = await readJson<{ autoQueue?: { digest?: { order?: string; held?: boolean } }; digest?: { recencyOrder?: string; recencyReach?: string }; - }>("test-settings.json").catch(() => null); + }>(testPaths().settingsFile).catch(() => null); return [ s?.autoQueue?.digest?.order, s?.digest?.recencyOrder ?? "gone", @@ -1505,7 +1506,7 @@ test("a retired pause field holds nothing, and does not survive a write", async const s = await readJson<{ autoQueue?: { digest?: { held?: boolean } }; digest?: { digestsPaused?: boolean }; - }>("test-settings.json").catch(() => null); + }>(testPaths().settingsFile).catch(() => null); if (!s) return null; return `held=${String(s.autoQueue?.digest?.held)}/retired=${String( "digestsPaused" in (s.digest ?? {}), diff --git a/editor/e2e/auto-refresh.spec.ts b/editor/e2e/auto-refresh.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { readJson, resetData, writeSettings } from "./helpers"; +import { readJson, resetData, writeSettings, testPaths } from "./helpers"; // Covers the global passive auto-refresh: the Settings field (default 5s, // persists, accepts 0=off, rejects out-of-range) and the runtime behavior — @@ -23,7 +23,7 @@ test.describe("auto-refresh setting", () => { ).toBeVisible(); const saved = await readJson<{ autoRefreshIntervalSeconds?: number }>( - "test-settings.json", + testPaths().settingsFile, ); expect(saved.autoRefreshIntervalSeconds).toBe(12); @@ -40,7 +40,7 @@ test.describe("auto-refresh setting", () => { ).toBeVisible(); const saved = await readJson<{ autoRefreshIntervalSeconds?: number }>( - "test-settings.json", + testPaths().settingsFile, ); expect(saved.autoRefreshIntervalSeconds).toBe(0); }); diff --git a/editor/e2e/auto-report-refresh.spec.ts b/editor/e2e/auto-report-refresh.spec.ts @@ -1,6 +1,6 @@ import { writeFile } from "node:fs/promises"; import { test, expect } from "@playwright/test"; -import { readJson, resetData, resolvePath, generateReport } from "./helpers"; +import { readJson, resetData, resolvePath, generateReport, testPaths } from "./helpers"; import { baseUrl } from "./baseUrl"; // Verifies the global debounced snapshot scheduler: a direct (non-managed) @@ -8,10 +8,10 @@ import { baseUrl } from "./baseUrl"; // its own, without visiting the channel page or clicking "Refresh report". const SLUG = "test-transcribe"; -const SNAPSHOT_REL = `test-transcripts/channels/${SLUG}/snapshot.json`; +const SNAPSHOT_REL = `${testPaths().transcriptsDir}/channels/${SLUG}/snapshot.json`; function dataRel(videoId: string, file: string): string { - return `test-transcripts/channels/${SLUG}/data/${videoId}/${file}`; + return `${testPaths().transcriptsDir}/channels/${SLUG}/data/${videoId}/${file}`; } async function seedTranscript(videoId: string): Promise<void> { diff --git a/editor/e2e/auto-subs-replace.spec.ts b/editor/e2e/auto-subs-replace.spec.ts @@ -24,11 +24,12 @@ import { resetData, resolvePath, writeSettings, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; const SLUG = "test-auto-subs"; -const ROOT = `test-transcripts/channels/${SLUG}`; +const ROOT = `${testPaths().transcriptsDir}/channels/${SLUG}`; const SNAPSHOT_REL = `${ROOT}/snapshot.json`; // Shaped after real yt-dlp --write-auto-subs output. @@ -423,7 +424,7 @@ test("the auto-queue opt-in is off by default and persists when enabled", async async () => { const settings = await readJson<{ autoQueue?: { transcription?: { replaceAutoSubs?: boolean } }; - }>("test-settings.json").catch(() => null); + }>(testPaths().settingsFile).catch(() => null); return settings?.autoQueue?.transcription?.replaceAutoSubs ?? null; }, { timeout: 10_000 }, diff --git a/editor/e2e/availability-backfill.spec.ts b/editor/e2e/availability-backfill.spec.ts @@ -7,6 +7,7 @@ import { readJson, resetData, resolvePath, + testPaths, } from "./helpers"; type AvailabilityFile = { @@ -22,12 +23,12 @@ async function seedVideo( metadata: Record<string, unknown>, ): Promise<void> { const dir = resolvePath( - `test-transcripts/channels/${CHANNEL}/data/${id}`, + `${testPaths().transcriptsDir}/channels/${CHANNEL}/data/${id}`, ); await mkdir(dir, { recursive: true }); await writeFile( resolvePath( - `test-transcripts/channels/${CHANNEL}/data/${id}/metadata.info.json`, + `${testPaths().transcriptsDir}/channels/${CHANNEL}/data/${id}/metadata.info.json`, ), JSON.stringify({ id, @@ -59,11 +60,11 @@ test("download backfills availability.json from metadata", async ({ page }) => { // Seeded videos should now have availability.json written from metadata. expect( await pathExists( - `test-transcripts/channels/${CHANNEL}/data/seededPrivate1/availability.json`, + `${testPaths().transcriptsDir}/channels/${CHANNEL}/data/seededPrivate1/availability.json`, ), ).toBe(true); const priv = await readJson<AvailabilityFile>( - `test-transcripts/channels/${CHANNEL}/data/seededPrivate1/availability.json`, + `${testPaths().transcriptsDir}/channels/${CHANNEL}/data/seededPrivate1/availability.json`, ); expect(priv.availability).toBe("private"); expect(priv.webpageUrl).toBe( @@ -71,14 +72,14 @@ test("download backfills availability.json from metadata", async ({ page }) => { ); const plain = await readJson<AvailabilityFile>( - `test-transcripts/channels/${CHANNEL}/data/seededPlain1/availability.json`, + `${testPaths().transcriptsDir}/channels/${CHANNEL}/data/seededPlain1/availability.json`, ); expect(plain.availability).toBe("public"); // A newly-fetched video also gets a sidecar from its metadata. expect( await pathExists( - `test-transcripts/channels/${CHANNEL}/data/fake00000001/availability.json`, + `${testPaths().transcriptsDir}/channels/${CHANNEL}/data/fake00000001/availability.json`, ), ).toBe(true); }); @@ -92,7 +93,7 @@ test("backfill skips videos that already have an availability sidecar", async ({ // backfill (which would otherwise infer "private" from metadata). await writeFile( resolvePath( - `test-transcripts/channels/${CHANNEL}/data/seededPrivate1/availability.json`, + `${testPaths().transcriptsDir}/channels/${CHANNEL}/data/seededPrivate1/availability.json`, ), JSON.stringify({ availability: "deleted", @@ -108,7 +109,7 @@ test("backfill skips videos that already have an availability sidecar", async ({ }); const after = await readJson<AvailabilityFile>( - `test-transcripts/channels/${CHANNEL}/data/seededPrivate1/availability.json`, + `${testPaths().transcriptsDir}/channels/${CHANNEL}/data/seededPrivate1/availability.json`, ); expect(after.availability).toBe("deleted"); expect(after.checkedAt).toBe("2099-01-01T00:00:00.000Z"); diff --git a/editor/e2e/availability.spec.ts b/editor/e2e/availability.spec.ts @@ -9,6 +9,7 @@ import { resetData, resolvePath, writeSite, + testPaths, } from "./helpers"; const CHANNEL = "availability-test"; @@ -31,7 +32,7 @@ type AvailabilityFile = { }; function availabilityPath(id: string): string { - return `test-transcripts/channels/${CHANNEL}/data/${id}/availability.json`; + return `${testPaths().transcriptsDir}/channels/${CHANNEL}/data/${id}/availability.json`; } async function readAvailability(id: string): Promise<AvailabilityFile> { @@ -174,13 +175,13 @@ test("build index marks deleted videos in the export summaries", async ({ const { writeFile } = await import("node:fs/promises"); await writeFile( resolvePath( - `test-transcripts/channels/${CHANNEL}/data/vidpublic1/transcript.en.vtt`, + `${testPaths().transcriptsDir}/channels/${CHANNEL}/data/vidpublic1/transcript.en.vtt`, ), "WEBVTT\n\n00:00:00.000 --> 00:00:05.000\nhello\n", ); await writeFile( resolvePath( - `test-transcripts/channels/${CHANNEL}/data/viddeleted1/transcript.en.vtt`, + `${testPaths().transcriptsDir}/channels/${CHANNEL}/data/viddeleted1/transcript.en.vtt`, ), "WEBVTT\n\n00:00:00.000 --> 00:00:05.000\nhello deleted\n", ); @@ -192,7 +193,7 @@ test("build index marks deleted videos in the export summaries", async ({ const pageJson = await readJson< Array<{ id: string; isDeleted: boolean }> - >("test-transcripts/.export-index/sites/testsite/summaries/page-0000.json"); + >(`${testPaths().transcriptsDir}/.export-index/sites/testsite/summaries/page-0000.json`); const byId = new Map(pageJson.map((s) => [s.id, s])); expect(byId.get("vidpublic1")?.isDeleted).toBe(false); expect(byId.get("viddeleted1")?.isDeleted).toBe(true); diff --git a/editor/e2e/backfill.spec.ts b/editor/e2e/backfill.spec.ts @@ -11,6 +11,7 @@ import { resolvePath, writeDigestVideo, writeSettings, + testPaths, } from "./helpers"; // Active jobs, straight off the JSON API. Reloading /jobs costs hundreds of @@ -45,7 +46,7 @@ async function activeJobs( const SLUG = "test-transcribe"; function dataRel(videoId: string, file: string): string { - return `test-transcripts/channels/${SLUG}/data/${videoId}/${file}`; + return `${testPaths().transcriptsDir}/channels/${SLUG}/data/${videoId}/${file}`; } const BASE_SETTINGS = { @@ -106,7 +107,7 @@ async function seedTranscript(videoId: string): Promise<void> { // Real audio files in a video dir — what the re-download specs measure. async function audioFiles(videoId: string): Promise<string[]> { const dir = resolvePath( - `test-transcripts/channels/${SLUG}/data/${videoId}`, + `${testPaths().transcriptsDir}/channels/${SLUG}/data/${videoId}`, ); const entries = await readdir(dir).catch(() => [] as string[]); return entries.filter( @@ -126,7 +127,7 @@ type LanePolicy = { async function backfillLane(): Promise<LanePolicy> { const s = await readJson<{ autoQueue?: { backfill?: LanePolicy } }>( - "test-settings.json", + testPaths().settingsFile, ).catch(() => ({}) as { autoQueue?: { backfill?: LanePolicy } }); return s.autoQueue?.backfill ?? {}; } @@ -154,7 +155,7 @@ test("the stage card separates reachable work from what needs its media back", a await rm(resolvePath(dataRel("vidB", f)), { force: true }); } - await rm(resolvePath(`test-transcripts/channels/${SLUG}/snapshot.json`), { + await rm(resolvePath(`${testPaths().transcriptsDir}/channels/${SLUG}/snapshot.json`), { force: true, }); await generateReport(page, SLUG); @@ -575,7 +576,7 @@ test("a backfill runs concurrently with a transcription", async ({ await seedTranscript("vidA"); // Transcription work that LASTS: a fresh dir with audio and no transcript. const slowDir = resolvePath( - `test-transcripts/channels/${SLUG}/data/slowop1`, + `${testPaths().transcriptsDir}/channels/${SLUG}/data/slowop1`, ); await mkdir(slowDir, { recursive: true }); await writeFile(`${slowDir}/audio.mp3`, "fake audio slowop1\n"); @@ -664,7 +665,7 @@ test("a digest runs concurrently with a backfill, not behind it", async ({ for (const id of ["vidA", "vidB"]) await seedTranscript(id); for (let i = 0; i < 40; i++) { const id = `slowdiar${String(i).padStart(2, "0")}`; - const dir = resolvePath(`test-transcripts/channels/${SLUG}/data/${id}`); + const dir = resolvePath(`${testPaths().transcriptsDir}/channels/${SLUG}/data/${id}`); await mkdir(dir, { recursive: true }); await writeFile(`${dir}/audio.m4a`, `fake audio ${id}\n`); await writeFile( @@ -748,7 +749,7 @@ test("the diarization page shows the channel and both populations", async ({ for (const f of await audioFiles("vidB")) { await rm(resolvePath(dataRel("vidB", f)), { force: true }); } - await rm(resolvePath(`test-transcripts/channels/${SLUG}/snapshot.json`), { + await rm(resolvePath(`${testPaths().transcriptsDir}/channels/${SLUG}/snapshot.json`), { force: true, }); await generateReport(page, SLUG); @@ -793,7 +794,7 @@ test("the dashboard pauses and resumes the backfill lane", async ({ page }) => { const laneHeld = async () => ( await readJson<{ autoQueue?: { backfill?: { held?: boolean } } }>( - "test-settings.json", + testPaths().settingsFile, ).catch(() => ({}) as { autoQueue?: { backfill?: { held?: boolean } } }) ).autoQueue?.backfill?.held ?? false; @@ -839,7 +840,7 @@ test("an operation page holds the same lane the dashboard does", async ({ const laneHeld = async () => ( await readJson<{ autoQueue?: { backfill?: { held?: boolean } } }>( - "test-settings.json", + testPaths().settingsFile, ).catch(() => ({}) as { autoQueue?: { backfill?: { held?: boolean } } }) ).autoQueue?.backfill?.held ?? false; @@ -879,7 +880,7 @@ test("an operation page holds the same lane the dashboard does", async ({ // Both halves are pinned here: the transcribe override that makes there be audio // at all, and the re-normalize that keeps the cues fresh afterwards. const YT_SLUG = "test-yt-subs"; -const YT_ROOT = `test-transcripts/channels/${YT_SLUG}`; +const YT_ROOT = `${testPaths().transcriptsDir}/channels/${YT_SLUG}`; function ytRel(videoId: string, file: string): string { return `${YT_ROOT}/data/${videoId}/${file}`; @@ -1176,7 +1177,7 @@ test("a digest entry in the snapshot does not move the backfill instrument", asy await rm(resolvePath(dataRel("vidB", f)), { force: true }); } - await rm(resolvePath(`test-transcripts/channels/${SLUG}/snapshot.json`), { + await rm(resolvePath(`${testPaths().transcriptsDir}/channels/${SLUG}/snapshot.json`), { force: true, }); await generateReport(page, SLUG); @@ -1188,7 +1189,7 @@ test("a digest entry in the snapshot does not move the backfill instrument", asy { missing?: number; ids?: string[]; eligible?: number; blocked?: number } >; buckets?: Record<string, unknown>; - }>(`test-transcripts/channels/${SLUG}/snapshot.json`); + }>(`${testPaths().transcriptsDir}/channels/${SLUG}/snapshot.json`); // ONE definition of the digest work list. The writer used to keep a second // one, `buckets.noDigest`, whose answer disagreed with this entry by 11,777 // videos corpus-wide (it had no cues-staleness gate and no transcript gate). @@ -1283,14 +1284,14 @@ test("the bucket lanes' work lists land in the snapshot and move no band", async test.setTimeout(SLOW); await resetData("one-transcribe-channel-with-audio"); await writeSettings(backfillSettings()); - await rm(resolvePath(`test-transcripts/channels/${SLUG}/snapshot.json`), { + await rm(resolvePath(`${testPaths().transcriptsDir}/channels/${SLUG}/snapshot.json`), { force: true, }); await generateReport(page, SLUG); // HALF ONE: the entries are really there. Without this the invariance below // would pass vacuously over a feature that never shipped. - const snapRel = `test-transcripts/channels/${SLUG}/snapshot.json`; + const snapRel = `${testPaths().transcriptsDir}/channels/${SLUG}/snapshot.json`; type Snap = { backfill?: Record< string, diff --git a/editor/e2e/build.spec.ts b/editor/e2e/build.spec.ts @@ -5,6 +5,7 @@ import { readJson, resetData, writeSite, + testPaths, } from "./helpers"; test("build index against an empty site writes a 0-transcript manifest", async ({ @@ -14,7 +15,7 @@ test("build index against an empty site writes a 0-transcript manifest", async ( await writeSite("testsite", { channels: [] }); await buildIndex(page); const manifest = await readJson<{ totalCount: number; siteId: string }>( - "test-transcripts/.export-index/sites/testsite/summaries/manifest.json", + `${testPaths().transcriptsDir}/.export-index/sites/testsite/summaries/manifest.json`, ); expect(manifest.totalCount).toBe(0); expect(manifest.siteId).toBe("testsite"); @@ -31,13 +32,13 @@ test("build index ingests synthetic video data into shared + per-site output", a const manifest = await readJson<{ totalCount: number; channels: { name: string }[]; - }>("test-transcripts/.export-index/sites/testsite/summaries/manifest.json"); + }>(`${testPaths().transcriptsDir}/.export-index/sites/testsite/summaries/manifest.json`); expect(manifest.totalCount).toBe(1); expect(manifest.channels.map((c) => c.name)).toContain("Test YouTube Channel"); // Per-channel transcript pages are written ONCE to the shared tree. expect( await pathExists( - "test-transcripts/.export-index/shared/transcripts/test-youtube/page-0000.json", + `${testPaths().transcriptsDir}/.export-index/shared/transcripts/test-youtube/page-0000.json`, ), ).toBe(true); }); @@ -52,10 +53,10 @@ test("two sites over a shared pool get isolated, differently-filtered summaries" await writeSite("without-channel", { channels: [] }); await buildIndex(page); const withChannel = await readJson<{ totalCount: number }>( - "test-transcripts/.export-index/sites/with-channel/summaries/manifest.json", + `${testPaths().transcriptsDir}/.export-index/sites/with-channel/summaries/manifest.json`, ); const without = await readJson<{ totalCount: number }>( - "test-transcripts/.export-index/sites/without-channel/summaries/manifest.json", + `${testPaths().transcriptsDir}/.export-index/sites/without-channel/summaries/manifest.json`, ); expect(withChannel.totalCount).toBe(1); expect(without.totalCount).toBe(0); diff --git a/editor/e2e/bulk-actions.spec.ts b/editor/e2e/bulk-actions.spec.ts @@ -7,6 +7,7 @@ import { pathExists, resetData, resolvePath, + testPaths, } from "./helpers"; // The channel video list's checkbox bulk bar must queue like every other batch @@ -122,9 +123,9 @@ test("bulk retry download submits a single retry-bucket job on the platform queu await expect(newest).toContainText("platform:odysee"); }); -const dataDir = "test-transcripts/channels/test-transcribe/data"; +const dataDir = `${testPaths().transcriptsDir}/channels/test-transcribe/data`; const failedTranscriptionsFile = - "test-transcripts/channels/test-transcribe/failed-transcriptions"; + `${testPaths().transcriptsDir}/channels/test-transcribe/failed-transcriptions`; // Delete directories and Clear failed markers are synchronous, summary-style // actions (no queued job) — the point of bulk delete is to clear failed diff --git a/editor/e2e/cadence-ui.spec.ts b/editor/e2e/cadence-ui.spec.ts @@ -6,6 +6,7 @@ import { resetData, writeChannelConfig, writeSettings, + testPaths, } from "./helpers"; // The cadence UI: every interval in the app is now set as an amount plus a unit @@ -19,7 +20,7 @@ import { // parser had to change — these specs assert on the stored integers. const CHANNEL = "cadence-test"; -const CONFIG = `test-transcripts/channels/${CHANNEL}/config.json`; +const CONFIG = `${testPaths().transcriptsDir}/channels/${CHANNEL}/config.json`; type CadenceConfig = { syncIntervalMinutes?: number; @@ -132,7 +133,7 @@ test("the sync page round-trips the full-sweep cadence and confirm cap", async ( fullSweepConfirmMaxSuspects: number; keepLatestCheckIntervalMinutes: number; }; - }>("test-settings.json").then((s) => s.syncScheduler), + }>(testPaths().settingsFile).then((s) => s.syncScheduler), ) .toMatchObject({ fullSweepIntervalMinutes: 4320, @@ -170,7 +171,7 @@ test("an unrelated settings save no longer resets the keep-latest interval", asy readJson<{ adminTitle: string; syncScheduler: { keepLatestCheckIntervalMinutes: number }; - }>("test-settings.json"), + }>(testPaths().settingsFile), ) .toMatchObject({ adminTitle: "Renamed Admin", @@ -203,7 +204,7 @@ test("the sync page's save writes its block and nothing else", async ({ readJson<{ adminTitle: string; syncScheduler: { maxConcurrentSyncs: number }; - }>("test-settings.json"), + }>(testPaths().settingsFile), ) .toMatchObject({ adminTitle: "Keep Me", @@ -237,16 +238,16 @@ test("bulk apply retunes selected channels and leaves the rest alone", async ({ await expect .poll(async () => - readJson<CadenceConfig>("test-transcripts/channels/bulk-a/config.json"), + readJson<CadenceConfig>(`${testPaths().transcriptsDir}/channels/bulk-a/config.json`), ) .toMatchObject({ fullSweepIntervalMinutes: 10080, syncIntervalMinutes: 30 }); await expect .poll(async () => - readJson<CadenceConfig>("test-transcripts/channels/bulk-b/config.json"), + readJson<CadenceConfig>(`${testPaths().transcriptsDir}/channels/bulk-b/config.json`), ) .toMatchObject({ fullSweepIntervalMinutes: 10080, syncIntervalMinutes: 30 }); const c = await readJson<Record<string, unknown>>( - "test-transcripts/channels/bulk-c/config.json", + `${testPaths().transcriptsDir}/channels/bulk-c/config.json`, ); expect("fullSweepIntervalMinutes" in c).toBe(false); }); @@ -258,7 +259,7 @@ test("the Full sweep button forces a sweep the cadence would have skipped", asyn // passes fullSweep through rather than relying on the cadence gate. await resetData("availability-baseline"); const slug = "availability-test"; - const configRel = `test-transcripts/channels/${slug}/config.json`; + const configRel = `${testPaths().transcriptsDir}/channels/${slug}/config.json`; await generateReport(page, slug); await page.goto(channelStage(slug, "playlist")); diff --git a/editor/e2e/cancel.spec.ts b/editor/e2e/cancel.spec.ts @@ -4,6 +4,7 @@ import { generateReport, pathExists, resetData, + testPaths, } from "./helpers"; test("cancels a running pipeline job from the channel page", async ({ page }) => { @@ -26,7 +27,7 @@ test("cancels a running pipeline job from the channel page", async ({ page }) => // No data dir was written. expect( - await pathExists("test-transcripts/channels/slow-channel/data"), + await pathExists(`${testPaths().transcriptsDir}/channels/slow-channel/data`), ).toBe(false); }); diff --git a/editor/e2e/channel-build-toggle.spec.ts b/editor/e2e/channel-build-toggle.spec.ts @@ -5,6 +5,7 @@ import { readJson, resetData, writeSite, + testPaths, } from "./helpers"; import type { ChannelConfig } from "yt-dlp-transcript-common/lib/channelConfig"; @@ -13,11 +14,11 @@ import type { ChannelConfig } from "yt-dlp-transcript-common/lib/channelConfig"; // the existing top-level cleanup loops in buildIndex remove its per-channel // output dirs. Toggling back re-includes it on the next build. -const CONFIG_PATH = "test-transcripts/channels/test-youtube/config.json"; +const CONFIG_PATH = `${testPaths().transcriptsDir}/channels/test-youtube/config.json`; const MANIFEST_PATH = - "test-transcripts/.export-index/sites/testsite/summaries/manifest.json"; + `${testPaths().transcriptsDir}/.export-index/sites/testsite/summaries/manifest.json`; const CHANNEL_OUT_DIR = - "test-transcripts/.export-index/shared/transcripts/test-youtube"; + `${testPaths().transcriptsDir}/.export-index/shared/transcripts/test-youtube`; test("toggling a channel off skips it from the build; toggling back restores it", async ({ page, diff --git a/editor/e2e/channel-groups.spec.ts b/editor/e2e/channel-groups.spec.ts @@ -9,6 +9,7 @@ import { resolvePath, writeChannelConfig, writeSite, + testPaths, } from "./helpers"; // /channels renders as one table SECTIONED by the active site's channel groups, @@ -235,7 +236,7 @@ test("a youtube group's Transcribe counts and queues its auto-caption-only video test.setTimeout(120_000); await seed(); const id = "asrgrp0001"; - const dataRel = `test-transcripts/channels/slow-b/data/${id}`; + const dataRel = `${testPaths().transcriptsDir}/channels/slow-b/data/${id}`; const dir = resolvePath(dataRel); await mkdir(dir, { recursive: true }); await writeFile(`${dir}/transcript.en.vtt`, ASR_VTT); @@ -254,7 +255,7 @@ test("a youtube group's Transcribe counts and queues its auto-caption-only video ); await writeFile(`${dir}/audio.mp3`, `fake audio ${id}\n`); await writeFile( - resolvePath("test-transcripts/channels/slow-b/playlist"), + resolvePath(`${testPaths().transcriptsDir}/channels/slow-b/playlist`), `https://www.youtube.com/watch?v=${id}\n`, ); await generateReport(page, "slow-b"); diff --git a/editor/e2e/channel-line.spec.ts b/editor/e2e/channel-line.spec.ts @@ -7,6 +7,7 @@ import { resolvePath, writeChannelConfig, writeSettings, + testPaths, } from "./helpers"; // THE CHANNEL LINE. @@ -27,7 +28,7 @@ import { // drawn as a line. const SLUG = "line-chan"; -const ROOT = `test-transcripts/channels/${SLUG}`; +const ROOT = `${testPaths().transcriptsDir}/channels/${SLUG}`; type Entry = Record<string, unknown>; diff --git a/editor/e2e/channel-priority.spec.ts b/editor/e2e/channel-priority.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { readJson, resetData, writeSettings, writeSite } from "./helpers"; +import { readJson, resetData, writeSettings, writeSite, testPaths } from "./helpers"; // THE /channels PRIORITY CONTROLS, asserted against what lands on disk. // @@ -31,7 +31,7 @@ type Settings = { >; }; -const settings = () => readJson<Settings>("test-settings.json"); +const settings = () => readJson<Settings>(testPaths().settingsFile); // Every channel in this fixture, and the pool view: with exactly one site // configured /channels scopes to it, and the focus-site test needs a site whose diff --git a/editor/e2e/channel-rename.spec.ts b/editor/e2e/channel-rename.spec.ts @@ -9,6 +9,7 @@ import { resolvePath, writeChannelConfig, writeSite, + testPaths, } from "./helpers"; // Renaming a channel's slug lives in the Danger zone and requires typing the @@ -56,7 +57,7 @@ test("rename requires the exact current slug and then moves the channel", async // The site membership was retargeted to the new slug. const site = await readJson<{ channels: { slug: string }[] }>( - "test-transcripts/sites/mysite/site.json", + `${testPaths().transcriptsDir}/sites/mysite/site.json`, ); expect(site.channels.map((c) => c.slug)).toEqual([NEW]); }); @@ -80,7 +81,7 @@ test("a social channel renames from its Danger zone and keeps its posts", async name: "Fake Tester (X)", url: "https://x.com/faketester", }); - const posts = resolvePath(`test-transcripts/channels/${OLD_X}/posts`); + const posts = resolvePath(`${testPaths().transcriptsDir}/channels/${OLD_X}/posts`); await mkdir(posts, { recursive: true }); await writeFile( `${posts}/2026-05.jsonl`, diff --git a/editor/e2e/channel-site-membership.spec.ts b/editor/e2e/channel-site-membership.spec.ts @@ -5,6 +5,7 @@ import { readJson, resetData, writeSite, + testPaths, } from "./helpers"; // The channel form's "Sites" membership section: per-site checkbox + group @@ -37,7 +38,7 @@ async function seed() { } const readSite = (id: string) => - readJson<SiteFile>(`test-transcripts/sites/${id}/site.json`); + readJson<SiteFile>(`${testPaths().transcriptsDir}/sites/${id}/site.json`); // The membership inputs are controlled React state that the edit page also // server-renders, so a pre-hydration click can be silently swallowed (see the diff --git a/editor/e2e/channel-storage.spec.ts b/editor/e2e/channel-storage.spec.ts @@ -25,6 +25,7 @@ import { writeChannelConfig, writeDigestVideo, writeSettings, + testPaths, } from "./helpers"; // MOVING A CHANNEL'S MEDIA TO ANOTHER DIRECTORY, AND BACK. @@ -60,8 +61,8 @@ import { const SLUG = "test-youtube"; const VIDEO = "20240101_test1234567"; -const dataDir = () => resolvePath(`test-transcripts/channels/${SLUG}/data`); -const mediaLink = () => resolvePath(`test-transcripts/channels/${SLUG}/media`); +const dataDir = () => resolvePath(`${testPaths().transcriptsDir}/channels/${SLUG}/data`); +const mediaLink = () => resolvePath(`${testPaths().transcriptsDir}/channels/${SLUG}/media`); const videoFile = (name: string) => join(dataDir(), VIDEO, name); // A small audio file — the route streams bytes, it does not decode them. @@ -197,18 +198,18 @@ test("relocate a channel's media to another root, and move it back", async ({ expect((await lstat(videoFile("transcript.en.vtt"))).isFile()).toBe(true); expect(await existsAbs(join(target, VIDEO, "audio.mp3"))).toBe(true); const config = await readJson<{ mediaDir?: string; dataDir?: string }>( - `test-transcripts/channels/${SLUG}/config.json`, + `${testPaths().transcriptsDir}/channels/${SLUG}/config.json`, ); expect(config.mediaDir).toBe(target); expect(config.dataDir).toBe(undefined); // The source was reclaimed: no parked copy left holding a second copy of the // media on the volume the move exists to free, and no marker. const siblings = await readdir( - resolvePath(`test-transcripts/channels/${SLUG}`), + resolvePath(`${testPaths().transcriptsDir}/channels/${SLUG}`), ); expect(siblings.filter((n) => n.startsWith("media."))).toEqual([]); expect( - await pathExists(`test-transcripts/channels/${SLUG}/.relocating.json`), + await pathExists(`${testPaths().transcriptsDir}/channels/${SLUG}/.relocating.json`), ).toBe(false); // --- NOTHING ELSE NOTICED ---------------------------------------------- @@ -303,7 +304,7 @@ test("relocate a channel's media to another root, and move it back", async ({ expect( ( await readJson<{ mediaDir?: string }>( - `test-transcripts/channels/${SLUG}/config.json`, + `${testPaths().transcriptsDir}/channels/${SLUG}/config.json`, ) ).mediaDir, ).toBe(undefined); @@ -384,7 +385,7 @@ test("the /channels bulk move queues one job per channel and skips the rest", as const preVideo = "20240102_pre1234567"; await mkdir(join(preTarget, preVideo), { recursive: true }); await writeFile(join(preTarget, preVideo, "audio.mp3"), AUDIO); - const preData = resolvePath(`test-transcripts/channels/${PRE}/data/${preVideo}`); + const preData = resolvePath(`${testPaths().transcriptsDir}/channels/${PRE}/data/${preVideo}`); await mkdir(preData, { recursive: true }); await writeFile( join(preData, "transcript.en.vtt"), @@ -397,7 +398,7 @@ test("the /channels bulk move queues one job per channel and skips the rest", as await writeChannelConfig(PRE, { mediaDir: preTarget }); await symlink( preTarget, - resolvePath(`test-transcripts/channels/${PRE}/media`), + resolvePath(`${testPaths().transcriptsDir}/channels/${PRE}/media`), ); await page.goto("/channels"); @@ -454,7 +455,7 @@ test("the /channels bulk move queues one job per channel and skips the rest", as expect( ( await readJson<{ mediaDir?: string }>( - `test-transcripts/channels/${SLUG}/config.json`, + `${testPaths().transcriptsDir}/channels/${SLUG}/config.json`, ) ).mediaDir, ).toBe(join(root, SLUG, "media")); @@ -467,17 +468,17 @@ test("the /channels bulk move queues one job per channel and skips the rest", as expect( ( await readJson<{ mediaDir?: string }>( - `test-transcripts/channels/${PRE}/config.json`, + `${testPaths().transcriptsDir}/channels/${PRE}/config.json`, ) ).mediaDir, ).toBe(preTarget); expect( ( - await lstat(resolvePath(`test-transcripts/channels/${PRE}/media`)) + await lstat(resolvePath(`${testPaths().transcriptsDir}/channels/${PRE}/media`)) ).isSymbolicLink(), ).toBe(true); expect( - await pathExists(`test-transcripts/channels/${PRE}/.relocating.json`), + await pathExists(`${testPaths().transcriptsDir}/channels/${PRE}/.relocating.json`), ).toBe(false); }); @@ -522,13 +523,13 @@ test("a bulk move puts every job on one queue and skips a channel with nothing t }); await mkdir( resolvePath( - `test-transcripts/channels/${SECOND}/data/20240103_second12345`, + `${testPaths().transcriptsDir}/channels/${SECOND}/data/20240103_second12345`, ), { recursive: true }, ); await writeFile( resolvePath( - `test-transcripts/channels/${SECOND}/data/20240103_second12345/transcript.en.vtt`, + `${testPaths().transcriptsDir}/channels/${SECOND}/data/20240103_second12345/transcript.en.vtt`, ), "WEBVTT\n\n00:00.000 --> 00:01.000\nhello\n", ); @@ -643,7 +644,7 @@ test("the Storage panel moves to a location picked by name", async ({ expect( ( await readJson<{ mediaDir?: string }>( - `test-transcripts/channels/${SLUG}/config.json`, + `${testPaths().transcriptsDir}/channels/${SLUG}/config.json`, ) ).mediaDir, ).toBe(target); @@ -698,7 +699,7 @@ test("Resume move finishes an interrupted move and clears its marker", async ({ await writeFile(join(scratch, "meta.json"), "{}"); await writeFile(join(scratch, "win-0000.json"), "[]"); await writeFile( - resolvePath(`test-transcripts/channels/${SLUG}/.relocating.json`), + resolvePath(`${testPaths().transcriptsDir}/channels/${SLUG}/.relocating.json`), JSON.stringify( { target, @@ -736,13 +737,13 @@ test("Resume move finishes an interrupted move and clears its marker", async ({ // Finished like any other move: link, config, no marker. expect( - await pathExists(`test-transcripts/channels/${SLUG}/.relocating.json`), + await pathExists(`${testPaths().transcriptsDir}/channels/${SLUG}/.relocating.json`), ).toBe(false); expect((await lstat(mediaLink())).isSymbolicLink()).toBe(true); expect( ( await readJson<{ mediaDir?: string }>( - `test-transcripts/channels/${SLUG}/config.json`, + `${testPaths().transcriptsDir}/channels/${SLUG}/config.json`, ) ).mediaDir, ).toBe(target); @@ -842,7 +843,7 @@ test("a move that starts while a job writes into the channel refuses, naming the // NOTHING WAS TOUCHED: no marker, no copy, no `media` made, the text a real // directory. expect( - await pathExists(`test-transcripts/channels/${SLUG}/.relocating.json`), + await pathExists(`${testPaths().transcriptsDir}/channels/${SLUG}/.relocating.json`), ).toBe(false); expect(await existsAbs(join(root, SLUG))).toBe(false); expect(await existsAbs(mediaLink())).toBe(false); @@ -940,7 +941,7 @@ test("the rack and the Storage panel show the hold while a marker stands, and it await quiet(page); const target = join(testInfo.outputPath("hold-root"), SLUG, "media"); await writeFile( - resolvePath(`test-transcripts/channels/${SLUG}/.relocating.json`), + resolvePath(`${testPaths().transcriptsDir}/channels/${SLUG}/.relocating.json`), JSON.stringify({ target, direction: "out", @@ -975,7 +976,7 @@ test("the rack and the Storage panel show the hold while a marker stands, and it await expect(async () => { if (await clear.isVisible()) await clear.click({ timeout: 2_000 }); expect( - await pathExists(`test-transcripts/channels/${SLUG}/.relocating.json`), + await pathExists(`${testPaths().transcriptsDir}/channels/${SLUG}/.relocating.json`), ).toBe(false); }).toPass({ timeout: 20_000 }); await forgetCaches(); @@ -1022,7 +1023,7 @@ test("Reconcile and resume settles an extra and a changed file on the destinatio '[{"stale":true,"from":"an older copy"}]', ); await writeFile( - resolvePath(`test-transcripts/channels/${SLUG}/.relocating.json`), + resolvePath(`${testPaths().transcriptsDir}/channels/${SLUG}/.relocating.json`), JSON.stringify({ target, direction: "out", @@ -1052,7 +1053,7 @@ test("Reconcile and resume settles an extra and a changed file on the destinatio // Finished: link, config, no marker; the copy is the source's two files. expect( - await pathExists(`test-transcripts/channels/${SLUG}/.relocating.json`), + await pathExists(`${testPaths().transcriptsDir}/channels/${SLUG}/.relocating.json`), ).toBe(false); expect((await lstat(mediaLink())).isSymbolicLink()).toBe(true); expect(await existsAbs(scratch)).toBe(false); @@ -1149,7 +1150,7 @@ test("the Storage panel evicts this channel's old clip windows", async ({ await resetData("one-youtube-channel-with-data"); await writeSettings({ minFreeDiskGB: 0 }); const clipsDir = resolvePath( - `test-transcripts/channels/${SLUG}/data/${VIDEO}/clips`, + `${testPaths().transcriptsDir}/channels/${SLUG}/data/${VIDEO}/clips`, ); await mkdir(clipsDir, { recursive: true }); const old = join(clipsDir, "10.00-40.00.mp4"); @@ -1175,7 +1176,7 @@ test("the Storage panel evicts this channel's old clip windows", async ({ const clipsBytesOf = async () => ( await readJson<{ totalClipsBytes?: number }>( - `test-transcripts/channels/${SLUG}/snapshot.json`, + `${testPaths().transcriptsDir}/channels/${SLUG}/snapshot.json`, ) ).totalClipsBytes ?? 0; const before = await clipsBytesOf(); @@ -1332,12 +1333,12 @@ test("a digest runs on a channel whose media drive is away", async ({ await writeDigestVideo({ channelSlug: CHANNEL, videoId: DIGEST_VIDEO }); await symlink( target, - resolvePath(`test-transcripts/channels/${CHANNEL}/media`), + resolvePath(`${testPaths().transcriptsDir}/channels/${CHANNEL}/media`), ); await symlink( join("..", "..", "media", DIGEST_VIDEO, "audio.mp3"), resolvePath( - `test-transcripts/channels/${CHANNEL}/data/${DIGEST_VIDEO}/audio.mp3`, + `${testPaths().transcriptsDir}/channels/${CHANNEL}/data/${DIGEST_VIDEO}/audio.mp3`, ), ); await forgetCaches(); @@ -1355,7 +1356,7 @@ test("a digest runs on a channel whose media drive is away", async ({ ); expect( await pathExists( - `test-transcripts/channels/${CHANNEL}/data/${DIGEST_VIDEO}/ai-digest.json`, + `${testPaths().transcriptsDir}/channels/${CHANNEL}/data/${DIGEST_VIDEO}/ai-digest.json`, ), ).toBe(true); }); diff --git a/editor/e2e/channel-work.spec.ts b/editor/e2e/channel-work.spec.ts @@ -1,17 +1,17 @@ import { mkdir, writeFile } from "node:fs/promises"; import { dirname } from "node:path"; import { test, expect } from "@playwright/test"; -import { resetData, resolvePath, readJson, jobRowByKind, generateReport} from "./helpers"; +import { resetData, resolvePath, readJson, jobRowByKind, generateReport, testPaths } from "./helpers"; // The channel-work tables on the operation pages, and the report controls on // /channels. This file was actionable.spec.ts: /actionable rendered all of it // on one page, and slice 4 sent each section to the page that owns the work. const YT_SNAPSHOT_REL = - "test-transcripts/channels/test-youtube/snapshot.json"; -const YT_CONFIG_REL = "test-transcripts/channels/test-youtube/config.json"; + `${testPaths().transcriptsDir}/channels/test-youtube/snapshot.json`; +const YT_CONFIG_REL = `${testPaths().transcriptsDir}/channels/test-youtube/config.json`; const TR_SNAPSHOT_REL = - "test-transcripts/channels/test-transcribe/snapshot.json"; + `${testPaths().transcriptsDir}/channels/test-transcribe/snapshot.json`; async function writeJson(relPath: string, value: unknown): Promise<void> { const full = resolvePath(relPath); diff --git a/editor/e2e/channels-storage-columns.spec.ts b/editor/e2e/channels-storage-columns.spec.ts @@ -9,6 +9,7 @@ import { resolvePath, writeChannelConfig, writeSettings, + testPaths, } from "./helpers"; // /channels AS THE STORAGE WORKING SURFACE. @@ -38,7 +39,7 @@ const VIDEO = "20240101_test1234567"; // chat, what a move carries. The fixture has none, so one is written. async function giveAudio(slug: string, id: string, bytes = 4096) { await writeFile( - resolvePath(`test-transcripts/channels/${slug}/data/${id}/audio.mp3`), + resolvePath(`${testPaths().transcriptsDir}/channels/${slug}/data/${id}/audio.mp3`), "x".repeat(bytes), ); } @@ -50,7 +51,7 @@ async function giveAudio(slug: string, id: string, bytes = 4096) { // rather than by running a move — what is under test is the COLUMN, and a real // rsync buys nothing here. async function relocateOnDisk(slug: string, root: string): Promise<string> { - const channelDir = resolvePath(`test-transcripts/channels/${slug}`); + const channelDir = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}`); const target = join(root, slug, "media"); await mkdir(target, { recursive: true }); for (const id of await readdir(join(channelDir, "data"))) { @@ -70,7 +71,7 @@ async function relocateOnDisk(slug: string, root: string): Promise<string> { } await symlink(target, join(channelDir, "media")); const config = await readJson<Record<string, unknown>>( - `test-transcripts/channels/${slug}/config.json`, + `${testPaths().transcriptsDir}/channels/${slug}/config.json`, ); await writeChannelConfig(slug, { ...config, mediaDir: target }); await fetch(`${baseUrl}/api/test/invalidate-cache`).catch(() => {}); @@ -155,7 +156,7 @@ test("filter by volume, sort by size, and free up N GB", async ({ url: "https://www.youtube.com/@second", }); await mkdir( - resolvePath(`test-transcripts/channels/${SECOND}/data/20240102_second0001`), + resolvePath(`${testPaths().transcriptsDir}/channels/${SECOND}/data/20240102_second0001`), { recursive: true }, ); await giveAudio(SLUG, VIDEO); diff --git a/editor/e2e/channels.spec.ts b/editor/e2e/channels.spec.ts @@ -5,6 +5,7 @@ import { pathExists, readJson, resetData, + testPaths, } from "./helpers"; test("shows empty state with no channels", async ({ page }) => { @@ -25,7 +26,7 @@ test("creates a youtube channel", async ({ page }) => { await page.getByRole("button", { name: /create channel/i }).click(); await page.waitForURL("**/channels/new-test", { timeout: 10_000 }); expect( - await readJson("test-transcripts/channels/new-test/config.json"), + await readJson(`${testPaths().transcriptsDir}/channels/new-test/config.json`), ).toEqual({ handling: "youtube", name: "New Test Channel", @@ -44,7 +45,7 @@ test("auto-detects twitch platform from URL", async ({ page }) => { await page.getByRole("button", { name: /create channel/i }).click(); await page.waitForURL("**/channels/twitch-test", { timeout: 10_000 }); const config = await readJson<{ platform?: string; url?: string }>( - "test-transcripts/channels/twitch-test/config.json", + `${testPaths().transcriptsDir}/channels/twitch-test/config.json`, ); expect(config.platform).toBe("twitch"); }); @@ -76,7 +77,7 @@ test("edits an existing channel", async ({ page }) => { await page.getByRole("button", { name: /save changes/i }).click(); await expect(page.getByText("Renamed Channel").first()).toBeVisible(); const config = await readJson<{ name?: string }>( - "test-transcripts/channels/test-youtube/config.json", + `${testPaths().transcriptsDir}/channels/test-youtube/config.json`, ); expect(config.name).toBe("Renamed Channel"); }); @@ -91,12 +92,12 @@ test("requires typed-confirmation to delete", async ({ page }) => { await page.getByLabel("confirm slug to delete").fill("wrong-slug"); await page.getByRole("button", { name: /delete channel/i }).click(); await expect(page.getByText(/type the channel slug/i)).toBeVisible(); - expect(await pathExists("test-transcripts/channels/test-youtube")).toBe(true); + expect(await pathExists(`${testPaths().transcriptsDir}/channels/test-youtube`)).toBe(true); await page.getByLabel("confirm slug to delete").fill("test-youtube"); await page.getByRole("button", { name: /delete channel/i }).click(); await page.waitForURL("**/channels", { timeout: 10_000 }); - expect(await pathExists("test-transcripts/channels/test-youtube")).toBe(false); + expect(await pathExists(`${testPaths().transcriptsDir}/channels/test-youtube`)).toBe(false); }); test("hides transcribe form fields for youtube channels (cosmetic)", async ({ diff --git a/editor/e2e/chat-only.spec.ts b/editor/e2e/chat-only.spec.ts @@ -9,6 +9,7 @@ import { resetData, resolvePath, writeSite, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; @@ -27,7 +28,7 @@ import { baseUrl } from "./baseUrl"; // missingNeverFetched and enter the published site as blank pages. const CHANNEL = "test-filter"; -const ROOT = `test-transcripts/channels/${CHANNEL}`; +const ROOT = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; const GUEST = ["guestvid0001", "guestvid0002"]; const PLAIN = ["plainvid0001", "plainvid0002"]; // The fixture's cookie-gated video. Its METADATA SCAN is refused without @@ -241,7 +242,7 @@ test("before the chat lands it is chatOnlyPending, which is download-lane work", // admitted, published with its chat track, and carries no cues. const INDEX_CHANNEL = "test-youtube"; const INDEX_DIR = "20240101_test1234567"; -const INDEX_DATA = `test-transcripts/channels/${INDEX_CHANNEL}/data/${INDEX_DIR}`; +const INDEX_DATA = `${testPaths().transcriptsDir}/channels/${INDEX_CHANNEL}/data/${INDEX_DIR}`; test("the export publishes a chat-only video as a chat track with no captions", async ({ page, @@ -279,7 +280,7 @@ test("the export publishes a chat-only video as a chat track with no captions", const subsPage = await readJson< Array<{ id: string; tracks?: Record<string, unknown[]> }> - >(`test-transcripts/.export-index/shared/subs/${INDEX_CHANNEL}/page-0000.json`); + >(`${testPaths().transcriptsDir}/.export-index/shared/subs/${INDEX_CHANNEL}/page-0000.json`); const detail = subsPage.find((d) => d.id === INDEX_DIR); expect(detail).toBeDefined(); expect(Object.keys(detail?.tracks ?? {})).toEqual(["live_chat"]); @@ -288,7 +289,7 @@ test("the export publishes a chat-only video as a chat track with no captions", // And no captions: the transcripts shard carries the video (it has metadata) // with no cues at all. const transcriptsPage = await readJson<Array<{ id: string; cues?: unknown[] }>>( - `test-transcripts/.export-index/shared/transcripts/${INDEX_CHANNEL}/page-0000.json`, + `${testPaths().transcriptsDir}/.export-index/shared/transcripts/${INDEX_CHANNEL}/page-0000.json`, ); const t = transcriptsPage.find((d) => d.id === INDEX_DIR); expect(t).toBeDefined(); diff --git a/editor/e2e/chough.spec.ts b/editor/e2e/chough.spec.ts @@ -7,10 +7,11 @@ import { resetData, resolvePath, writeSettings, + testPaths, } from "./helpers"; const CHANNEL = "test-transcribe"; -const DATA = `test-transcripts/channels/${CHANNEL}/data`; +const DATA = `${testPaths().transcriptsDir}/channels/${CHANNEL}/data`; // Minimal metadata so transcribeOne's normalize pass runs (it needs // metadata.info.json) and writes transcript.cues.json. diff --git a/editor/e2e/cleanup-actionable.spec.ts b/editor/e2e/cleanup-actionable.spec.ts @@ -1,11 +1,11 @@ import { mkdir, writeFile } from "node:fs/promises"; import { dirname } from "node:path"; import { test, expect } from "@playwright/test"; -import { resetData, resolvePath, jobRowByKind } from "./helpers"; +import { resetData, resolvePath, jobRowByKind, testPaths } from "./helpers"; import { baseUrl } from "./baseUrl"; const SLUG = "test-transcribe"; -const SNAPSHOT_REL = `test-transcripts/channels/${SLUG}/snapshot.json`; +const SNAPSHOT_REL = `${testPaths().transcriptsDir}/channels/${SLUG}/snapshot.json`; async function writeJson(relPath: string, value: unknown): Promise<void> { const full = resolvePath(relPath); diff --git a/editor/e2e/cleanup-holds.spec.ts b/editor/e2e/cleanup-holds.spec.ts @@ -7,6 +7,7 @@ import { resolvePath, writeChannelConfig, writeSettings, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; @@ -22,10 +23,10 @@ import { baseUrl } from "./baseUrl"; const SLUG = "test-transcribe"; const STALE = "stale-report"; -const SNAPSHOT_REL = `test-transcripts/channels/${SLUG}/snapshot.json`; +const SNAPSHOT_REL = `${testPaths().transcriptsDir}/channels/${SLUG}/snapshot.json`; function dataRel(videoId: string, file: string): string { - return `test-transcripts/channels/${SLUG}/data/${videoId}/${file}`; + return `${testPaths().transcriptsDir}/channels/${SLUG}/data/${videoId}/${file}`; } async function seedTranscript(videoId: string): Promise<void> { @@ -184,7 +185,7 @@ test("a report written before the hold accounting renders '—', not a zero nobo await writeChannelConfig(STALE); // Exactly what an older snapshot looks like: reclaim estimate, no accounting. await writeFile( - resolvePath(`test-transcripts/channels/${STALE}/snapshot.json`), + resolvePath(`${testPaths().transcriptsDir}/channels/${STALE}/snapshot.json`), JSON.stringify({ generatedAt: "2026-01-01T00:00:00.000Z", totals: { videos: 1, transcribed: 1, downloaded: 1 }, diff --git a/editor/e2e/cleanup-page.spec.ts b/editor/e2e/cleanup-page.spec.ts @@ -1,6 +1,6 @@ import { writeFile } from "node:fs/promises"; import { test, expect } from "@playwright/test"; -import { readJson, resetData, resolvePath, generateReport } from "./helpers"; +import { readJson, resetData, resolvePath, generateReport, testPaths } from "./helpers"; import { baseUrl } from "./baseUrl"; import type { ChannelConfig } from "yt-dlp-transcript-common/lib/channelConfig"; @@ -10,10 +10,10 @@ import type { ChannelConfig } from "yt-dlp-transcript-common/lib/channelConfig"; // total without disabling its sweeps. See editor/app/cleanup/*. const SLUG = "test-transcribe"; -const CONFIG_REL = `test-transcripts/channels/${SLUG}/config.json`; +const CONFIG_REL = `${testPaths().transcriptsDir}/channels/${SLUG}/config.json`; function dataRel(videoId: string, file: string): string { - return `test-transcripts/channels/${SLUG}/data/${videoId}/${file}`; + return `${testPaths().transcriptsDir}/channels/${SLUG}/data/${videoId}/${file}`; } async function seedTranscript(videoId: string): Promise<void> { diff --git a/editor/e2e/cookies-mode.spec.ts b/editor/e2e/cookies-mode.spec.ts @@ -10,6 +10,7 @@ import { resetData, resolvePath, writeSettings, + testPaths, } from "./helpers"; // Configurable cookies-from-browser: global + per-channel value, and a cookie @@ -21,7 +22,7 @@ import { const CHANNEL = "test-cookies"; const FIXTURE = "cookies-mode-channel"; -const ROOT = `test-transcripts/channels/${CHANNEL}`; +const ROOT = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; const COOKIES = "firefox:test"; const here = path.dirname(fileURLToPath(import.meta.url)); @@ -45,7 +46,7 @@ async function defaultSettings(): Promise<Record<string, unknown>> { async function readInvocations(): Promise<string> { try { return await readFile( - path.join(here, "..", ROOT, "fake-ytdlp.invocations"), + path.join(ROOT, "fake-ytdlp.invocations"), "utf8", ); } catch { @@ -87,7 +88,7 @@ test("settings: cookie value + mode round-trip through the form", async ({ const saved = await readJson<{ cookiesFromBrowser?: string; cookieMode?: string; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(saved.cookiesFromBrowser).toBe(COOKIES); expect(saved.cookieMode).toBe("always"); diff --git a/editor/e2e/cut-release.spec.ts b/editor/e2e/cut-release.spec.ts @@ -1,6 +1,6 @@ import { readFile, writeFile } from "node:fs/promises"; import { test, expect } from "@playwright/test"; -import { resolvePath } from "./helpers"; +import { resolvePath, testPaths } from "./helpers"; // This spec drives a flow that REWRITES a changelog file and can make a real // git commit. It used to point at the repo's own tracked editor/CHANGELOG.md, @@ -14,7 +14,7 @@ import { resolvePath } from "./helpers"; // same file the /changelog page reads (common/lib/paths.ts editorChangelogFile). // "Commit changelog" is unchecked in every test below: none of them assert // anything about git, and leaving it on would try to `git add` an ignored file. -const CHANGELOG_PATH = resolvePath("test-changelog.md"); +const CHANGELOG_PATH = resolvePath(testPaths().editorChangelog); const WITH_UNRELEASED = "# Changelog\n" + diff --git a/editor/e2e/dashboard-answers.spec.ts b/editor/e2e/dashboard-answers.spec.ts @@ -8,6 +8,7 @@ import { generateReport, resetData, resolvePath, + testPaths, } from "./helpers"; // THE DASHBOARD ANSWERS WHILE A REPORT REGENERATES (release 17 slice D0). @@ -53,7 +54,7 @@ const BIG = ["big-channel-a", "big-channel-b"]; const BIG_VIDEOS = 600; async function seedBigChannel(slug: string): Promise<void> { - const channelDir = resolvePath(`test-transcripts/channels/${slug}`); + const channelDir = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}`); const dataDir = join(channelDir, "data"); await mkdir(dataDir, { recursive: true }); await writeFile( @@ -74,7 +75,7 @@ async function seedBigChannel(slug: string): Promise<void> { { url: "seg1", duration: 6 }, ], })); - const template = resolvePath(`test-transcripts/.${slug}-meta.json`); + const template = resolvePath(`${testPaths().transcriptsDir}/.${slug}-meta.json`); await writeFile( template, JSON.stringify({ id: "native", title: "A long VOD", duration: 3600, formats }), @@ -169,7 +170,7 @@ test("/ and /jobs answer while two large reports regenerate, one after the other expect(done.body.jobIds).toHaveLength(2); const ended = async (): Promise<boolean> => { for (const id of done.body.jobIds ?? []) { - const m = await readFile(resolvePath(`test-transcripts/.jobs/${id}.meta.json`), "utf8") + const m = await readFile(resolvePath(`${testPaths().transcriptsDir}/.jobs/${id}.meta.json`), "utf8") .then((raw) => JSON.parse(raw) as JobMetaOnDisk) .catch(() => null); if (!m || m.status === "queued" || m.status === "running") return false; @@ -197,7 +198,7 @@ test("/ and /jobs answer while two large reports regenerate, one after the other for (const slug of BIG) { const snapshot = JSON.parse( await readFile( - resolvePath(`test-transcripts/channels/${slug}/snapshot.json`), + resolvePath(`${testPaths().transcriptsDir}/channels/${slug}/snapshot.json`), "utf8", ), ) as { totals: { videos: number } }; @@ -212,7 +213,7 @@ test("/ and /jobs answer while two large reports regenerate, one after the other (done.body.jobIds ?? []).map( async (id) => JSON.parse( - await readFile(resolvePath(`test-transcripts/.jobs/${id}.meta.json`), "utf8"), + await readFile(resolvePath(`${testPaths().transcriptsDir}/.jobs/${id}.meta.json`), "utf8"), ) as JobMetaOnDisk, ), ); @@ -280,7 +281,7 @@ async function quiet(page: Page): Promise<void> { // leaves it: queued and started an hour ago, its log last written then. async function plantGhost(pid: number): Promise<string> { const id = ulid(Date.now() - 60 * 60 * 1000); - const jobsDir = resolvePath("test-transcripts/.jobs"); + const jobsDir = resolvePath(`${testPaths().transcriptsDir}/.jobs`); await mkdir(jobsDir, { recursive: true }); const at = Date.now() - 60 * 60 * 1000; await writeFile( @@ -305,7 +306,7 @@ async function plantGhost(pid: number): Promise<string> { async function metaOf(id: string): Promise<{ status: string; cancelReason?: string }> { return JSON.parse( - await readFile(resolvePath(`test-transcripts/.jobs/${id}.meta.json`), "utf8"), + await readFile(resolvePath(`${testPaths().transcriptsDir}/.jobs/${id}.meta.json`), "utf8"), ); } diff --git a/editor/e2e/dashboard-paths.spec.ts b/editor/e2e/dashboard-paths.spec.ts @@ -1,11 +1,11 @@ import { test, expect } from "@playwright/test"; -import { resetData, resolvePath } from "./helpers"; +import { resetData, resolvePath, testPaths } from "./helpers"; test("dashboard does not display 'transcripts dir' or the actual path", async ({ page, }) => { await resetData("empty"); - const abs = resolvePath("test-transcripts"); + const abs = resolvePath(testPaths().transcriptsDir); await page.goto("/"); const body = page.locator("body"); await expect(body).not.toContainText("transcripts dir"); diff --git a/editor/e2e/dashboard.spec.ts b/editor/e2e/dashboard.spec.ts @@ -5,7 +5,7 @@ // persisted downloads pause blocking a manual sync. import { test, expect } from "@playwright/test"; -import { resetData, writeSettings, readJson, generateReport} from "./helpers"; +import { resetData, writeSettings, readJson, generateReport, testPaths } from "./helpers"; const ONE_WORKER = { workers: [ @@ -96,7 +96,7 @@ test("pausing downloads persists and blocks a manual sync", async ({ page }) => .poll(async () => { const s = await readJson<{ autoQueue?: { download?: { held?: boolean } }; - }>("test-settings.json"); + }>(testPaths().settingsFile); return s.autoQueue?.download?.held; }) .toBe(true); diff --git a/editor/e2e/diagnostics-retry-log.spec.ts b/editor/e2e/diagnostics-retry-log.spec.ts @@ -7,6 +7,7 @@ import { readJson, resetData, resolvePath, + testPaths, } from "./helpers"; // A DIAGNOSTICS RETRY KEEPS ITS LOG WHEN ITS BUCKET EMPTIES (release 13 slice @@ -25,7 +26,7 @@ import { const CHANNEL = "availability-test"; const FIXTURE = "availability-baseline"; -const ROOT = `test-transcripts/channels/${CHANNEL}`; +const ROOT = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; type Snapshot = { buckets?: { noMetadata?: string[] }; diff --git a/editor/e2e/diarization.spec.ts b/editor/e2e/diarization.spec.ts @@ -8,6 +8,7 @@ import { resetData, resolvePath, writeSettings, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; @@ -20,10 +21,10 @@ import { baseUrl } from "./baseUrl"; // in the dev:test / start:test scripts the way every other fake binary is. const SLUG = "test-transcribe"; -const SNAPSHOT_REL = `test-transcripts/channels/${SLUG}/snapshot.json`; +const SNAPSHOT_REL = `${testPaths().transcriptsDir}/channels/${SLUG}/snapshot.json`; function dataRel(videoId: string, file: string): string { - return `test-transcripts/channels/${SLUG}/data/${videoId}/${file}`; + return `${testPaths().transcriptsDir}/channels/${SLUG}/data/${videoId}/${file}`; } async function seedTranscript(videoId: string): Promise<void> { diff --git a/editor/e2e/digest.spec.ts b/editor/e2e/digest.spec.ts @@ -23,6 +23,7 @@ import { writeChannelConfig, writeDigestVideo, writeSettings, + testPaths, } from "./helpers"; // The digest lane, end to end through the real job path. @@ -42,12 +43,12 @@ const CHANNEL = "digest-channel"; const VIDEO = "digestvid0001"; function digestPath(channel: string, video: string): string { - return join("test-transcripts", "channels", channel, "data", video, "ai-digest.json"); + return join(testPaths().transcriptsDir, "channels", channel, "data", video, "ai-digest.json"); } function overridesPath(channel: string, video: string): string { return join( - "test-transcripts", + testPaths().transcriptsDir, "channels", channel, "data", @@ -235,7 +236,7 @@ async function writeDuplicateReport(clusters: ClusterFixture[]) { })), }; await writeFile( - resolvePath(join("test-transcripts", "duplicates.json")), + resolvePath(join(testPaths().transcriptsDir, "duplicates.json")), JSON.stringify(report, null, 2), ); } @@ -342,7 +343,7 @@ test("a human canonical override beats the rule", async ({ page }) => { }, ]); await writeFile( - resolvePath(join("test-transcripts", "duplicates.overrides.json")), + resolvePath(join(testPaths().transcriptsDir, "duplicates.overrides.json")), JSON.stringify({ version: 1, clusters: { @@ -547,10 +548,10 @@ test("bad engine output is recorded in warnings and never reaches items", async test.afterAll(async () => { // duplicates.json / duplicates.overrides.json live at the transcripts ROOT, so // they survive a channel-scoped reset and would leak into unrelated specs. - await rm(resolvePath(join("test-transcripts", "duplicates.json")), { + await rm(resolvePath(join(testPaths().transcriptsDir, "duplicates.json")), { force: true, }); - await rm(resolvePath(join("test-transcripts", "duplicates.overrides.json")), { + await rm(resolvePath(join(testPaths().transcriptsDir, "duplicates.overrides.json")), { force: true, }); }); @@ -774,7 +775,7 @@ async function regenerateReport( page: import("@playwright/test").Page, slug: string, ): Promise<void> { - await rm(resolvePath(`test-transcripts/channels/${slug}/snapshot.json`), { + await rm(resolvePath(`${testPaths().transcriptsDir}/channels/${slug}/snapshot.json`), { force: true, }); await generateReport(page, slug); @@ -794,7 +795,7 @@ test("a transcript with no cues.json is deferred, and Normalize transcripts make }); const cuesRel = join( - "test-transcripts", + testPaths().transcriptsDir, "channels", CHANNEL, "data", diff --git a/editor/e2e/disk-space.spec.ts b/editor/e2e/disk-space.spec.ts @@ -7,6 +7,7 @@ import { resetData, resolvePath, writeSettings, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; @@ -46,7 +47,7 @@ test("prevents a download from starting when free disk is below the floor", asyn // Nothing was downloaded. expect( await pathExists( - "test-transcripts/channels/test-pipeline/data/fake00000001/metadata.info.json", + `${testPaths().transcriptsDir}/channels/test-pipeline/data/fake00000001/metadata.info.json`, ), ).toBe(false); }); @@ -73,7 +74,7 @@ test("lets downloads proceed when the gate is disabled (0)", async ({ ).toContainText("Managed download complete", { timeout: 60_000 }); expect( await pathExists( - "test-transcripts/channels/test-pipeline/data/fake00000001/metadata.info.json", + `${testPaths().transcriptsDir}/channels/test-pipeline/data/fake00000001/metadata.info.json`, ), ).toBe(true); }); @@ -81,7 +82,7 @@ test("lets downloads proceed when the gate is disabled (0)", async ({ // A YouTube channel with undownloaded videos, enough for the auto-download // runner to have something to pick. Mirrors auto-queue.spec's fixture. async function makeDownloadChannel(slug: string, ids: string[]) { - const root = resolvePath(`test-transcripts/channels/${slug}`); + const root = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}`); await mkdir(`${root}/data`, { recursive: true }); await writeFile( `${root}/config.json`, @@ -171,7 +172,7 @@ test("the unattended auto-download runner idles below the floor", async ({ expect(body.download.picks).toHaveLength(0); // And nothing landed on disk. expect( - await pathExists("test-transcripts/channels/alpha/data/d1"), + await pathExists(`${testPaths().transcriptsDir}/channels/alpha/data/d1`), ).toBe(false); } finally { await request.post(`${baseUrl}/api/auto-queue/control`, { diff --git a/editor/e2e/do-not-clean.spec.ts b/editor/e2e/do-not-clean.spec.ts @@ -7,6 +7,7 @@ import { readJson, resetData, resolvePath, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; @@ -21,10 +22,10 @@ function formatBytes(bytes: number): string { } const SLUG = "test-transcribe"; -const SNAPSHOT_REL = `test-transcripts/channels/${SLUG}/snapshot.json`; +const SNAPSHOT_REL = `${testPaths().transcriptsDir}/channels/${SLUG}/snapshot.json`; function dataRel(videoId: string, file: string): string { - return `test-transcripts/channels/${SLUG}/data/${videoId}/${file}`; + return `${testPaths().transcriptsDir}/channels/${SLUG}/data/${videoId}/${file}`; } // Give vidA and vidB a whisper transcript so both qualify for the diff --git a/editor/e2e/download-format-guard.spec.ts b/editor/e2e/download-format-guard.spec.ts @@ -22,6 +22,7 @@ import { readJson, resetData, resolvePath, + testPaths, } from "./helpers"; type DownloadOutcome = { @@ -44,7 +45,7 @@ async function makeChannel( ids: string[], config: Record<string, unknown> = {}, ): Promise<void> { - const root = resolvePath(`test-transcripts/channels/${slug}`); + const root = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}`); await mkdir(`${root}/data`, { recursive: true }); await writeFile( `${root}/config.json`, @@ -74,7 +75,7 @@ async function downloadAll(page: import("@playwright/test").Page, slug: string) async function outcome(slug: string, id: string): Promise<DownloadOutcome> { return readJson<DownloadOutcome>( - `test-transcripts/channels/${slug}/data/${id}/download-outcome.json`, + `${testPaths().transcriptsDir}/channels/${slug}/data/${id}/download-outcome.json`, ); } @@ -117,11 +118,11 @@ test("duration guard flags a source-truncated download and keeps the stub", asyn expect(truncOutcome.shortAudio?.expectedDurationSec).toBe(6000); expect(truncOutcome.shortAudio?.audioDurationSec).toBe(120); expect( - await pathExists(`test-transcripts/channels/${SLUG}/data/${TRUNC}/audio.mp3`), + await pathExists(`${testPaths().transcriptsDir}/channels/${SLUG}/data/${TRUNC}/audio.mp3`), ).toBe(true); expect( await pathExists( - `test-transcripts/channels/${SLUG}/data/${TRUNC}/transcript.json`, + `${testPaths().transcriptsDir}/channels/${SLUG}/data/${TRUNC}/transcript.json`, ), ).toBe(false); @@ -180,7 +181,7 @@ test("the short-audio re-download's log survives the refresh that clears the ban await makeChannel(SLUG, [ID]); // Seed the flagged state directly (the kept short stub plus the guard's // sidecar) rather than re-running a truncated download for it. - const dir = resolvePath(`test-transcripts/channels/${SLUG}/data/${ID}`); + const dir = resolvePath(`${testPaths().transcriptsDir}/channels/${SLUG}/data/${ID}`); await mkdir(dir, { recursive: true }); await writeFile(`${dir}/audio.mp3`, "fake truncated audio __DUR=120__\n"); await writeFile( @@ -241,7 +242,7 @@ test("download format: Odysee auto picks original; YouTube uses bestaudio; chann await waitForOutcome(SLUG, YT); const invocations = await readFile( - resolvePath(`test-transcripts/channels/${SLUG}/fake-ytdlp.invocations`), + resolvePath(`${testPaths().transcriptsDir}/channels/${SLUG}/fake-ytdlp.invocations`), "utf8", ); expect(invocations).toContain("format:original/bestaudio/worst"); @@ -254,7 +255,7 @@ test("download format: Odysee auto picks original; YouTube uses bestaudio; chann await downloadAll(page, SLUG2); await waitForOutcome(SLUG2, YT2); const inv2 = await readFile( - resolvePath(`test-transcripts/channels/${SLUG2}/fake-ytdlp.invocations`), + resolvePath(`${testPaths().transcriptsDir}/channels/${SLUG2}/fake-ytdlp.invocations`), "utf8", ); expect(inv2).toContain("format:original/bestaudio/worst"); diff --git a/editor/e2e/download-part-files.spec.ts b/editor/e2e/download-part-files.spec.ts @@ -5,6 +5,7 @@ import { generateReport, resetData, resolvePath, + testPaths, } from "./helpers"; // `.part` files are yt-dlp's in-progress download placeholders. They should @@ -19,10 +20,10 @@ test("audio.<ext>.part doesn't count as a complete audio file", async ({ // Turn vidA's only audio file into a .part — should now look undownloaded. await rename( resolvePath( - "test-transcripts/channels/test-transcribe/data/vidA/audio.m4a", + `${testPaths().transcriptsDir}/channels/test-transcribe/data/vidA/audio.m4a`, ), resolvePath( - "test-transcripts/channels/test-transcribe/data/vidA/audio.m4a.part", + `${testPaths().transcriptsDir}/channels/test-transcribe/data/vidA/audio.m4a.part`, ), ); diff --git a/editor/e2e/duplicate-shorts.spec.ts b/editor/e2e/duplicate-shorts.spec.ts @@ -6,6 +6,7 @@ import { resetData, resolvePath, writeSite, + testPaths, } from "./helpers"; // Cross-platform duplicate shorts detection. Seeds four channels with shorts @@ -146,7 +147,7 @@ const PLATFORM_KEY: Record<Seed["platform"], string> = { async function seed(seeds: Seed[] = SEEDS): Promise<void> { const channels = new Set(seeds.map((s) => s.channel)); for (const channel of channels) { - const dir = resolvePath(`test-transcripts/channels/${channel}`); + const dir = resolvePath(`${testPaths().transcriptsDir}/channels/${channel}`); await mkdir(dir, { recursive: true }); await writeFile( `${dir}/config.json`, @@ -154,7 +155,7 @@ async function seed(seeds: Seed[] = SEEDS): Promise<void> { ); } for (const s of seeds) { - const dir = resolvePath(`test-transcripts/channels/${s.channel}/data/${s.id}`); + const dir = resolvePath(`${testPaths().transcriptsDir}/channels/${s.channel}/data/${s.id}`); await mkdir(dir, { recursive: true }); await writeFile( `${dir}/metadata.info.json`, @@ -210,7 +211,7 @@ test("clusters cross-platform near-duplicate shorts (incl. plain VTT) and ignore timeout: 30_000, }); - const report = await readJson<DuplicateReport>("test-transcripts/duplicates.json"); + const report = await readJson<DuplicateReport>(`${testPaths().transcriptsDir}/duplicates.json`); expect(report.runConfig.thresholdSeconds).toBe(180); // The three near-identical shorts cluster together, across platform + channel. @@ -290,7 +291,7 @@ test("all-durations run pulls a long video into the short's cluster via containm timeout: 30_000, }); - const report = await readJson<DuplicateReport>("test-transcripts/duplicates.json"); + const report = await readJson<DuplicateReport>(`${testPaths().transcriptsDir}/duplicates.json`); expect(report.runConfig.thresholdSeconds).toBeNull(); const cluster = clusterWith(report, "yt-a/shorta"); @@ -345,7 +346,7 @@ test("title blocking confirms matching content, rejects differing content, and q timeout: 30_000, }); - const report = await readJson<DuplicateReport>("test-transcripts/duplicates.json"); + const report = await readJson<DuplicateReport>(`${testPaths().transcriptsDir}/duplicates.json`); expect(report.runConfig.blocking).toBe("title"); // (1) CONFIRMED — the content agreed, so this is a real cluster that may share. diff --git a/editor/e2e/exclude-from-counts.spec.ts b/editor/e2e/exclude-from-counts.spec.ts @@ -6,6 +6,7 @@ import { generateReport, resetData, resolvePath, + testPaths, } from "./helpers"; const CHANNEL = "test-transcribe"; @@ -22,7 +23,7 @@ type AvailabilityStatus = async function writeAvailability(id: string, status: AvailabilityStatus) { const path = resolvePath( - `test-transcripts/channels/${CHANNEL}/data/${id}/availability.json`, + `${testPaths().transcriptsDir}/channels/${CHANNEL}/data/${id}/availability.json`, ); await mkdir(dirname(path), { recursive: true }); await writeFile( @@ -62,7 +63,7 @@ test("members-only video is hidden from the Failed transcriptions list", async ( await resetData(FIXTURE); await writeAvailability("vidA", "members_only"); await writeFile( - resolvePath(`test-transcripts/channels/${CHANNEL}/failed-transcriptions`), + resolvePath(`${testPaths().transcriptsDir}/channels/${CHANNEL}/failed-transcriptions`), "vidA\nvidB\n", ); @@ -84,7 +85,7 @@ test("stage badge counts exclude members-only videos", async ({ page }) => { // vidB: stays in both buckets (no availability sidecar). await writeAvailability("vidA", "members_only"); await writeFile( - resolvePath(`test-transcripts/channels/${CHANNEL}/failed-transcriptions`), + resolvePath(`${testPaths().transcriptsDir}/channels/${CHANNEL}/failed-transcriptions`), "vidA\nvidB\n", ); diff --git a/editor/e2e/export-search.spec.ts b/editor/e2e/export-search.spec.ts @@ -1,7 +1,7 @@ import { test, expect, type Page } from "@playwright/test"; import { portFor } from "yt-dlp-transcript-common/lib/ports.mjs"; import { PROJECT_URL } from "../../common/lib/project"; -import { readJson, writeSettings } from "./helpers"; +import { readJson, writeSettings, testPaths } from "./helpers"; const EXPORT_BASE = `http://localhost:${portFor("EXPORT_PORT")}`; @@ -618,7 +618,7 @@ test.describe("export footer", () => { // overrides it instead of showing the global one. Restore afterwards so we // don't leak settings into later tests. const original = await readJson<Record<string, unknown>>( - "test-settings.json", + testPaths().settingsFile, ); try { await writeSettings({ diff --git a/editor/e2e/exportOutLink.ts b/editor/e2e/exportOutLink.ts @@ -10,10 +10,11 @@ import { lstat, readlink, rm } from "node:fs/promises"; import path from "node:path"; import { fileURLToPath } from "node:url"; +import { testPaths } from "./helpers"; const editorDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); const exportOut = path.resolve(editorDir, "..", "export", "out"); -const testTranscripts = path.join(editorDir, "test-transcripts"); +const testTranscripts = testPaths().transcriptsDir; export async function dropTestExportOutLink(when: "setup" | "teardown"): Promise<void> { const st = await lstat(exportOut).catch(() => null); diff --git a/editor/e2e/fetch-window.spec.ts b/editor/e2e/fetch-window.spec.ts @@ -18,6 +18,7 @@ import { resolvePath, writeChannelConfig, writeSettings, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; @@ -28,7 +29,7 @@ const AUTH = { authorization: `Bearer ${TOKEN}` }; // no-info-json rule has to leave untouched. const SLUG = "test-youtube"; const VIDEO = "fake00000002"; -const rel = (p: string) => `test-transcripts/channels/${SLUG}/${p}`; +const rel = (p: string) => `${testPaths().transcriptsDir}/channels/${SLUG}/${p}`; const clipRel = (name: string) => rel(`data/${VIDEO}/clips/${name}`); async function exists(relPath: string): Promise<boolean> { @@ -301,7 +302,7 @@ test("a 429 fails the job and puts the platform in cooldown", async ({ // Nothing half-written is left under the window's name. expect( - await exists(`test-transcripts/channels/${SLUG}/data/ratelimitvid1/clips/5.00-10.00.mp4`), + await exists(`${testPaths().transcriptsDir}/channels/${SLUG}/data/ratelimitvid1/clips/5.00-10.00.mp4`), ).toBe(false); // The cooldown the auto-download runner and a clicked sync both honour. The @@ -376,7 +377,7 @@ test("a batch skips what is cached, survives one 403, and fetches the rest", asy const finished = await pollJob(request, body.jobId, 90_000); expect(finished.status).toBe("failed"); const jobLog = await readFile( - resolvePath(`test-transcripts/.jobs/${body.jobs[0].jobId}.log`), + resolvePath(`${testPaths().transcriptsDir}/.jobs/${body.jobs[0].jobId}.log`), "utf8", ); expect(jobLog.match(/Sleeping \d+s before the next fetch/g)).toEqual([ @@ -391,7 +392,7 @@ test("a batch skips what is cached, survives one 403, and fetches the rest", asy ); expect(sidecar).toMatchObject({ requestedBy: "umtool", manifest: "demo-batch", clipId: "c03" }); expect( - await exists(`test-transcripts/channels/${SLUG}/data/win403vid1/clips/5.00-10.00.mp4`), + await exists(`${testPaths().transcriptsDir}/channels/${SLUG}/data/win403vid1/clips/5.00-10.00.mp4`), ).toBe(false); // One 403 did not back the platform off: the next ask is not refused. diff --git a/editor/e2e/forms-keep-input.spec.ts b/editor/e2e/forms-keep-input.spec.ts @@ -8,6 +8,7 @@ import { resolvePath, writeSettings, writeSite, + testPaths, } from "./helpers"; // A FORM THAT FAILS KEEPS WHAT WAS TYPED (release 16, slice FK). @@ -29,7 +30,7 @@ import { // (EISDIR) and the action returns its error. The file is back before the test // ends, whatever happens. -const SETTINGS = resolvePath("test-settings.json"); +const SETTINGS = resolvePath(testPaths().settingsFile); async function withSettingsUnwritable(fn: () => Promise<void>): Promise<void> { const aside = `${SETTINGS}.fk-aside`; @@ -160,7 +161,7 @@ test("SiteForm edit: a refused Public URL keeps every field", async ({ await expect(named(form, "transcriptDownloads")).not.toBeChecked(); // Nothing was written. const site = await readJson<{ siteTitle: string }>( - "test-transcripts/sites/alpha/site.json", + `${testPaths().transcriptsDir}/sites/alpha/site.json`, ); expect(site.siteTitle).toBe("Alpha Site"); }); @@ -225,7 +226,7 @@ test("SettingsForm: a refused page size keeps every field, and a save after it s ).toBeVisible(); await expect(async () => { const saved = await readJson<{ cookieMode: string; adminTitle: string }>( - "test-settings.json", + testPaths().settingsFile, ); expect(saved.cookieMode).toBe("defer"); expect(saved.adminTitle).toBe("Typed Admin"); @@ -403,7 +404,7 @@ test("ChannelForm edit: a refused filter keeps every field", async ({ await expect(named(form, "downloadFilterExclude")).toHaveValue("(unclosed"); await expect(named(form, "cookieMode")).toHaveValue("defer"); const config = await readJson<{ name: string }>( - "test-transcripts/channels/test-youtube/config.json", + `${testPaths().transcriptsDir}/channels/test-youtube/config.json`, ); expect(config.name).not.toBe("Edited Name"); }); @@ -529,7 +530,7 @@ test("CutReleaseForm: a bad version keeps it and the commit box", async ({ }) => { // The disposable test changelog cut-release.spec.ts drives (never the // repo's own); left with no [Unreleased] heading, as that spec leaves it. - const changelog = resolvePath("test-changelog.md"); + const changelog = resolvePath(testPaths().editorChangelog); const before = await readFile(changelog, "utf8").catch(() => null); await writeFile( changelog, diff --git a/editor/e2e/helpers.ts b/editor/e2e/helpers.ts @@ -11,12 +11,15 @@ import { } from "node:fs/promises"; import { expect, type Page } from "@playwright/test"; import { baseUrl } from "./baseUrl"; +import { testPaths } from "./testPaths"; + +// Every path a spec touches under the test server's data comes from here +// (testPaths() — the worker's own root once there is one per worker). +export { testPaths } from "./testPaths"; const here = dirname(fileURLToPath(import.meta.url)); const editorRoot = resolve(here, ".."); const fixturesRoot = resolve(editorRoot, "e2e", "fixtures"); -const testTranscriptsDir = resolve(editorRoot, "test-transcripts"); -const testSettingsFile = resolve(editorRoot, "test-settings.json"); const defaultTestSettingsFile = resolve( fixturesRoot, "test-settings.default.json", @@ -64,6 +67,7 @@ export async function resetData(fixtureName: string | null = null) { // start-mode gate run lost channel-work.spec:208 to exactly that ("EEXIST: // file already exists, mkdir '…/test-transcripts/channels'"), and an earlier // run no-subs-fallback.spec:114. Quiesce again, clear again, copy again. + const { transcriptsDir: testTranscriptsDir, settingsFile: testSettingsFile } = testPaths(); for (let attempt = 1; ; attempt++) { await fetch(`${baseUrl}/api/test/invalidate-cache`).catch(() => {}); await rm(testTranscriptsDir, { @@ -140,7 +144,7 @@ export async function writeSettings(settings: SettingsPatch) { merged[key] = { ...base[key], ...value }; } } - await writeFile(testSettingsFile, JSON.stringify(merged, null, 2)); + await writeFile(testPaths().settingsFile, JSON.stringify(merged, null, 2)); await fetch(`${baseUrl}/api/test/invalidate-cache`).catch(() => {}); } @@ -151,7 +155,7 @@ export async function writeSite( siteId: string, site: Record<string, unknown> = {}, ) { - const dir = join(testTranscriptsDir, "sites", siteId); + const dir = join(testPaths().transcriptsDir, "sites", siteId); await mkdir(dir, { recursive: true }); const full = { siteId, @@ -213,7 +217,7 @@ export async function generateReport( page: Page, slug: string, ): Promise<void> { - const snapshotRel = `test-transcripts/channels/${slug}/snapshot.json`; + const snapshotRel = `${testPaths().transcriptsDir}/channels/${slug}/snapshot.json`; if (await pathExists(snapshotRel)) return; await page.goto(`/channels/${slug}`); const button = page.getByRole("button", { name: /refresh report/i }); @@ -244,7 +248,7 @@ export async function copyFixture(name: string) { const dst = join(fixturesRoot, "test-transcripts", name); await rm(dst, { recursive: true, force: true }); await mkdir(dst, { recursive: true }); - await cp(testTranscriptsDir, dst, { recursive: true }); + await cp(testPaths().transcriptsDir, dst, { recursive: true }); } // --------------------------------------------------------------------------- @@ -312,7 +316,7 @@ export async function writeDigestVideo(opts: { startOffsetSeconds = 0, skipCuesJson = false, } = opts; - const dir = join(testTranscriptsDir, "channels", channelSlug, "data", videoId); + const dir = join(testPaths().transcriptsDir, "channels", channelSlug, "data", videoId); await mkdir(dir, { recursive: true }); // Every cue's words are GLOBALLY UNIQUE. measureAlignment anchors on 8-word @@ -454,7 +458,7 @@ export async function writeChannelConfig( channelSlug: string, config: Record<string, unknown> = {}, ) { - const dir = join(testTranscriptsDir, "channels", channelSlug); + const dir = join(testPaths().transcriptsDir, "channels", channelSlug); await mkdir(dir, { recursive: true }); await writeFile( join(dir, "config.json"), diff --git a/editor/e2e/import-video.spec.ts b/editor/e2e/import-video.spec.ts @@ -6,6 +6,7 @@ import { pathExists, resetData, resolvePath, + testPaths, } from "./helpers"; // The Playlist stage's "Import single video" panel fetches one off-playlist @@ -41,7 +42,7 @@ test("import single video by URL fetches it and appends to the archive", async ( .poll( () => pathExists( - "test-transcripts/channels/test-pipeline/data/oneoff00001/metadata.info.json", + `${testPaths().transcriptsDir}/channels/test-pipeline/data/oneoff00001/metadata.info.json`, ), { timeout: 30_000 }, ) @@ -50,7 +51,7 @@ test("import single video by URL fetches it and appends to the archive", async ( // And it's recorded in the channel archive so a later sync won't re-fetch it. await expect(async () => { const archive = await readFile( - resolvePath("test-transcripts/channels/test-pipeline/archive"), + resolvePath(`${testPaths().transcriptsDir}/channels/test-pipeline/archive`), "utf8", ); expect(archive).toContain("youtube oneoff00001"); @@ -100,14 +101,14 @@ test("a BitChute import runs on BitChute's queue and pace, and is never fetched }); await expect(log).toContainText("--sleep-requests 3"); - const metaPath = `test-transcripts/channels/test-transcribe/data/${id}/metadata.info.json`; + const metaPath = `${testPaths().transcriptsDir}/channels/test-transcribe/data/${id}/metadata.info.json`; await expect.poll(() => pathExists(metaPath), { timeout: 30_000 }).toBe(true); const meta = JSON.parse(await readFile(resolvePath(metaPath), "utf8")); expect(meta.extractor_key).toBe("BitChute"); // The job ran on BitChute's queue, not the channel's. await expect(async () => { - const dir = resolvePath("test-transcripts/.jobs"); + const dir = resolvePath(`${testPaths().transcriptsDir}/.jobs`); const queues: string[] = []; for (const name of await readdir(dir)) { if (!name.endsWith(".meta.json")) continue; @@ -120,7 +121,7 @@ test("a BitChute import runs on BitChute's queue and pace, and is never fetched // WAIT ON THE JOB, NOT THE PAGE: the second import can only be refused once // the first has finished and written its archive entry. await expect(async () => { - const dir = resolvePath("test-transcripts/.jobs"); + const dir = resolvePath(`${testPaths().transcriptsDir}/.jobs`); const statuses: string[] = []; for (const name of await readdir(dir)) { if (!name.endsWith(".meta.json")) continue; @@ -144,9 +145,9 @@ test("a BitChute import runs on BitChute's queue and pace, and is never fetched }).toPass({ timeout: 30_000 }); // However many clicks that took, BitChute was asked once. const imports: string[] = []; - for (const name of await readdir(resolvePath("test-transcripts/.jobs"))) { + for (const name of await readdir(resolvePath(`${testPaths().transcriptsDir}/.jobs`))) { if (!name.endsWith(".meta.json")) continue; - const m = JSON.parse(await readFile(resolvePath(`test-transcripts/.jobs/${name}`), "utf8")); + const m = JSON.parse(await readFile(resolvePath(`${testPaths().transcriptsDir}/.jobs/${name}`), "utf8")); if (m.kind === "import-one" && m.videoId === id) imports.push(m.id); } expect(imports).toHaveLength(1); diff --git a/editor/e2e/incomplete-transcript.spec.ts b/editor/e2e/incomplete-transcript.spec.ts @@ -18,10 +18,11 @@ import { readJson, resetData, resolvePath, + testPaths, } from "./helpers"; const CHANNEL = "test-transcribe"; -const DATA = `test-transcripts/channels/${CHANNEL}/data`; +const DATA = `${testPaths().transcriptsDir}/channels/${CHANNEL}/data`; // Non-empty whisper transcript so the video reads as transcribed (and isn't // flagged untranscribable for being empty). @@ -172,7 +173,7 @@ test("the fix run's log survives the refresh that clears the banner", async ({ await resetData(); const slug = "incomplete-log"; const id = "vidVttTrunc"; - const root = resolvePath(`test-transcripts/channels/${slug}`); + const root = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}`); const dir = `${root}/data/${id}`; await mkdir(dir, { recursive: true }); await writeFile( @@ -273,7 +274,7 @@ test("channel bulk bar: clear incomplete resets the video and enables auto-runne transcription: { enabled: boolean }; download: { enabled: boolean }; }; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(settings.autoQueue.transcription.enabled).toBe(true); expect(settings.autoQueue.download.enabled).toBe(true); diff --git a/editor/e2e/jobs-batch-tasks-drain.spec.ts b/editor/e2e/jobs-batch-tasks-drain.spec.ts @@ -12,6 +12,7 @@ import { pathExists, resetData, resolvePath, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; @@ -22,7 +23,7 @@ async function invalidateCache() { // Build a transcribe-handling channel with `count` slow videos (each has only // audio.mp3 on disk, so "Transcribe missing" will run whisper on all of them). async function makeTranscribeChannel(slug: string, name: string, ids: string[]) { - const root = resolvePath(`test-transcripts/channels/${slug}`); + const root = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}`); await mkdir(root, { recursive: true }); await writeFile( `${root}/config.json`, @@ -43,7 +44,7 @@ async function transcriptCount(slug: string, ids: string[]): Promise<number> { let n = 0; for (const id of ids) { if ( - await pathExists(`test-transcripts/channels/${slug}/data/${id}/transcript.json`) + await pathExists(`${testPaths().transcriptsDir}/channels/${slug}/data/${id}/transcript.json`) ) { n++; } diff --git a/editor/e2e/jobs-filters.spec.ts b/editor/e2e/jobs-filters.spec.ts @@ -1,6 +1,6 @@ import { mkdir, writeFile } from "node:fs/promises"; import { test, expect } from "@playwright/test"; -import { resetData, resolvePath } from "./helpers"; +import { resetData, resolvePath, testPaths } from "./helpers"; // The /jobs screen reads `.log` files in TRANSCRIPTS_DIR/.jobs and enriches any // not in the in-memory registry from a `<id>.meta.json` sidecar (see @@ -8,7 +8,7 @@ import { resetData, resolvePath } from "./helpers"; // the registry, so writing a log + sidecar pair gives a deterministic // "archived" row — exercising both the metadata-read path and giving rows with // known kinds/statuses for the client-side filter bar. -const JOBS_DIR = "test-transcripts/.jobs"; +const JOBS_DIR = `${testPaths().transcriptsDir}/.jobs`; type SeedJob = { id: string; diff --git a/editor/e2e/jobs-reorder.spec.ts b/editor/e2e/jobs-reorder.spec.ts @@ -10,6 +10,7 @@ import { generateReport, resetData, resolvePath, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; @@ -20,7 +21,7 @@ async function invalidateCache() { // A channel whose Sync runs slowly (fake-ytdlp honors --test-slow), so it stays // "running"/"queued" long enough to reorder. async function makeSlowChannel(slug: string, name: string) { - const root = resolvePath(`test-transcripts/channels/${slug}`); + const root = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}`); await mkdir(root, { recursive: true }); await writeFile( `${root}/config.json`, diff --git a/editor/e2e/jobs-retry.spec.ts b/editor/e2e/jobs-retry.spec.ts @@ -12,6 +12,7 @@ import { pathExists, resetData, resolvePath, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; @@ -20,7 +21,7 @@ async function invalidateCache() { } async function makeSlowChannel(slug: string, name: string) { - const root = resolvePath(`test-transcripts/channels/${slug}`); + const root = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}`); await mkdir(root, { recursive: true }); await writeFile( `${root}/config.json`, @@ -39,7 +40,7 @@ async function writeArchivedJob( id: string, meta: Record<string, unknown>, ): Promise<void> { - const dir = resolvePath("test-transcripts/.jobs"); + const dir = resolvePath(`${testPaths().transcriptsDir}/.jobs`); await mkdir(dir, { recursive: true }); await writeFile(`${dir}/${id}.log`, `archived log for ${id}\n`); await writeFile(`${dir}/${id}.meta.json`, JSON.stringify({ id, ...meta })); @@ -105,7 +106,7 @@ test("Retry on an archived bucket job re-derives the bucket's current members", }) => { test.setTimeout(90_000); const CHANNEL = "test-transcribe"; - const ROOT = `test-transcripts/channels/${CHANNEL}`; + const ROOT = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; await resetData("one-transcribe-channel-with-audio"); // The retry flow reads the playlist to resolve each id's URL. Slug-style URLs // keep extractVideoId() === the id without needing platform claim ids. diff --git a/editor/e2e/lane-runner.spec.ts b/editor/e2e/lane-runner.spec.ts @@ -12,6 +12,7 @@ import { writeChannelConfig, writeDigestVideo, writeSettings, + testPaths, } from "./helpers"; // THE AUTO-QUEUE RUNNER, DRIVING THE OPERATION LANES. @@ -81,7 +82,7 @@ const CATCH_ALL: Group = { }; function dataRel(videoId: string, file: string): string { - return join("test-transcripts", "channels", CHANNEL, "data", videoId, file); + return join(testPaths().transcriptsDir, "channels", CHANNEL, "data", videoId, file); } // Settings with both engines named and the lanes' own gates OPEN. `autoQueue` @@ -448,7 +449,7 @@ type HeldByLane = Record<string, boolean | null>; async function heldByLane(): Promise<HeldByLane> { const s = await readJson<{ autoQueue?: Record<string, { held?: boolean }>; - }>("test-settings.json").catch(() => ({}) as { autoQueue?: undefined }); + }>(testPaths().settingsFile).catch(() => ({}) as { autoQueue?: undefined }); return Object.fromEntries( ["transcription", "download", "digest", "backfill"].map((lane) => [ lane, diff --git a/editor/e2e/maybe-missing.spec.ts b/editor/e2e/maybe-missing.spec.ts @@ -6,6 +6,7 @@ import { readJson, resetData, resolvePath, + testPaths, } from "./helpers"; const CHANNEL = "availability-test"; @@ -22,7 +23,7 @@ const BASELINE_IDS = [ "vidneedsauth1", ]; -const channelRoot = `test-transcripts/channels/${CHANNEL}`; +const channelRoot = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; function dataDir(id: string): string { return `${channelRoot}/data/${id}`; diff --git a/editor/e2e/metadata-scan-botcheck.spec.ts b/editor/e2e/metadata-scan-botcheck.spec.ts @@ -6,6 +6,7 @@ import { readJson, resetData, resolvePath, + testPaths, } from "./helpers"; // THE BOT CHECK, AND THE COOKIES THE SCAN WAS NOT USING. @@ -19,7 +20,7 @@ import { // A block on a cookie-less pass is not a refusal. It is the one thing we have // not tried yet. const CHANNEL = "test-botcheck"; -const ROOT = `test-transcripts/channels/${CHANNEL}`; +const ROOT = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; const ALL = [ "botcheck0001", "guestvid0001", diff --git a/editor/e2e/metadata-scan-softblock.spec.ts b/editor/e2e/metadata-scan-softblock.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { channelStage, generateReport, readJson, resetData } from "./helpers"; +import { channelStage, generateReport, readJson, resetData, testPaths } from "./helpers"; // THE SOFT BLOCK. Measured on a real channel: after ~100 good records YouTube // answered "Video unavailable" for 545 CONSECUTIVE videos, all of which fetched @@ -10,7 +10,7 @@ import { channelStage, generateReport, readJson, resetData } from "./helpers"; // The fixture is the same shape, small: one genuinely members-only video, two // readable ones, then a run of soft-blocked ids. const CHANNEL = "test-softblock"; -const ROOT = `test-transcripts/channels/${CHANNEL}`; +const ROOT = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; type MetadataScan = { entries: Record<string, { title: string }>; diff --git a/editor/e2e/new-channel-onboarding.spec.ts b/editor/e2e/new-channel-onboarding.spec.ts @@ -15,7 +15,7 @@ // select). Only the textbox has the exact accessible name "URL". import { test, expect } from "@playwright/test"; -import { resetData, readJson, pathExists, generateReport } from "./helpers"; +import { resetData, readJson, pathExists, generateReport, testPaths } from "./helpers"; test("derives platform, handling, slug and queue from a YouTube URL offline", async ({ page, @@ -102,7 +102,7 @@ test("creating with 'Fetch playlist now' stores the playlist", async ({ await expect .poll( () => - pathExists("test-transcripts/channels/playlist-chan/playlist"), + pathExists(`${testPaths().transcriptsDir}/channels/playlist-chan/playlist`), { timeout: 15000 }, ) .toBe(true); @@ -147,7 +147,7 @@ test("'Add to top of auto-queue' takes the first rank and enables the runner", a root?: { children?: { id?: string; children?: { id?: string }[] }[] }; }; }; - }>("test-settings.json"); + }>(testPaths().settingsFile); const dl = s.autoQueue?.download; return { enabled: dl?.enabled ?? false, diff --git a/editor/e2e/no-orphan-fixtures.spec.ts b/editor/e2e/no-orphan-fixtures.spec.ts @@ -26,11 +26,12 @@ import { resetData, resolvePath, writeSettings, + testPaths, } from "./helpers"; import { listFixtureProcesses } from "./fixtureProcs"; async function makeTranscribeChannel(slug: string, ids: string[]) { - const root = resolvePath(`test-transcripts/channels/${slug}`); + const root = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}`); await mkdir(root, { recursive: true }); await writeFile( `${root}/config.json`, diff --git a/editor/e2e/no-subs-fallback.spec.ts b/editor/e2e/no-subs-fallback.spec.ts @@ -9,10 +9,11 @@ import { readJson, resetData, writeSettings, + testPaths, } from "./helpers"; const CHANNEL = "test-livechat"; -const ROOT = `test-transcripts/channels/${CHANNEL}`; +const ROOT = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; const here = path.dirname(fileURLToPath(import.meta.url)); type DownloadOutcome = { @@ -74,7 +75,7 @@ test("default off: live_chat-only video downloads audio but defers whisper", asy // The fallback should reuse the metadata.info.json the primary attempt // wrote, not re-query the extractor. const invocations = await readFile( - path.join(here, "..", ROOT, "fake-ytdlp.invocations"), + path.join(ROOT, "fake-ytdlp.invocations"), "utf8", ); expect(invocations).toMatch( diff --git a/editor/e2e/operation-settings.spec.ts b/editor/e2e/operation-settings.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { readJson, resetData } from "./helpers"; +import { readJson, resetData, testPaths } from "./helpers"; // PER-OPERATION SETTINGS, on the operation's own page. // @@ -47,7 +47,7 @@ test("digest settings round-trip through the form", async ({ page }) => { sections: string[]; apps: Record<string, { numCtx?: number }>; }; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(saved.digest?.timestampMode).toBe("absolute"); expect(saved.digest?.promptVariant).toBe("bakeoff-r3"); expect(saved.digest?.spendCapUsd).toBe(12.5); @@ -95,7 +95,7 @@ test("a save on /settings does not reset the digest prompt shape", async ({ const saved = await readJson<{ adminTitle: string; digest?: { timestampMode: string; promptVariant: string }; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(saved.adminTitle).toBe("Unrelated Change"); expect(saved.digest?.timestampMode).toBe("absolute"); expect(saved.digest?.promptVariant).toBe("keepme"); @@ -132,7 +132,7 @@ test("the lane's switch survives a save of the operation form beside it", async const saved = await readJson<{ autoQueue?: { backfill?: { held?: boolean } }; diarization?: { enabled: boolean }; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(saved.autoQueue?.backfill?.held).toBe(false); expect(saved.diarization?.enabled).toBe(true); }); @@ -174,7 +174,7 @@ test("the sortformer engine settings round-trip through the form", async ({ segModel: string; threshold: number; }; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(saved.diarization?.engine).toBe("sortformer"); expect(saved.diarization?.backend).toBe("cpu"); expect(saved.diarization?.sortformerBin).toBe("/opt/sortformer/diarize-file"); @@ -209,7 +209,7 @@ test("attribution settings round-trip on the text-only operation's page", async textOnlyEnabled: boolean; model: string; }; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(saved.attribution?.enabled).toBe(true); expect(saved.attribution?.textOnlyEnabled).toBe(true); expect(saved.attribution?.model).toBe("qwen2.5:14b"); diff --git a/editor/e2e/ops-api.spec.ts b/editor/e2e/ops-api.spec.ts @@ -28,6 +28,7 @@ import { writeChannelConfig, writeSettings, writeSite, + testPaths, } from "./helpers"; const TOKEN = "test-worker-token"; @@ -78,7 +79,7 @@ test("a channel's lifecycle over ops: create on a site, list, re-site, rename, d await resetData("empty"); await settings(); await writeSite("mysite", { channels: [] }); - const SITE = "test-transcripts/sites/mysite/site.json"; + const SITE = `${testPaths().transcriptsDir}/sites/mysite/site.json`; const list = async () => { const res = await request.get(`${baseUrl}/api/ops/channels`, { headers: AUTH }); expect(res.status()).toBe(200); @@ -100,7 +101,7 @@ test("a channel's lifecycle over ops: create on a site, list, re-site, rename, d }); expect(made.body).toEqual({ ok: true, slug: "made-x", jobIds: [] }); const cfg = await readJson<Record<string, unknown>>( - "test-transcripts/channels/made-x/config.json", + `${testPaths().transcriptsDir}/channels/made-x/config.json`, ); expect(cfg.sourceKind).toBe("social"); expect(cfg.socialHandle).toBe("made_user"); @@ -133,7 +134,7 @@ test("a channel's lifecycle over ops: create on a site, list, re-site, rename, d expect(renamed.status).toBe(200); expect((renamed.body as { slug?: string }).slug).toBe("made-renamed-x"); expect((await list()).map((c) => c.slug)).toEqual(["made-renamed-x"]); - expect(await pathExists("test-transcripts/channels/made-x")).toBe(false); + expect(await pathExists(`${testPaths().transcriptsDir}/channels/made-x`)).toBe(false); const refused = await ops(request, "delete-channel", { slug: "made-renamed-x", @@ -159,7 +160,7 @@ test("channel-config round-trips a download filter and refuses a bad regex", asy await resetData("title-filter-channel"); await settings(); const SLUG = "test-filter"; - const CONFIG = `test-transcripts/channels/${SLUG}/config.json`; + const CONFIG = `${testPaths().transcriptsDir}/channels/${SLUG}/config.json`; // TWO FIELDS THE CLEAR-THEN-LAYER PATH ACTUALLY THREATENS. name/handling/url // survive a patch trivially — they are re-posted by the serializer because // parseChannelForm requires the first two and CHANNEL_FORM_FIELDS spares @@ -271,7 +272,7 @@ test("channel-priority writes a per-operation override", async ({ request }) => channelPriority?: { channels?: Record<string, { overrides?: Record<string, string> }>; }; - }>("test-settings.json"); + }>(testPaths().settingsFile); return s.channelPriority?.channels?.[SLUG]?.overrides?.download ?? null; }) .toBe("paused"); @@ -297,7 +298,7 @@ test("channel-priority writes a per-operation override", async ({ request }) => channelPriority?: { channels?: Record<string, { overrides?: Record<string, string> }>; }; - }>("test-settings.json"); + }>(testPaths().settingsFile); return s.channelPriority?.channels?.[SLUG]?.overrides?.download ?? null; }) .toBe(null); @@ -326,7 +327,7 @@ test("metadata-scan starts a job, and the job says it is a metadata-scan", async // THE ROUTE DOES NOT STREAM, so the id is the whole contract: the caller // follows the same log endpoint the editor's own panel polls. // The sidecar is written with a `void` promise right after enqueue, so poll. - const metaPath = `test-transcripts/.jobs/${body.jobId}.meta.json`; + const metaPath = `${testPaths().transcriptsDir}/.jobs/${body.jobId}.meta.json`; await expect .poll(async () => { const meta = await readJson<{ kind: string; channelSlug: string }>( @@ -380,7 +381,7 @@ test("a sync queued behind another platform job ends done, not failed", async ({ type Meta = { status: string; queueKey?: string }; const meta = (id: string) => - readJson<Meta>(`test-transcripts/.jobs/${id}.meta.json`).catch(() => null); + readJson<Meta>(`${testPaths().transcriptsDir}/.jobs/${id}.meta.json`).catch(() => null); const hold = await request.get( `${baseUrl}/api/test/stuck-job?queue=${encodeURIComponent("platform:youtube")}&releaseAfterMs=10000`, @@ -416,7 +417,7 @@ test("refresh-report regenerates snapshot.json", async ({ request }) => { await resetData("title-filter-channel"); await settings(); const SLUG = "test-filter"; - const SNAP = `test-transcripts/channels/${SLUG}/snapshot.json`; + const SNAP = `${testPaths().transcriptsDir}/channels/${SLUG}/snapshot.json`; // Removed rather than assumed absent: a debounced regen armed by the previous // spec can land between resetData's copy and here, and the point of the // assertion below is the ROUTE's effect, not the scheduler's. @@ -434,7 +435,7 @@ test("refresh-report regenerates snapshot.json", async ({ request }) => { async () => ( await readJson<{ status: string }>( - `test-transcripts/.jobs/${jobId}.meta.json`, + `${testPaths().transcriptsDir}/.jobs/${jobId}.meta.json`, ).catch(() => null) )?.status ?? null, { timeout: 30_000 }, @@ -560,7 +561,7 @@ test("lane flips a hold, and /api/auto-queue/status agrees", async ({ .poll(async () => { const s = await readJson<{ autoQueue?: Record<string, { enabled?: boolean }>; - }>("test-settings.json"); + }>(testPaths().settingsFile); return s.autoQueue?.download?.enabled ?? null; }) .toBe(true); @@ -674,7 +675,7 @@ test("tags defines a vocabulary, and tag-videos writes pins with their source", string, { manual?: string[]; sources?: Record<string, { source: string }> } >; - }>("test-transcripts/tags.json"); + }>(`${testPaths().transcriptsDir}/tags.json`); expect(file.tags[0].id).toBe("eva-collab"); expect(file.assignments[`${slug}/${id}`].manual).toEqual(["eva-collab"]); // A CALL ARRIVING HERE IS NOT THE BROWSER, and the default provenance says so @@ -730,7 +731,7 @@ test("tags defines a vocabulary, and tag-videos writes pins with their source", }); expect((unpin.body as { changed?: number }).changed).toBe(1); const after = await readJson<{ assignments: Record<string, unknown> }>( - "test-transcripts/tags.json", + `${testPaths().transcriptsDir}/tags.json`, ); expect(after.assignments).toEqual({}); @@ -745,7 +746,7 @@ test("tags defines a vocabulary, and tag-videos writes pins with their source", const left = await readJson<{ tags: unknown[]; assignments: Record<string, { suppressed?: string[] }>; - }>("test-transcripts/tags.json"); + }>(`${testPaths().transcriptsDir}/tags.json`); expect(left.tags).toEqual([]); expect(left.assignments[`${slug}/${id}`].suppressed).toEqual(["eva-collab"]); }); @@ -763,7 +764,7 @@ test("keep-videos marks the matching video only, after a dry run that writes not const slug = "test-youtube"; const kept = "20240102_keepme12345"; const other = "20240101_test1234567"; // "Synthetic Test Video" — no needle - const channel = `test-transcripts/channels/${slug}`; + const channel = `${testPaths().transcriptsDir}/channels/${slug}`; await mkdir(resolvePath(`${channel}/data/${kept}`), { recursive: true }); await writeFile( resolvePath(`${channel}/data/${kept}/metadata.info.json`), @@ -858,7 +859,7 @@ test("build-site with a bare siteId starts its build stage (the index first: the await expect .poll(async () => { const meta = await readJson<{ kind: string }>( - `test-transcripts/.jobs/${jobId}.meta.json`, + `${testPaths().transcriptsDir}/.jobs/${jobId}.meta.json`, ).catch(() => null); return meta?.kind ?? null; }) @@ -895,7 +896,7 @@ test("publish: each verb enqueues its run of stages on the publish queue; a dupl expect(index.jobs?.map((j) => [j.kind, j.target])).toEqual([["update-index", "_index"]]); expect(index.jobId).toBe(index.jobs?.[0].jobId); const meta = await readJson<{ kind: string; queueKey: string; status: string }>( - `test-transcripts/.jobs/${index.jobId}.meta.json`, + `${testPaths().transcriptsDir}/.jobs/${index.jobId}.meta.json`, ); expect([meta.kind, meta.queueKey, meta.status]).toEqual(["publish-update-index", "publish", "queued"]); diff --git a/editor/e2e/ops-cut-release.spec.ts b/editor/e2e/ops-cut-release.spec.ts @@ -17,10 +17,10 @@ import { readFile, writeFile } from "node:fs/promises"; import { test, expect, type APIRequestContext } from "@playwright/test"; import { baseUrl } from "./baseUrl"; -import { resolvePath } from "./helpers"; +import { resolvePath, testPaths } from "./helpers"; -const EDITOR_CHANGELOG = resolvePath("test-changelog.md"); -const EXPORT_CHANGELOG = resolvePath("test-export-changelog.md"); +const EDITOR_CHANGELOG = resolvePath(testPaths().editorChangelog); +const EXPORT_CHANGELOG = resolvePath(testPaths().exportChangelog); const AUTH = { authorization: "Bearer test-worker-token" }; type CutResponse = { diff --git a/editor/e2e/pacing.spec.ts b/editor/e2e/pacing.spec.ts @@ -1,6 +1,6 @@ import { mkdir, writeFile } from "node:fs/promises"; import { test, expect } from "@playwright/test"; -import { readJson, resetData, resolvePath, writeSettings } from "./helpers"; +import { readJson, resetData, resolvePath, writeSettings, testPaths } from "./helpers"; import { baseUrl } from "./baseUrl"; // YouTube lane pacing (release 7): a rate-limited video is DEFERRED for 6 h as @@ -27,11 +27,11 @@ const ONE_WORKER = [ }, ]; -const STATE_FILE = "test-transcripts/.auto-queue/state.json"; +const STATE_FILE = `${testPaths().transcriptsDir}/.auto-queue/state.json`; // Copied from auto-queue.spec.ts: a YouTube channel with undownloaded videos. async function makeDownloadChannel(slug: string, ids: string[]) { - const root = resolvePath(`test-transcripts/channels/${slug}`); + const root = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}`); await mkdir(`${root}/data`, { recursive: true }); await writeFile( `${root}/config.json`, @@ -148,7 +148,7 @@ test("a deferred video is skipped by auto-download, and the lane says so", async }) => { await setup(["a1", "a2"]); // Seed a live deferral on a1 — as if its download had just answered 429. - await mkdir(resolvePath("test-transcripts/.auto-queue"), { recursive: true }); + await mkdir(resolvePath(`${testPaths().transcriptsDir}/.auto-queue`), { recursive: true }); await writeFile( resolvePath(STATE_FILE), JSON.stringify({ diff --git a/editor/e2e/parakeet-partial.spec.ts b/editor/e2e/parakeet-partial.spec.ts @@ -13,10 +13,11 @@ import { resetData, resolvePath, writeSettings, + testPaths, } from "./helpers"; async function makeTranscribeChannel(slug: string, ids: string[]) { - const root = resolvePath(`test-transcripts/channels/${slug}`); + const root = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}`); await mkdir(root, { recursive: true }); await writeFile( `${root}/config.json`, @@ -47,7 +48,7 @@ test("Stop & keep progress pauses a parakeet run, caches the window, and resumes ], }); await makeTranscribeChannel("partial-chan", ["slowoppk1"]); - const dir = "test-transcripts/channels/partial-chan/data/slowoppk1"; + const dir = `${testPaths().transcriptsDir}/channels/partial-chan/data/slowoppk1`; const cachedWindow = `${dir}/.audio.mp3.parakeet/win-0000.json`; const transcript = `${dir}/transcript.json`; @@ -94,7 +95,7 @@ test("Pause Transcriptions stops a parakeet run after the current segment, cache ], }); await makeTranscribeChannel("gpause-chan", ["slowoppk1"]); - const dir = "test-transcripts/channels/gpause-chan/data/slowoppk1"; + const dir = `${testPaths().transcriptsDir}/channels/gpause-chan/data/slowoppk1`; const cachedWindow = `${dir}/.audio.mp3.parakeet/win-0000.json`; const transcript = `${dir}/transcript.json`; @@ -164,9 +165,9 @@ test("Stop & keep progress on a force-killed parakeet run is NOT recorded as a f // force-SIGKILLed — `await child` REJECTS. The bug recorded that rejection in // failed-transcriptions (blacklisting the video forever); it must be a skip. await makeTranscribeChannel("hangterm-chan", ["hangtermpk1"]); - const dir = "test-transcripts/channels/hangterm-chan/data/hangtermpk1"; + const dir = `${testPaths().transcriptsDir}/channels/hangterm-chan/data/hangtermpk1`; const transcript = `${dir}/transcript.json`; - const failedFile = "test-transcripts/channels/hangterm-chan/failed-transcriptions"; + const failedFile = `${testPaths().transcriptsDir}/channels/hangterm-chan/failed-transcriptions`; await generateReport(page, "hangterm-chan"); await page.goto(channelStage("hangterm-chan", "transcribe")); @@ -216,7 +217,7 @@ test("a parakeet worker's device is configurable and persists", async ({ const saved = await readJson<{ workers?: { appId?: string; config?: { device?: string } }[]; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(saved.workers?.[0].appId).toBe("parakeet"); expect(saved.workers?.[0].config?.device).toBe("CUDA0"); }); diff --git a/editor/e2e/parakeet.spec.ts b/editor/e2e/parakeet.spec.ts @@ -7,10 +7,11 @@ import { resetData, resolvePath, writeSettings, + testPaths, } from "./helpers"; const CHANNEL = "test-transcribe"; -const DATA = `test-transcripts/channels/${CHANNEL}/data`; +const DATA = `${testPaths().transcriptsDir}/channels/${CHANNEL}/data`; // Minimal metadata so transcribeOne's normalize pass runs (it needs // metadata.info.json) and writes transcript.cues.json. diff --git a/editor/e2e/partial-downloads-bucket.spec.ts b/editor/e2e/partial-downloads-bucket.spec.ts @@ -11,10 +11,11 @@ import { pathExists, resetData, resolvePath, + testPaths, } from "./helpers"; const CHANNEL = "test-transcribe"; -const CHANNEL_ROOT = `test-transcripts/channels/${CHANNEL}`; +const CHANNEL_ROOT = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; test("partial download surfaces in a bucket on the channel page", async ({ page, diff --git a/editor/e2e/persist-youtube-handling.spec.ts b/editor/e2e/persist-youtube-handling.spec.ts @@ -15,11 +15,11 @@ import { readFile, readdir, stat, writeFile } from "node:fs/promises"; import { test, expect } from "@playwright/test"; -import { readJson, resetData, resolvePath, writeSettings } from "./helpers"; +import { readJson, resetData, resolvePath, writeSettings, testPaths } from "./helpers"; import { baseUrl } from "./baseUrl"; const SLUG = "test-youtube"; -const rel = (p: string) => `test-transcripts/channels/${SLUG}/${p}`; +const rel = (p: string) => `${testPaths().transcriptsDir}/channels/${SLUG}/${p}`; // The fixture's downloaded video: metadata.info.json + transcript.en.vtt. const HAS_TRANSCRIPT = "fake00000001"; // In the playlist, never downloaded. diff --git a/editor/e2e/pipeline.spec.ts b/editor/e2e/pipeline.spec.ts @@ -7,6 +7,7 @@ import { readJson, resetData, resolvePath, + testPaths, } from "./helpers"; test("store playlist writes a playlist file with 5 URLs", async ({ page }) => { @@ -19,7 +20,7 @@ test("store playlist writes a playlist file with 5 URLs", async ({ page }) => { { timeout: 20_000 }, ); expect( - await pathExists("test-transcripts/channels/test-pipeline/playlist"), + await pathExists(`${testPaths().transcriptsDir}/channels/test-pipeline/playlist`), ).toBe(true); }); @@ -52,18 +53,18 @@ test("download from playlist fetches all 5 URLs and writes the archive", async ( for (let i = 1; i <= 5; i++) { expect( await pathExists( - `test-transcripts/channels/test-pipeline/data/fake0000000${i}/metadata.info.json`, + `${testPaths().transcriptsDir}/channels/test-pipeline/data/fake0000000${i}/metadata.info.json`, ), ).toBe(true); } // Each managed download writes a per-video log alongside the data. expect( await pathExists( - "test-transcripts/channels/test-pipeline/data/fake00000001/download.log", + `${testPaths().transcriptsDir}/channels/test-pipeline/data/fake00000001/download.log`, ), ).toBe(true); const config = await readJson<{ lastFullDownloadAt?: string }>( - "test-transcripts/channels/test-pipeline/config.json", + `${testPaths().transcriptsDir}/channels/test-pipeline/config.json`, ); expect(typeof config.lastFullDownloadAt).toBe("string"); }); @@ -109,12 +110,12 @@ test("sync enumerates the channel, downloads new entries, writes lastSyncedAt", for (let i = 1; i <= 5; i++) { expect( await pathExists( - `test-transcripts/channels/test-pipeline/data/fake0000000${i}/metadata.info.json`, + `${testPaths().transcriptsDir}/channels/test-pipeline/data/fake0000000${i}/metadata.info.json`, ), ).toBe(true); } const config = await readJson<{ lastSyncedAt?: string }>( - "test-transcripts/channels/test-pipeline/config.json", + `${testPaths().transcriptsDir}/channels/test-pipeline/config.json`, ); expect(typeof config.lastSyncedAt).toBe("string"); }); @@ -123,7 +124,7 @@ test("download videos skips a transcribed video even when its audio was cleaned page, }) => { await resetData("one-transcribe-channel-with-audio"); - const channelRoot = "test-transcripts/channels/test-transcribe"; + const channelRoot = `${testPaths().transcriptsDir}/channels/test-transcribe`; // vidA: transcribed, audio cleaned up — should be skipped via transcript.json. await writeFile( @@ -171,7 +172,7 @@ test("channel list sync button runs the platform-queue sync", async ({ timeout: 30_000, }); const config = await readJson<{ lastSyncedAt?: string }>( - "test-transcripts/channels/test-pipeline/config.json", + `${testPaths().transcriptsDir}/channels/test-pipeline/config.json`, ); expect(typeof config.lastSyncedAt).toBe("string"); }); diff --git a/editor/e2e/pre-clean-availability.spec.ts b/editor/e2e/pre-clean-availability.spec.ts @@ -10,6 +10,7 @@ import { resetData, resolvePath, writeSettings, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; @@ -25,7 +26,7 @@ import { baseUrl } from "./baseUrl"; const here = dirname(fileURLToPath(import.meta.url)); const CHANNEL = "availability-test"; const FIXTURE = "availability-baseline"; -const channelRoot = `test-transcripts/channels/${CHANNEL}`; +const channelRoot = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; function dataRel(id: string, file: string): string { return `${channelRoot}/data/${id}/${file}`; diff --git a/editor/e2e/publish-lane.spec.ts b/editor/e2e/publish-lane.spec.ts @@ -10,17 +10,17 @@ import { readdir } from "node:fs/promises"; import { test, expect, type Page } from "@playwright/test"; import { baseUrl } from "./baseUrl"; -import { readJson, resetData, resolvePath, writeSettings, writeSite } from "./helpers"; +import { readJson, resetData, resolvePath, writeSettings, writeSite, testPaths } from "./helpers"; type Meta = { id: string; kind: string; status: string; spec?: { params?: { runId?: string } } }; async function metasOf(kind: string): Promise<Meta[]> { - const files = (await readdir(resolvePath("test-transcripts/.jobs")).catch(() => [])).filter((f) => + const files = (await readdir(resolvePath(`${testPaths().transcriptsDir}/.jobs`)).catch(() => [])).filter((f) => f.endsWith(".meta.json"), ); const out: Meta[] = []; for (const f of files) { - const m = await readJson<Meta>(`test-transcripts/.jobs/${f}`).catch(() => null); + const m = await readJson<Meta>(`${testPaths().transcriptsDir}/.jobs/${f}`).catch(() => null); if (m?.kind === kind) out.push(m); } return out; @@ -65,7 +65,7 @@ test("the settings form saves settings.publish, and Start says why when the lane await form.getByRole("button", { name: "Save publish settings" }).click(); await expect(form.getByRole("status")).toHaveText("Saved."); await expect(async () => { - const s = await readJson<{ publish?: Record<string, unknown> }>("test-settings.json"); + const s = await readJson<{ publish?: Record<string, unknown> }>(testPaths().settingsFile); expect(s.publish).toMatchObject({ checkEveryMinutes: 5, previewBranch: "lane-prev", hub: "build", enabled: false }); }).toPass({ timeout: 10_000 }); @@ -105,7 +105,7 @@ test("enabled and started, the lane updates the index; a hold mid-stage stops th await page.getByRole("button", { name: "pause publishing" }).click(); await expect(page.getByRole("button", { name: "resume publishing" })).toBeVisible(); expect((await publishStatus(request)).lane.held).toBe(true); - const settings = await readJson<{ publish?: { held?: boolean } }>("test-settings.json"); + const settings = await readJson<{ publish?: { held?: boolean } }>(testPaths().settingsFile); expect(settings.publish?.held).toBe(true); // The stage is still queued behind the holder; let the holder go. expect((await metasOf("publish-update-index"))[0]?.status).not.toBe("done"); diff --git a/editor/e2e/publish.spec.ts b/editor/e2e/publish.spec.ts @@ -28,9 +28,10 @@ import { resolvePath, writeSettings, writeSite, + testPaths, } from "./helpers"; -const BUILDS = "test-transcripts/.export-builds"; +const BUILDS = `${testPaths().transcriptsDir}/.export-builds`; const SITE = "pubsite"; const PROJECT = "pubproj"; @@ -40,12 +41,12 @@ const chip = (page: Page, name: string, id = SITE) => row(page, id).locator(`[da type Meta = { id: string; kind: string; queueKey?: string; status: string; spec?: { params?: { runId?: string } } }; async function publishMetas(): Promise<Meta[]> { - const files = (await readdir(resolvePath("test-transcripts/.jobs")).catch(() => [])).filter((f) => + const files = (await readdir(resolvePath(`${testPaths().transcriptsDir}/.jobs`)).catch(() => [])).filter((f) => f.endsWith(".meta.json"), ); const out: Meta[] = []; for (const f of files) { - const m = await readJson<Meta>(`test-transcripts/.jobs/${f}`).catch(() => null); + const m = await readJson<Meta>(`${testPaths().transcriptsDir}/.jobs/${f}`).catch(() => null); if (m?.kind.startsWith("publish-")) out.push(m); } return out.sort((a, b) => a.id.localeCompare(b.id)); @@ -56,7 +57,7 @@ async function logOf(kind: string): Promise<string> { const last = metas[metas.length - 1]; if (!last) return ""; const { readFile } = await import("node:fs/promises"); - return readFile(resolvePath(`test-transcripts/.jobs/${last.id}.log`), "utf8").catch(() => ""); + return readFile(resolvePath(`${testPaths().transcriptsDir}/.jobs/${last.id}.log`), "utf8").catch(() => ""); } type Invocation = { argv: string[]; project: string; branch: string; outDir: string; files: number }; @@ -97,11 +98,11 @@ test("the index: no stamp, then the Pool's Build index writes it and every row's await openSites(page); await expect(chip(page, "index")).toContainText("no index yet"); await expect(chip(page, "built")).toContainText("update the index first"); - expect(await pathExists("test-transcripts/.export-index/stamp.json")).toBe(false); + expect(await pathExists(`${testPaths().transcriptsDir}/.export-index/stamp.json`)).toBe(false); await buildIndex(page); const stamp = await readJson<{ v: number; stampId: string; sites: Record<string, unknown>; settingsSig?: string }>( - "test-transcripts/.export-index/stamp.json", + `${testPaths().transcriptsDir}/.export-index/stamp.json`, ); expect(stamp.v).toBe(1); expect(Object.keys(stamp.sites)).toEqual([SITE]); @@ -291,7 +292,7 @@ test("the site form's publish policy: preview without a Pages project is refused await expect( page.getByRole("alert").filter({ hasText: 'publish.auto "preview" deploys the site, and it has no cloudflareProject' }), ).toBeVisible(); - const site = await readJson<Record<string, unknown>>("test-transcripts/sites/noproj/site.json"); + const site = await readJson<Record<string, unknown>>(`${testPaths().transcriptsDir}/sites/noproj/site.json`); expect("publish" in site).toBe(false); // Build is allowed without a project, and is written. @@ -299,7 +300,7 @@ test("the site form's publish policy: preview without a Pages project is refused await page.getByRole("button", { name: /save site/i }).click(); await expect(page.getByRole("status").filter({ hasText: "Saved" })).toBeVisible(); await expect(async () => { - const saved = await readJson<{ publish?: { auto: string } }>("test-transcripts/sites/noproj/site.json"); + const saved = await readJson<{ publish?: { auto: string } }>(`${testPaths().transcriptsDir}/sites/noproj/site.json`); expect(saved.publish?.auto).toBe("build"); }).toPass({ timeout: 10_000 }); }); diff --git a/editor/e2e/queues.spec.ts b/editor/e2e/queues.spec.ts @@ -5,6 +5,7 @@ import { generateReport, resetData, resolvePath, + testPaths, } from "./helpers"; async function setQueueViaCustom( @@ -45,8 +46,8 @@ test("Sync is refused while its platform is in a rate-limit cooldown", async ({ // if auto-download or a prior sync had just hit a 429. A manual Sync must // refuse rather than re-storm the source. const until = Date.now() + 5 * 60_000; - const stateFile = resolvePath("test-transcripts/.auto-queue/state.json"); - await mkdir(resolvePath("test-transcripts/.auto-queue"), { recursive: true }); + const stateFile = resolvePath(`${testPaths().transcriptsDir}/.auto-queue/state.json`); + await mkdir(resolvePath(`${testPaths().transcriptsDir}/.auto-queue`), { recursive: true }); await writeFile( stateFile, JSON.stringify({ diff --git a/editor/e2e/rate-limit.spec.ts b/editor/e2e/rate-limit.spec.ts @@ -6,6 +6,7 @@ import { resetData, resolvePath, writeSettings, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; @@ -26,13 +27,13 @@ import { baseUrl } from "./baseUrl"; type Leaf = { id: string; match: { type: string; value?: string } }; type Group = { id: string; mode: string; children: (Group | Leaf)[] }; -const STATE_FILE = "test-transcripts/.auto-queue/state.json"; +const STATE_FILE = `${testPaths().transcriptsDir}/.auto-queue/state.json`; const TOKEN = "test-worker-token"; const AUTH = { authorization: `Bearer ${TOKEN}` }; // Copied from pacing.spec.ts: a YouTube channel with undownloaded videos. async function makeDownloadChannel(slug: string, ids: string[]) { - const root = resolvePath(`test-transcripts/channels/${slug}`); + const root = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}`); await mkdir(`${root}/data`, { recursive: true }); await writeFile( `${root}/config.json`, @@ -99,7 +100,7 @@ async function setup( }, }); if (seed) { - await mkdir(resolvePath("test-transcripts/.auto-queue"), { recursive: true }); + await mkdir(resolvePath(`${testPaths().transcriptsDir}/.auto-queue`), { recursive: true }); await writeFile( resolvePath(STATE_FILE), JSON.stringify({ @@ -178,7 +179,7 @@ test("a subtitle 429 downloads the media, defers only the subtitles, and backs n expect(d?.subtitleDeferrals?.dl429sub1?.channelSlug).toBe("alpha"); // The media is on disk, no subtitles, and the outcome is a success that says why. - const dir = "test-transcripts/channels/alpha/data/dl429sub1"; + const dir = `${testPaths().transcriptsDir}/channels/alpha/data/dl429sub1`; expect(await pathExists(`${dir}/audio.mp3`)).toBe(true); expect(await pathExists(`${dir}/transcript.en.vtt`)).toBe(false); const outcome = await readJson<{ status: string; failureClass?: string }>( @@ -294,7 +295,7 @@ test("a probe that comes back clean clears the hold and the backoff", async ({ ) .toEqual({ held: false, backoff: false }); expect((await getStatus(request)).download.picks.map((p) => p.videoId)).toEqual(["a1"]); - expect(await pathExists("test-transcripts/channels/alpha/data/a1/transcript.en.vtt")).toBe( + expect(await pathExists(`${testPaths().transcriptsDir}/channels/alpha/data/a1/transcript.en.vtt`)).toBe( true, ); }); diff --git a/editor/e2e/reconcile.spec.ts b/editor/e2e/reconcile.spec.ts @@ -1,6 +1,6 @@ import { mkdir, writeFile } from "node:fs/promises"; import { test, expect } from "@playwright/test"; -import { pathExists, resetData, resolvePath, generateReport } from "./helpers"; +import { pathExists, resetData, resolvePath, generateReport, testPaths } from "./helpers"; // yt-dlp names Twitch VOD dirs `v<id>` (its extractor id) while the app keys // videos by the canonical URL id `<id>`, so the audio/metadata land in @@ -13,7 +13,7 @@ import { pathExists, resetData, resolvePath, generateReport } from "./helpers"; // subject here was always reconcileVideoDirs, not what happened to invoke it. const CHANNEL = "twitch-reconcile"; -const ROOT = `test-transcripts/channels/${CHANNEL}`; +const ROOT = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; async function write(rel: string, contents: string): Promise<void> { const full = resolvePath(`${ROOT}/${rel}`); diff --git a/editor/e2e/reconstruct-download-url.spec.ts b/editor/e2e/reconstruct-download-url.spec.ts @@ -6,10 +6,10 @@ import { readFile, rm } from "node:fs/promises"; import { test, expect } from "@playwright/test"; -import { pathExists, resetData, resolvePath } from "./helpers"; +import { pathExists, resetData, resolvePath, testPaths } from "./helpers"; const CHANNEL = "test-transcribe"; -const CHANNEL_ROOT = `test-transcripts/channels/${CHANNEL}`; +const CHANNEL_ROOT = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; test("download pipeline reconstructs the URL when metadata + playlist are missing", async ({ page, diff --git a/editor/e2e/regional-vtt-fallback.spec.ts b/editor/e2e/regional-vtt-fallback.spec.ts @@ -6,6 +6,7 @@ import { resetData, resolvePath, writeSite, + testPaths, } from "./helpers"; const CHANNEL = "test-youtube"; @@ -14,8 +15,8 @@ const VIDEO_DIR = "20240101_test1234567"; // keeps equal to its directory name (see that file — a mismatch made snapshot // generation rename the directory mid-spec). const VIDEO_ID = VIDEO_DIR; -const DATA = `test-transcripts/channels/${CHANNEL}/data/${VIDEO_DIR}`; -const TRANSCRIPTS_PAGE = `test-transcripts/.export-index/shared/transcripts/${CHANNEL}/page-0000.json`; +const DATA = `${testPaths().transcriptsDir}/channels/${CHANNEL}/data/${VIDEO_DIR}`; +const TRANSCRIPTS_PAGE = `${testPaths().transcriptsDir}/.export-index/shared/transcripts/${CHANNEL}/page-0000.json`; // parseVtt only emits cues from lines carrying YouTube's inline word-timing // tags, so the body needs <hh:mm:ss.mmm> markers to produce a real cue. const VTT = diff --git a/editor/e2e/retry-bucket.spec.ts b/editor/e2e/retry-bucket.spec.ts @@ -7,6 +7,7 @@ import { pathExists, resetData, resolvePath, + testPaths, } from "./helpers"; const CHANNEL = "availability-test"; @@ -27,7 +28,7 @@ async function writeAvailability( opts: { error?: string } = {}, ) { const path = resolvePath( - `test-transcripts/channels/${CHANNEL}/data/${id}/availability.json`, + `${testPaths().transcriptsDir}/channels/${CHANNEL}/data/${id}/availability.json`, ); await mkdir(dirname(path), { recursive: true }); const record = { @@ -91,7 +92,7 @@ test("clicking retry on needs_auth re-downloads the listed video", async ({ await writeAvailability("vidneedsauth1", "needs_auth"); // retry-bucket reads the channel playlist file to know which URL to fetch. await writeFile( - resolvePath(`test-transcripts/channels/${CHANNEL}/playlist`), + resolvePath(`${testPaths().transcriptsDir}/channels/${CHANNEL}/playlist`), "https://www.youtube.com/watch?v=vidneedsauth1\n", ); @@ -113,7 +114,7 @@ test("clicking retry on needs_auth re-downloads the listed video", async ({ expect( await pathExists( - `test-transcripts/channels/${CHANNEL}/data/vidneedsauth1/transcript.en.vtt`, + `${testPaths().transcriptsDir}/channels/${CHANNEL}/data/vidneedsauth1/transcript.en.vtt`, ), ).toBe(true); }); diff --git a/editor/e2e/review.spec.ts b/editor/e2e/review.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { readJson, resetData, writeSettings } from "./helpers"; +import { readJson, resetData, writeSettings, testPaths } from "./helpers"; // /review is the page for the findings a PERSON decides about: duplicate // clusters and media-integrity findings. Both are flag-only and both carry a @@ -97,7 +97,7 @@ test("an auto-paused channel is listed with its reason", async ({ page }) => { channelPriority?: { channels: Record<string, { tier?: string; autoPaused?: unknown }>; }; - }>("test-settings.json"); + }>(testPaths().settingsFile); return s.channelPriority?.channels["test-youtube"]; }, { timeout: 20_000 }, @@ -107,7 +107,7 @@ test("an auto-paused channel is listed with its reason", async ({ page }) => { channelPriority?: { channels: Record<string, { autoPaused?: unknown }>; }; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect( after.channelPriority?.channels["test-youtube"]?.autoPaused, ).toBe(undefined); diff --git a/editor/e2e/rumble-sweep.spec.ts b/editor/e2e/rumble-sweep.spec.ts @@ -7,6 +7,7 @@ import { resetData, resolvePath, writeSettings, + testPaths, } from "./helpers"; // Release 5 slice R. A Rumble channel's full sweep that hits HTTP 429 part-way @@ -25,7 +26,7 @@ import { const CHANNEL = "availability-test"; const FIXTURE = "availability-baseline"; -const channelRoot = `test-transcripts/channels/${CHANNEL}`; +const channelRoot = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; const RUMBLE_URL = "https://rumble.com/c/sweep429"; const ALL_IDS = [ @@ -144,7 +145,7 @@ test("a Rumble sweep that 429s mid-listing is incomplete: paged walk, cooldown, // The rumble cooldown is recorded where the Sync gate and the runner read it. const state = await readJson<AutoQueueStateFile>( - "test-transcripts/.auto-queue/state.json", + `${testPaths().transcriptsDir}/.auto-queue/state.json`, ); expect(state.download.platformBackoff.rumble?.until).toBeGreaterThan( Date.now(), diff --git a/editor/e2e/saved-videos.spec.ts b/editor/e2e/saved-videos.spec.ts @@ -6,6 +6,7 @@ import { readJson, resetData, resolvePath, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; @@ -21,7 +22,7 @@ async function seedSavedVideo( sha256?: string, ): Promise<void> { const storeDir = resolvePath( - `test-transcripts/saved-videos/${SLUG}/${videoId}`, + `${testPaths().transcriptsDir}/saved-videos/${SLUG}/${videoId}`, ); await mkdir(storeDir, { recursive: true }); await writeFile(`${storeDir}/source-media.mp4`, "x".repeat(bytes)); @@ -34,7 +35,7 @@ async function seedSavedVideo( ...(sha256 ? { sha256 } : {}), }; await writeFile( - resolvePath(`test-transcripts/channels/${SLUG}/data/${videoId}/saved-video.json`), + resolvePath(`${testPaths().transcriptsDir}/channels/${SLUG}/data/${videoId}/saved-video.json`), JSON.stringify(pointer, null, 2) + "\n", ); await fetch(`${baseUrl}/api/test/invalidate-cache`).catch(() => {}); @@ -74,7 +75,7 @@ test("Saved Videos page saves the backup configuration", async ({ page }) => { // The setting persisted to test-settings.json. const settings = await readJson<{ savedVideoBackup?: { dest?: string; enabled?: boolean }; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(settings.savedVideoBackup?.dest).toBe("/tmp/ttb-e2e-backup-dest"); expect(settings.savedVideoBackup?.enabled).toBe(true); @@ -134,7 +135,7 @@ test("the persist run's log survives the refresh that lands the pointer", async // redownloadToArchiveAction resolves the source URL from metadata.info.json // or the playlist, and this fixture ships neither. await writeFile( - resolvePath(`test-transcripts/channels/${SLUG}/playlist`), + resolvePath(`${testPaths().transcriptsDir}/channels/${SLUG}/playlist`), "https://www.youtube.com/watch?v=vidA\n", ); await fetch(`${baseUrl}/api/test/invalidate-cache`).catch(() => {}); diff --git a/editor/e2e/scheduler.spec.ts b/editor/e2e/scheduler.spec.ts @@ -1,7 +1,7 @@ import { test, expect } from "@playwright/test"; import { writeFile } from "node:fs/promises"; import type { ChannelConfig } from "yt-dlp-transcript-common/lib/channelConfig"; -import { readJson, resetData, resolvePath, writeSettings } from "./helpers"; +import { readJson, resetData, resolvePath, writeSettings, testPaths } from "./helpers"; // End-to-end coverage for the cron-driven sync scheduler. Uses the two-slow // channels (their mock sync hangs long enough to stay "running"), drives the @@ -12,8 +12,8 @@ import { readJson, resetData, resolvePath, writeSettings } from "./helpers"; // already-running dedup — plus the sync operation's console at // /operations/sync (the page that was /scheduler before sync was catalogued). -const SLOW_A_CONFIG = "test-transcripts/channels/slow-a/config.json"; -const SLOW_B_CONFIG = "test-transcripts/channels/slow-b/config.json"; +const SLOW_A_CONFIG = `${testPaths().transcriptsDir}/channels/slow-a/config.json`; +const SLOW_B_CONFIG = `${testPaths().transcriptsDir}/channels/slow-b/config.json`; async function writeChannelConfig(rel: string, config: ChannelConfig) { await writeFile(resolvePath(rel), JSON.stringify(config, null, 2)); @@ -298,7 +298,7 @@ test("schedule page edits the global controls", async ({ page }) => { const settings = await readJson<{ syncScheduler: { enabled: boolean; defaultIntervalMinutes: number }; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(settings.syncScheduler.enabled).toBe(true); expect(settings.syncScheduler.defaultIntervalMinutes).toBe(120); diff --git a/editor/e2e/settings.spec.ts b/editor/e2e/settings.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { readJson, resetData } from "./helpers"; +import { readJson, resetData, testPaths } from "./helpers"; test.beforeEach(async () => { await resetData("empty"); @@ -24,7 +24,7 @@ test("saves settings via the form", async ({ page }) => { adminTitle: string; siteTitle?: string; groups?: unknown; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(saved.adminTitle).toBe("Cypress Admin"); // Operational-only: branding/groups must NOT round-trip into settings.json. expect(saved.siteTitle).toBeUndefined(); @@ -51,7 +51,7 @@ test("saves global default social links", async ({ page }) => { const saved = await readJson<{ socialLinks?: { label: string; url: string; svg: string; featured?: boolean }[]; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(saved.socialLinks).toHaveLength(1); expect(saved.socialLinks?.[0].label).toBe("GitHub"); // "Keep in header on small screens" is stored as featured: true. @@ -85,7 +85,7 @@ test("saves build pipeline settings (concurrency, image), and has no mode", asyn const saved = await readJson<{ buildPipeline?: Record<string, unknown>; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(saved.buildPipeline?.maxParallelBuilds).toBe(4); expect(saved.buildPipeline?.dockerImage).toBe("my-build-image"); expect(saved.buildPipeline && "mode" in saved.buildPipeline).toBe(false); diff --git a/editor/e2e/shard.spec.ts b/editor/e2e/shard.spec.ts @@ -7,6 +7,7 @@ import { readJson, resetData, resolvePath, + testPaths, } from "./helpers"; const AVAILABILITY_CHANNEL = "availability-test"; @@ -42,7 +43,7 @@ test.describe("Availability check sharding", () => { // 6 fixture videos sorted lex; shard 1 of 2 (0-based index 0) takes 3. const cfg = await readJson<ShardFile>( - `test-transcripts/channels/${AVAILABILITY_CHANNEL}/shard-availability.json`, + `${testPaths().transcriptsDir}/channels/${AVAILABILITY_CHANNEL}/shard-availability.json`, ); expect(cfg.totalShards).toBe(2); expect(cfg.shardIndex).toBe(0); @@ -60,7 +61,7 @@ test.describe("Availability check sharding", () => { ]) { if ( await pathExists( - `test-transcripts/channels/${AVAILABILITY_CHANNEL}/data/${id}/availability.json`, + `${testPaths().transcriptsDir}/channels/${AVAILABILITY_CHANNEL}/data/${id}/availability.json`, ) ) { written++; @@ -102,7 +103,7 @@ test.describe("Availability check sharding", () => { expect( await pathExists( - `test-transcripts/channels/${AVAILABILITY_CHANNEL}/shard-availability.json`, + `${testPaths().transcriptsDir}/channels/${AVAILABILITY_CHANNEL}/shard-availability.json`, ), ).toBe(true); @@ -117,7 +118,7 @@ test.describe("Availability check sharding", () => { ).toBeVisible({ timeout: 10_000 }); expect( await pathExists( - `test-transcripts/channels/${AVAILABILITY_CHANNEL}/shard-availability.json`, + `${testPaths().transcriptsDir}/channels/${AVAILABILITY_CHANNEL}/shard-availability.json`, ), ).toBe(false); }); @@ -154,7 +155,7 @@ test.describe("Transcribe missing sharding", () => { await expect(log).toContainText("succeeded", { timeout: 30_000 }); const cfg = await readJson<ShardFile>( - "test-transcripts/channels/test-transcribe/shard-transcribe-missing.json", + `${testPaths().transcriptsDir}/channels/test-transcribe/shard-transcribe-missing.json`, ); expect(cfg.totalShards).toBe(2); expect(cfg.shardIndex).toBe(1); @@ -172,7 +173,7 @@ test.describe("Transcribe missing sharding", () => { for (const id of ["vidA", "vidB", "vidC"]) { if ( await pathExists( - `test-transcripts/channels/test-transcribe/data/${id}/transcript.json`, + `${testPaths().transcriptsDir}/channels/test-transcribe/data/${id}/transcript.json`, ) ) { transcribed++; @@ -189,7 +190,7 @@ test.describe("Transcribe missing sharding", () => { // own 2 items (the remaining set), never 3 (the whole channel). await writeFile( resolvePath( - "test-transcripts/channels/test-transcribe/data/vidB/transcript.json", + `${testPaths().transcriptsDir}/channels/test-transcribe/data/vidB/transcript.json`, ), JSON.stringify({ cues: [] }), ); @@ -204,7 +205,7 @@ test.describe("Transcribe missing sharding", () => { ).toBeVisible({ timeout: 10_000 }); const cfg = await readJson<ShardFile>( - "test-transcripts/channels/test-transcribe/shard-transcribe-missing.json", + `${testPaths().transcriptsDir}/channels/test-transcribe/shard-transcribe-missing.json`, ); // The remaining set is {vidA, vidC} — vidB is already transcribed. expect(cfg.items).toHaveLength(2); @@ -232,7 +233,7 @@ test.describe("Save shard (no run)", () => { ).toBeVisible({ timeout: 10_000 }); const cfg = await readJson<ShardFile>( - "test-transcripts/channels/test-transcribe/shard-transcribe-missing.json", + `${testPaths().transcriptsDir}/channels/test-transcribe/shard-transcribe-missing.json`, ); expect(cfg.totalShards).toBe(2); expect(cfg.shardIndex).toBe(1); @@ -244,7 +245,7 @@ test.describe("Save shard (no run)", () => { for (const id of ["vidA", "vidB", "vidC"]) { if ( await pathExists( - `test-transcripts/channels/test-transcribe/data/${id}/transcript.json`, + `${testPaths().transcriptsDir}/channels/test-transcribe/data/${id}/transcript.json`, ) ) { transcribed++; @@ -279,7 +280,7 @@ test.describe("Save shard (no run)", () => { for (const id of ["vidA", "vidB", "vidC"]) { if ( await pathExists( - `test-transcripts/channels/test-transcribe/data/${id}/transcript.json`, + `${testPaths().transcriptsDir}/channels/test-transcribe/data/${id}/transcript.json`, ) ) { transcribed++; @@ -290,7 +291,7 @@ test.describe("Save shard (no run)", () => { }); test.describe("Download missing sharding", () => { - const channelRoot = "test-transcripts/channels/test-transcribe"; + const channelRoot = `${testPaths().transcriptsDir}/channels/test-transcribe`; // Make all three videos missing (clear their audio) and set a 3-URL playlist. // The shard slices the *missing* set: vidA/vidB/vidC sorted, shard 1 of 2 diff --git a/editor/e2e/site-scope.spec.ts b/editor/e2e/site-scope.spec.ts @@ -1,7 +1,7 @@ import { test, expect, type Page } from "@playwright/test"; import { activeSiteCookieName } from "../app/lib/activeSite"; import { baseUrl } from "./baseUrl"; -import { readJson, resetData, writeSettings, writeSite } from "./helpers"; +import { readJson, resetData, writeSettings, writeSite, testPaths } from "./helpers"; type SiteFile = { channels: { slug: string }[] }; @@ -143,7 +143,7 @@ test("creating a channel under a site adds it to that site's membership", async await page.waitForURL("**/channels/gamma", { timeout: 10_000 }); const site = await readJson<SiteFile>( - "test-transcripts/sites/alpha/site.json", + `${testPaths().transcriptsDir}/sites/alpha/site.json`, ); expect(site.channels.map((c) => c.slug)).toContain("gamma"); diff --git a/editor/e2e/sites-crud.spec.ts b/editor/e2e/sites-crud.spec.ts @@ -1,5 +1,5 @@ import { test, expect } from "@playwright/test"; -import { pathExists, readJson, resetData, writeSite } from "./helpers"; +import { pathExists, readJson, resetData, writeSite, testPaths } from "./helpers"; type SiteFile = { siteId: string; @@ -41,7 +41,7 @@ test("create a site with channel membership via the UI", async ({ page }) => { ).toBeVisible(); const site = await readJson<SiteFile>( - "test-transcripts/sites/jeralyzer/site.json", + `${testPaths().transcriptsDir}/sites/jeralyzer/site.json`, ); expect(site.siteTitle).toBe("Jeralyzer"); expect(site.channels.map((c) => c.slug)).toContain("test-youtube"); @@ -55,7 +55,7 @@ test("a cited-only channel saves to citedChannels, shows on the list, and Includ }) => { await resetData("one-youtube-channel-with-data"); type CitedSiteFile = SiteFile & { citedChannels?: { slug: string }[] }; - const file = "test-transcripts/sites/citing/site.json"; + const file = `${testPaths().transcriptsDir}/sites/citing/site.json`; const include = page.getByRole("checkbox", { name: /include test youtube channel/i }); const citedOnly = page.getByRole("checkbox", { name: "Cited only: Test YouTube Channel" }); const save = async (name: RegExp) => { @@ -117,7 +117,7 @@ test("list shows configured sites and edit updates branding", async ({ // persisted file until the rename completes rather than reading it once. await expect(async () => { const site = await readJson<SiteFile>( - "test-transcripts/sites/alpha/site.json", + `${testPaths().transcriptsDir}/sites/alpha/site.json`, ); expect(site.siteTitle).toBe("Alpha Renamed"); }).toPass({ timeout: 10_000 }); @@ -132,7 +132,7 @@ test("delete removes the site config", async ({ page }) => { await page.getByRole("button", { name: /delete/i }).click(); await expect(page.getByText("Doomed")).toHaveCount(0); - expect(await pathExists("test-transcripts/sites/doomed/site.json")).toBe( + expect(await pathExists(`${testPaths().transcriptsDir}/sites/doomed/site.json`)).toBe( false, ); }); @@ -153,7 +153,7 @@ test("new site inherits the global social links by default (no socialLinks key)" ).toBeVisible(); const site = await readJson<SocialSiteFile>( - "test-transcripts/sites/inheritsite/site.json", + `${testPaths().transcriptsDir}/sites/inheritsite/site.json`, ); // Inheriting = the key is absent so resolveSocialLinks falls back to global. expect("socialLinks" in site).toBe(false); @@ -180,7 +180,7 @@ test("unchecking inherit and adding a link writes the site's own socialLinks", a ).toBeVisible(); const site = await readJson<SocialSiteFile>( - "test-transcripts/sites/ownlinks/site.json", + `${testPaths().transcriptsDir}/sites/ownlinks/site.json`, ); expect(site.socialLinks).toHaveLength(1); expect(site.socialLinks?.[0].label).toBe("Mastodon"); @@ -204,7 +204,7 @@ test("unchecking inherit with no links writes an empty socialLinks override", as ).toBeVisible(); const site = await readJson<SocialSiteFile>( - "test-transcripts/sites/nolinks/site.json", + `${testPaths().transcriptsDir}/sites/nolinks/site.json`, ); // Explicit empty override = show no links even if a global default exists. expect(site.socialLinks).toEqual([]); @@ -253,7 +253,7 @@ test("public URL and a featured related-sites group round-trip to disk", async ( ).toBeVisible(); const site = await readJson<RelatedSiteFile>( - "test-transcripts/sites/beta/site.json", + `${testPaths().transcriptsDir}/sites/beta/site.json`, ); expect(site.siteUrl).toBe("https://beta.example"); expect(site.relatedSites).toEqual([ @@ -319,7 +319,7 @@ test("inline-chips flag round-trips; seeded default group has it on", async ({ // Poll: the "Saved" status and the on-disk write can land slightly apart. await expect(async () => { const site = await readJson<GroupsSiteFile>( - "test-transcripts/sites/chipsite/site.json", + `${testPaths().transcriptsDir}/sites/chipsite/site.json`, ); expect(site.groups[0].inline).toBe(true); // Flag-off groups serialize without the key at all. @@ -340,7 +340,7 @@ test("archives + per-video transcript downloads opt-outs round-trip", async ({ await writeSite("optout", { siteTitle: "Opt Out" }); type OptOutSiteFile = { archives?: boolean; transcriptDownloads?: boolean }; - const file = "test-transcripts/sites/optout/site.json"; + const file = `${testPaths().transcriptsDir}/sites/optout/site.json`; const archives = page.getByRole("checkbox", { name: /generate downloadable archive zips/i, }); @@ -395,7 +395,7 @@ test("the search switch round-trips; a legacy publish: cited reads as off and sa await writeSite("reportonly", { siteTitle: "Report Only", publish: "cited" }); type SearchSiteFile = { search?: boolean; publish?: string }; - const file = "test-transcripts/sites/reportonly/site.json"; + const file = `${testPaths().transcriptsDir}/sites/reportonly/site.json`; const search = page.getByRole("checkbox", { name: "Search", exact: true }); const save = async () => { await page.getByRole("button", { name: /save site/i }).click(); @@ -444,7 +444,7 @@ test("the listed opt-out round-trips, and a save of another field keeps it", asy }); type ListedSiteFile = { siteTitle?: string; listed?: boolean }; - const file = "test-transcripts/sites/fixture-unlisted/site.json"; + const file = `${testPaths().transcriptsDir}/sites/fixture-unlisted/site.json`; const listed = page.getByRole("checkbox", { name: "List on the Archilyzer homepage and hub", }); @@ -493,7 +493,7 @@ test("the hub form's per-video transcript downloads opt-out round-trips to homep }) => { await resetData("empty"); type HomepageFile = { siteTitle?: string; transcriptDownloads?: boolean }; - const file = "test-transcripts/sites/_homepage/homepage.json"; + const file = `${testPaths().transcriptsDir}/sites/_homepage/homepage.json`; // The hub form is the one on /sites whose submit is "Save config". const form = page .locator("form") @@ -551,7 +551,7 @@ test("brand accent radio group + wordmark lead round-trip to site.json", async ( await writeSite("brandy", { siteTitle: "Brandyalyzer" }); type BrandSiteFile = { accent?: string; wordmarkLead?: string }; - const file = "test-transcripts/sites/brandy/site.json"; + const file = `${testPaths().transcriptsDir}/sites/brandy/site.json`; const accents = page.getByRole("group", { name: "Brand accent" }); const radio = (name: string | RegExp) => accents.getByRole("radio", { name, exact: typeof name === "string" }); @@ -636,7 +636,7 @@ test("a private site saves its audience, and every deploy refuses it before any await expect(page.getByRole("status").filter({ hasText: "Saved" })).toBeVisible(); await expect(async () => { const site = await readJson<{ audience?: string; cloudflareProject?: string }>( - "test-transcripts/sites/privsite/site.json", + `${testPaths().transcriptsDir}/sites/privsite/site.json`, ); expect(site.audience).toBe("private"); expect(site.cloudflareProject).toBe("never-real"); @@ -659,7 +659,7 @@ test("a private site saves its audience, and every deploy refuses it before any await audience.selectOption("public"); await page.getByRole("button", { name: /save site/i }).click(); await expect(async () => { - const site = await readJson<Record<string, unknown>>("test-transcripts/sites/privsite/site.json"); + const site = await readJson<Record<string, unknown>>(`${testPaths().transcriptsDir}/sites/privsite/site.json`); expect("audience" in site).toBe(false); }).toPass({ timeout: 10_000 }); }); diff --git a/editor/e2e/sites-homepage.spec.ts b/editor/e2e/sites-homepage.spec.ts @@ -28,6 +28,7 @@ import { resolvePath, writeSettings, writeSite, + testPaths, } from "./helpers"; const group = (page: Page) => @@ -63,11 +64,11 @@ type Meta = { async function metasOfKind(kind: string): Promise<Meta[]> { const files = ( - await readdir(resolvePath("test-transcripts/.jobs")).catch(() => []) + await readdir(resolvePath(`${testPaths().transcriptsDir}/.jobs`)).catch(() => []) ).filter((f) => f.endsWith(".meta.json")); const metas: Meta[] = []; for (const f of files) { - const meta = await readJson<Meta>(`test-transcripts/.jobs/${f}`).catch( + const meta = await readJson<Meta>(`${testPaths().transcriptsDir}/.jobs/${f}`).catch( () => null, ); if (meta?.kind === kind) metas.push(meta); @@ -204,7 +205,7 @@ test("Build homepage enqueues the index update, then build-homepage, on the publ const log = (await res.json()) as { status: string; content: string }; expect(log.status).toBe("cancelled"); expect(log.content).toBe(""); - expect(await pathExists(`test-transcripts/.jobs/${job.id}.log`)).toBe(false); + expect(await pathExists(`${testPaths().transcriptsDir}/.jobs/${job.id}.log`)).toBe(false); // …and its sidecar says so too (release 13 slice W1). A job cancelled while // queued used to keep the "queued" its enqueue wrote: the cancel path never // rewrote the meta, so a restart's boot pass could re-queue a job the diff --git a/editor/e2e/skip-live.spec.ts b/editor/e2e/skip-live.spec.ts @@ -10,11 +10,12 @@ import { resetData, resolvePath, writeSettings, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; const CHANNEL = "test-live"; -const ROOT = `test-transcripts/channels/${CHANNEL}`; +const ROOT = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; const here = path.dirname(fileURLToPath(import.meta.url)); type DownloadOutcome = { diff --git a/editor/e2e/social-channel.spec.ts b/editor/e2e/social-channel.spec.ts @@ -10,7 +10,7 @@ import { test, expect } from "@playwright/test"; import { mkdir, mkdtemp, readFile, writeFile } from "node:fs/promises"; import os from "node:os"; import path from "node:path"; -import { resetData, readJson, pathExists, resolvePath, generateReport } from "./helpers"; +import { resetData, readJson, pathExists, resolvePath, generateReport, testPaths } from "./helpers"; import { THREAD_URL as FORUM_THREAD_URL, threadPage, @@ -102,9 +102,9 @@ test("creating a social channel round-trips through parseChannelConfig", async ( await expect .poll( async () => - (await pathExists("test-transcripts/channels/faketester/config.json")) + (await pathExists(`${testPaths().transcriptsDir}/channels/faketester/config.json`)) ? await readJson<ChannelConfig>( - "test-transcripts/channels/faketester/config.json", + `${testPaths().transcriptsDir}/channels/faketester/config.json`, ) : null, { timeout: 15_000 }, @@ -135,10 +135,10 @@ test("fetch-posts writes month-sharded JSONL + a posts-archive, and re-running i await expect .poll( async () => - (await pathExists("test-transcripts/channels/faketester/posts-archive")) + (await pathExists(`${testPaths().transcriptsDir}/channels/faketester/posts-archive`)) ? ( await readFile( - resolvePath("test-transcripts/channels/faketester/posts-archive"), + resolvePath(`${testPaths().transcriptsDir}/channels/faketester/posts-archive`), "utf8", ) ) @@ -150,10 +150,10 @@ test("fetch-posts writes month-sharded JSONL + a posts-archive, and re-running i .toBe(3); const june = await readJsonl( - "test-transcripts/channels/faketester/posts/2026-06.jsonl", + `${testPaths().transcriptsDir}/channels/faketester/posts/2026-06.jsonl`, ); const may = await readJsonl( - "test-transcripts/channels/faketester/posts/2026-05.jsonl", + `${testPaths().transcriptsDir}/channels/faketester/posts/2026-05.jsonl`, ); expect(june).toHaveLength(2); expect(may).toHaveLength(1); @@ -179,11 +179,11 @@ test("fetch-posts writes month-sharded JSONL + a posts-archive, and re-running i .poll( async () => { const june2 = await readJsonl( - "test-transcripts/channels/faketester/posts/2026-06.jsonl", + `${testPaths().transcriptsDir}/channels/faketester/posts/2026-06.jsonl`, ); const archive = ( await readFile( - resolvePath("test-transcripts/channels/faketester/posts-archive"), + resolvePath(`${testPaths().transcriptsDir}/channels/faketester/posts-archive`), "utf8", ) ) @@ -219,7 +219,7 @@ test("a forum thread URL makes a forum-thread channel, and saved pages import in await page.locator('input[name="fetchPostsNow"]').uncheck(); await page.getByRole("button", { name: /create|add channel|save/i }).first().click(); - const configPath = "test-transcripts/channels/the-teapot-collectors-thread/config.json"; + const configPath = `${testPaths().transcriptsDir}/channels/the-teapot-collectors-thread/config.json`; await expect .poll(async () => ((await pathExists(configPath)) ? await readJson<ChannelConfig>(configPath) : null), { timeout: 15_000, @@ -253,7 +253,7 @@ test("a forum thread URL makes a forum-thread channel, and saved pages import in await page.getByLabel("saved pages path").fill(saves); await page.getByRole("button", { name: "import saved pages" }).click(); - const archive = "test-transcripts/channels/the-teapot-collectors-thread/posts-archive"; + const archive = `${testPaths().transcriptsDir}/channels/the-teapot-collectors-thread/posts-archive`; await expect .poll( async () => diff --git a/editor/e2e/social-fetcher-picker.spec.ts b/editor/e2e/social-fetcher-picker.spec.ts @@ -3,12 +3,12 @@ // the channel page. import { test, expect } from "@playwright/test"; import { mkdir, writeFile } from "node:fs/promises"; -import { resetData, readJson, resolvePath } from "./helpers"; +import { resetData, readJson, resolvePath, testPaths } from "./helpers"; type Cfg = { postFetcher?: string; platform?: string }; async function makeSocialChannel(slug: string, platform: string, fetcher: string) { - const dir = resolvePath(`test-transcripts/channels/${slug}`); + const dir = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}`); await mkdir(dir, { recursive: true }); await writeFile( `${dir}/config.json`, @@ -44,7 +44,7 @@ test("an X channel offers every X scraping method and switching persists", async // The choice is persisted to the channel config, not just local state. await expect - .poll(async () => (await readJson<Cfg>("test-transcripts/channels/x-chan/config.json")).postFetcher, + .poll(async () => (await readJson<Cfg>(`${testPaths().transcriptsDir}/channels/x-chan/config.json`)).postFetcher, { timeout: 10_000 }) .toBe("x-nitter"); diff --git a/editor/e2e/storage-locations.spec.ts b/editor/e2e/storage-locations.spec.ts @@ -18,6 +18,7 @@ import { resetData, resolvePath, writeSettings, + testPaths, } from "./helpers"; // STORAGE LOCATIONS: the page, and the one click that follows a disk. @@ -42,9 +43,9 @@ const SLUG = "test-youtube"; const VIDEO = "20240101_test1234567"; const UUID = "e2e-platter-uuid"; -const channelDir = () => resolvePath(`test-transcripts/channels/${SLUG}`); +const channelDir = () => resolvePath(`${testPaths().transcriptsDir}/channels/${SLUG}`); const mediaLink = () => join(channelDir(), "media"); -const controlFile = () => resolvePath("test-transcripts/.fake-findmnt.json"); +const controlFile = () => resolvePath(`${testPaths().transcriptsDir}/.fake-findmnt.json`); async function writeControl(control: { mounts?: Array<Record<string, unknown>>; @@ -71,7 +72,7 @@ async function relocateOnDisk(root: string): Promise<string> { ); await symlink(target, mediaLink()); const config = await readJson<Record<string, unknown>>( - `test-transcripts/channels/${SLUG}/config.json`, + `${testPaths().transcriptsDir}/channels/${SLUG}/config.json`, ); await writeFile( join(channelDir(), "config.json"), @@ -84,7 +85,7 @@ async function relocateOnDisk(root: string): Promise<string> { async function storedVolumeUuid(id: string): Promise<string | undefined> { const s = await readJson<{ storage: { locations: Array<{ id: string; volume?: { uuid?: string } }> }; - }>("test-settings.json"); + }>(testPaths().settingsFile); return s.storage.locations.find((l) => l.id === id)?.volume?.uuid; } @@ -181,7 +182,7 @@ test("the page lists a location with its status, counts and refusals", async ({ // It landed in settings.json, opt-in included. const settings = await readJson<{ storage: { locations: Array<Record<string, unknown>> }; - }>("test-settings.json"); + }>(testPaths().settingsFile); const stored = settings.storage.locations.find((l) => l.id === "warm"); expect(stored?.root).toBe(second); expect(stored?.autoRepoint).toBe(true); @@ -276,14 +277,14 @@ test("a volume that came up somewhere else is re-pointed in one click", async ({ expect( ( await readJson<{ mediaDir?: string }>( - `test-transcripts/channels/${SLUG}/config.json`, + `${testPaths().transcriptsDir}/channels/${SLUG}/config.json`, ) ).mediaDir, ).toBe(targetB); // ...and so does the location. const settings = await readJson<{ storage: { locations: Array<{ id: string; root: string }> }; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(settings.storage.locations.find((l) => l.id === "cold")?.root).toBe( rootB, ); @@ -383,7 +384,7 @@ test("the saved-video store moves onto a location, and back", async ({ const root = testInfo.outputPath("platter"); await mkdir(root, { recursive: true }); // Something to move. The store is <root>/<slug>/<videoId>/<container>. - const storeDir = resolvePath("test-transcripts/saved-videos"); + const storeDir = resolvePath(`${testPaths().transcriptsDir}/saved-videos`); await mkdir(join(storeDir, SLUG, VIDEO), { recursive: true }); await writeFile( join(storeDir, SLUG, VIDEO, "source-media.mp4"), @@ -424,7 +425,7 @@ test("the saved-video store moves onto a location, and back", async ({ expect(await readlink(storeDir)).toBe(target); const after = await readJson<{ storage: { savedVideosLocationId?: string }; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(after.storage.savedVideosLocationId).toBe("cold"); // EVERY READER KEEPS WORKING, THROUGH THE LINK, UNCHANGED — which is the @@ -457,10 +458,10 @@ test("the saved-video store moves onto a location, and back", async ({ ); const back = await readJson<{ storage: { savedVideosLocationId?: string }; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(back.storage.savedVideosLocationId).toBe(undefined); // The target was reclaimed, and the store is a real directory again. - expect(await pathExists("test-transcripts/saved-videos/" + SLUG)).toBe(true); + expect(await pathExists(`${testPaths().transcriptsDir}/saved-videos/` + SLUG)).toBe(true); }); // A KILLED COPY LEAVES A MARKER NOTHING WILL EVER CLEAR, and without Resume the @@ -472,7 +473,7 @@ test("an interrupted store move is resumable from the page", async ({ await resetData("one-youtube-channel-with-data"); const root = testInfo.outputPath("platter"); await mkdir(root, { recursive: true }); - const storeDir = resolvePath("test-transcripts/saved-videos"); + const storeDir = resolvePath(`${testPaths().transcriptsDir}/saved-videos`); await mkdir(join(storeDir, SLUG, VIDEO), { recursive: true }); await writeFile( join(storeDir, SLUG, VIDEO, "source-media.mp4"), @@ -490,7 +491,7 @@ test("an interrupted store move is resumable from the page", async ({ const target = join(root, "saved-videos"); await mkdir(join(target, SLUG, VIDEO), { recursive: true }); await writeFile( - resolvePath("test-transcripts/.relocating-saved-videos.json"), + resolvePath(`${testPaths().transcriptsDir}/.relocating-saved-videos.json`), JSON.stringify( { target, @@ -516,7 +517,7 @@ test("an interrupted store move is resumable from the page", async ({ ); expect(await readlink(storeDir)).toBe(target); expect( - await pathExists("test-transcripts/.relocating-saved-videos.json"), + await pathExists(`${testPaths().transcriptsDir}/.relocating-saved-videos.json`), ).toBe(false); }); @@ -537,7 +538,7 @@ test("a store move to an unmounted root refuses before it creates anything", asy await resetData("one-youtube-channel-with-data"); // The root the location names is NOT created — that is the whole point. const root = join(testInfo.outputPath("never-mounted"), "platter"); - const storeDir = resolvePath("test-transcripts/saved-videos"); + const storeDir = resolvePath(`${testPaths().transcriptsDir}/saved-videos`); await mkdir(join(storeDir, SLUG, VIDEO), { recursive: true }); await writeFile( join(storeDir, SLUG, VIDEO, "source-media.mp4"), @@ -570,7 +571,7 @@ test("a store move to an unmounted root refuses before it creates anything", asy ).toBe("not really an mp4"); const settings = await readJson<{ storage: { savedVideosLocationId?: string }; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(settings.storage.savedVideosLocationId ?? "").toBe(""); }); @@ -588,7 +589,7 @@ test("Evict fetched windows removes an old one and leaves a recent one", async ( test.setTimeout(120_000); await resetData("one-youtube-channel-with-data"); const clipsDir = resolvePath( - `test-transcripts/channels/${SLUG}/data/${VIDEO}/clips`, + `${testPaths().transcriptsDir}/channels/${SLUG}/data/${VIDEO}/clips`, ); await mkdir(clipsDir, { recursive: true }); const old = join(clipsDir, "10.00-40.00.mp4"); @@ -705,7 +706,7 @@ test("evicting at any age needs the tick as well as the preview", async ({ async function storedHealth(): Promise<Record<string, unknown> | undefined> { const s = await readJson<{ storage?: { health?: Record<string, unknown> } }>( - "test-settings.json", + testPaths().settingsFile, ); return s.storage?.health; } diff --git a/editor/e2e/sync-break-on-existing.spec.ts b/editor/e2e/sync-break-on-existing.spec.ts @@ -4,6 +4,7 @@ import { generateReport, readJson, resetData, + testPaths, } from "./helpers"; test("treats yt-dlp exit code 101 as success and updates lastSyncedAt", async ({ @@ -28,7 +29,7 @@ test("treats yt-dlp exit code 101 as success and updates lastSyncedAt", async ({ // Config now has lastSyncedAt set to a parseable ISO string. const config = await readJson<{ lastSyncedAt?: string }>( - "test-transcripts/channels/archived-channel/config.json", + `${testPaths().transcriptsDir}/channels/archived-channel/config.json`, ); expect(typeof config.lastSyncedAt).toBe("string"); expect(Number.isNaN(Date.parse(config.lastSyncedAt!))).toBe(false); diff --git a/editor/e2e/sync-deep.spec.ts b/editor/e2e/sync-deep.spec.ts @@ -7,6 +7,7 @@ import { resetData, resolvePath, writeSettings, + testPaths, } from "./helpers"; // The sync FULL SWEEP: one full listing enumeration that refreshes the stored @@ -21,7 +22,7 @@ import { const CHANNEL = "availability-test"; const FIXTURE = "availability-baseline"; -const channelRoot = `test-transcripts/channels/${CHANNEL}`; +const channelRoot = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; // The baseline fixture's on-disk video dirs (canonical ids). const ALL_IDS = [ diff --git a/editor/e2e/tags.spec.ts b/editor/e2e/tags.spec.ts @@ -1,5 +1,5 @@ import { test, expect, type Page } from "@playwright/test"; -import { buildIndex, readJson, resetData, writeSite } from "./helpers"; +import { buildIndex, readJson, resetData, writeSite, testPaths } from "./helpers"; // Curated tags — the vocabulary, the rules, and the three writers. // @@ -49,7 +49,7 @@ type TagsFile = { >; }; -const tagsFile = () => readJson<TagsFile>("test-transcripts/tags.json"); +const tagsFile = () => readJson<TagsFile>(`${testPaths().transcriptsDir}/tags.json`); async function withIndex(page: Page) { await writeSite("testsite", { @@ -490,7 +490,7 @@ test("a site overlays presentation and cannot touch rules, assignments or a labe await expect(page.getByTestId("site-tags-saved")).toBeVisible(); const site = await readJson<TagsFile>( - "test-transcripts/sites/testsite/tags.json", + `${testPaths().transcriptsDir}/sites/testsite/tags.json`, ); // The row holds ONLY what this site said. No label — not even a copy of the // corpus one — because the site file is coerced at the site layer, where a @@ -521,7 +521,7 @@ test("a site overlays presentation and cannot touch rules, assignments or a labe .getByLabel("label for eva-collab", { exact: true }), ).toHaveAttribute("placeholder", "On mic"); expect( - (await readJson<TagsFile>("test-transcripts/sites/testsite/tags.json")) + (await readJson<TagsFile>(`${testPaths().transcriptsDir}/sites/testsite/tags.json`)) .tags[0].label, ).toBeUndefined(); }); diff --git a/editor/e2e/testPaths.ts b/editor/e2e/testPaths.ts @@ -0,0 +1,51 @@ +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +// WHERE A TEST SERVER'S DATA LIVES — one function, for the specs, the helpers +// and the config (plans/e2e-speed.md S5: a server per worker needs every path a +// spec touches to come from the worker's own root, not a literal). +// +// The root is the editor directory unless E2E_DATA_ROOT names another; under it +// sit the same names the suite has always used. `dev:test` / `start:test` read +// the same variable (`${E2E_DATA_ROOT:-$(pwd)}`), so a server and the specs +// that drive it agree by construction. Nothing sets it yet: one worker, the +// editor directory, exactly the paths of before. +// +// E2E_-prefixed on purpose, never TRANSCRIPTS_DIR / SETTINGS_FILE: a +// `--share-data` worktree's `.worktree-env` sets TRANSCRIPTS_DIR to the REAL +// corpus, and resetData() deletes this directory. + +const here = dirname(fileURLToPath(import.meta.url)); +export const EDITOR_ROOT = resolve(here, ".."); + +export type TestPaths = { + /** The data root: the editor directory, or E2E_DATA_ROOT. */ + root: string; + /** TRANSCRIPTS_DIR of the test server — what resetData() replaces. */ + transcriptsDir: string; + /** SETTINGS_FILE of the test server (and of the editor suite's export server). */ + settingsFile: string; + /** EXPORT_PUBLIC_DIR of the test server. */ + exportPublicDir: string; + /** EDITOR_CHANGELOG_FILE / EXPORT_CHANGELOG_FILE: the cut-release specs' disposable changelogs. */ + editorChangelog: string; + exportChangelog: string; +}; + +export function testPathsFor(root: string): TestPaths { + const transcriptsDir = join(root, "test-transcripts"); + return { + root, + transcriptsDir, + settingsFile: join(root, "test-settings.json"), + exportPublicDir: join(transcriptsDir, ".export-public"), + editorChangelog: join(root, "test-changelog.md"), + exportChangelog: join(root, "test-export-changelog.md"), + }; +} + +/** This process's test data paths (read per call, so a worker's env applies). */ +export function testPaths(): TestPaths { + const root = process.env.E2E_DATA_ROOT?.trim(); + return testPathsFor(root ? resolve(root) : EDITOR_ROOT); +} diff --git a/editor/e2e/title-filter.spec.ts b/editor/e2e/title-filter.spec.ts @@ -7,6 +7,7 @@ import { readJson, resetData, resolvePath, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; @@ -18,7 +19,7 @@ import { baseUrl } from "./baseUrl"; // `needsauthvid01` is the sentinel the fake refuses without cookies, so the scan // has one video it cannot read. const CHANNEL = "test-filter"; -const ROOT = `test-transcripts/channels/${CHANNEL}`; +const ROOT = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; const GUEST = ["guestvid0001", "guestvid0002"]; const PLAIN = ["plainvid0001", "plainvid0002"]; const NEEDS_AUTH = "needsauthvid01"; diff --git a/editor/e2e/transcript-source.spec.ts b/editor/e2e/transcript-source.spec.ts @@ -6,11 +6,12 @@ import { readJson, resetData, resolvePath, + testPaths, } from "./helpers"; const CHANNEL = "test-youtube"; const VIDEO_DIR = "20240101_test1234567"; -const ROOT = `test-transcripts/channels/${CHANNEL}`; +const ROOT = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; const DATA = `${ROOT}/data/${VIDEO_DIR}`; const VIDEO_URL = `/channels/${CHANNEL}/videos/${VIDEO_DIR}`; const VTT = "WEBVTT\n\n00:00:00.000 --> 00:00:05.000\nhello\n"; diff --git a/editor/e2e/truncated-check.spec.ts b/editor/e2e/truncated-check.spec.ts @@ -7,12 +7,12 @@ import { mkdir, writeFile } from "node:fs/promises"; import { test, expect } from "@playwright/test"; -import { pathExists, readJson, resetData, resolvePath, generateReport } from "./helpers"; +import { pathExists, readJson, resetData, resolvePath, generateReport, testPaths } from "./helpers"; import { baseUrl } from "./baseUrl"; const CHANNEL = "test-transcribe"; -const DATA = `test-transcripts/channels/${CHANNEL}/data`; -const SNAPSHOT_REL = `test-transcripts/channels/${CHANNEL}/snapshot.json`; +const DATA = `${testPaths().transcriptsDir}/channels/${CHANNEL}/data`; +const SNAPSHOT_REL = `${testPaths().transcriptsDir}/channels/${CHANNEL}/snapshot.json`; const MARKER_REL = `${DATA}/vidTrunc/exclude-truncated-check.json`; const WHISPER = JSON.stringify({ transcription: [{ text: "hello" }] }); diff --git a/editor/e2e/undownloaded.spec.ts b/editor/e2e/undownloaded.spec.ts @@ -4,6 +4,7 @@ import { generateReport, pathExists, resetData, + testPaths, } from "./helpers"; test("shows empty state when there is no playlist", async ({ page }) => { @@ -73,7 +74,7 @@ test("undownloaded list shrinks after a one-click whisper completes", async ({ expect( await pathExists( - "test-transcripts/channels/test-youtube/data/fake00000002/transcript.json", + `${testPaths().transcriptsDir}/channels/test-youtube/data/fake00000002/transcript.json`, ), ).toBe(true); diff --git a/editor/e2e/video-filter-combine.spec.ts b/editor/e2e/video-filter-combine.spec.ts @@ -10,10 +10,11 @@ import { generateReport, resetData, resolvePath, + testPaths, } from "./helpers"; const CHANNEL = "test-transcribe"; -const DATA = `test-transcripts/channels/${CHANNEL}/data`; +const DATA = `${testPaths().transcriptsDir}/channels/${CHANNEL}/data`; // A non-empty whisper transcript so the video reads as transcribed (and isn't // flagged untranscribable for being empty). diff --git a/editor/e2e/video-page.spec.ts b/editor/e2e/video-page.spec.ts @@ -6,6 +6,7 @@ import { pathExists, resetData, resolvePath, + testPaths, } from "./helpers"; test("per-video page renders metadata and file list", async ({ page }) => { @@ -46,7 +47,7 @@ test("WhisperPanel renders failure list as links to per-video pages", async ({ await resetData("one-transcribe-channel-with-audio"); await writeFile( resolvePath( - "test-transcripts/channels/test-transcribe/failed-transcriptions", + `${testPaths().transcriptsDir}/channels/test-transcribe/failed-transcriptions`, ), "vidA\nvidB\n", ); @@ -65,7 +66,7 @@ test("failed entry stays in the list across reloads (skip semantics)", async ({ await resetData("one-transcribe-channel-with-audio"); await writeFile( resolvePath( - "test-transcripts/channels/test-transcribe/failed-transcriptions", + `${testPaths().transcriptsDir}/channels/test-transcribe/failed-transcriptions`, ), "vidA\n", ); @@ -87,7 +88,7 @@ test("failed entry stays in the list across reloads (skip semantics)", async ({ // …and it stays on the failed list (skip semantics persist). const failList = await readFile( resolvePath( - "test-transcripts/channels/test-transcribe/failed-transcriptions", + `${testPaths().transcriptsDir}/channels/test-transcribe/failed-transcriptions`, ), "utf8", ); @@ -111,7 +112,7 @@ test("transcribe-one writes transcript.json for a specific audio file", async ({ .poll( () => pathExists( - "test-transcripts/channels/test-transcribe/data/vidA/transcript.json", + `${testPaths().transcriptsDir}/channels/test-transcribe/data/vidA/transcript.json`, ), { timeout: 30_000 }, ) @@ -149,13 +150,13 @@ test("transcode keeps source and writes audio.<target>", async ({ page }) => { ).toContainText("wrote", { timeout: 30_000 }); expect( await pathExists( - "test-transcripts/channels/test-transcribe/data/vidA/audio.mp3", + `${testPaths().transcriptsDir}/channels/test-transcribe/data/vidA/audio.mp3`, ), ).toBe(true); // Source file still on disk. expect( await pathExists( - "test-transcripts/channels/test-transcribe/data/vidA/audio.m4a", + `${testPaths().transcriptsDir}/channels/test-transcribe/data/vidA/audio.m4a`, ), ).toBe(true); }); @@ -167,7 +168,7 @@ test("audio + whisper for a YouTube video with no auto-subs", async ({ // Stage a video dir whose name matches the URL id so fake-ytdlp's audio // output (data/<id>/audio.<fmt>) lands back in the same dir we navigate to. const dir = resolvePath( - "test-transcripts/channels/test-youtube/data/test1234567", + `${testPaths().transcriptsDir}/channels/test-youtube/data/test1234567`, ); await mkdir(dir, { recursive: true }); await writeFile( @@ -189,7 +190,7 @@ test("audio + whisper for a YouTube video with no auto-subs", async ({ ).toContainText("Transcribe test1234567 done", { timeout: 30_000 }); expect( await pathExists( - "test-transcripts/channels/test-youtube/data/test1234567/audio.mp3", + `${testPaths().transcriptsDir}/channels/test-youtube/data/test1234567/audio.mp3`, ), ).toBe(true); }); @@ -221,7 +222,7 @@ test("Delete file removes a single file from the directory", async ({ page }) => page.on("dialog", (d) => d.accept()); expect( await pathExists( - "test-transcripts/channels/test-youtube/data/20240101_test1234567/transcript.en.vtt", + `${testPaths().transcriptsDir}/channels/test-youtube/data/20240101_test1234567/transcript.en.vtt`, ), ).toBe(true); await page.getByLabel("delete file transcript.en.vtt").click(); @@ -230,7 +231,7 @@ test("Delete file removes a single file from the directory", async ({ page }) => await expect(page.getByLabel("file name metadata.info.json")).toBeVisible(); expect( await pathExists( - "test-transcripts/channels/test-youtube/data/20240101_test1234567/transcript.en.vtt", + `${testPaths().transcriptsDir}/channels/test-youtube/data/20240101_test1234567/transcript.en.vtt`, ), ).toBe(false); }); @@ -254,7 +255,7 @@ test("Delete directory wrong-id confirmation shows an error", async ({ ); expect( await pathExists( - "test-transcripts/channels/test-youtube/data/20240101_test1234567", + `${testPaths().transcriptsDir}/channels/test-youtube/data/20240101_test1234567`, ), ).toBe(true); }); @@ -272,7 +273,7 @@ test("Delete directory removes the dir and redirects to the channel page", async await expect(page).toHaveURL("/channels/test-youtube"); expect( await pathExists( - "test-transcripts/channels/test-youtube/data/20240101_test1234567", + `${testPaths().transcriptsDir}/channels/test-youtube/data/20240101_test1234567`, ), ).toBe(false); }); @@ -283,7 +284,7 @@ test("Mark untranscribable writes empty transcript and prunes failure list", asy await resetData("one-transcribe-channel-with-audio"); await writeFile( resolvePath( - "test-transcripts/channels/test-transcribe/failed-transcriptions", + `${testPaths().transcriptsDir}/channels/test-transcribe/failed-transcriptions`, ), "vidA\nvidOther\n", ); @@ -295,7 +296,7 @@ test("Mark untranscribable writes empty transcript and prunes failure list", asy const raw = await readFile( resolvePath( - "test-transcripts/channels/test-transcribe/data/vidA/transcript.json", + `${testPaths().transcriptsDir}/channels/test-transcribe/data/vidA/transcript.json`, ), "utf8", ); @@ -303,7 +304,7 @@ test("Mark untranscribable writes empty transcript and prunes failure list", asy const list = await readFile( resolvePath( - "test-transcripts/channels/test-transcribe/failed-transcriptions", + `${testPaths().transcriptsDir}/channels/test-transcribe/failed-transcriptions`, ), "utf8", ); @@ -325,7 +326,7 @@ test("Mark untranscribable button is absent when transcript already exists", asy test("text files render a preview, not the audio player", async ({ page }) => { await resetData("one-youtube-channel-with-data"); const dir = resolvePath( - "test-transcripts/channels/test-youtube/data/20240101_test1234567", + `${testPaths().transcriptsDir}/channels/test-youtube/data/20240101_test1234567`, ); // Stage misleadingly-named text files plus a real audio.mp3 in the same // video dir. Old code matched name.startsWith("audio.") and would render @@ -367,7 +368,7 @@ test("text files render a preview, not the audio player", async ({ page }) => { test("JSON preview pretty-prints minified content", async ({ page }) => { await resetData("one-youtube-channel-with-data"); const dir = resolvePath( - "test-transcripts/channels/test-youtube/data/20240101_test1234567", + `${testPaths().transcriptsDir}/channels/test-youtube/data/20240101_test1234567`, ); await writeFile(`${dir}/nested.json`, '{"a":1,"b":[2,3],"c":{"d":"e"}}\n'); @@ -386,7 +387,7 @@ test("JSON preview falls back to raw text when the file is not valid JSON", asyn }) => { await resetData("one-youtube-channel-with-data"); const dir = resolvePath( - "test-transcripts/channels/test-youtube/data/20240101_test1234567", + `${testPaths().transcriptsDir}/channels/test-youtube/data/20240101_test1234567`, ); const raw = "not valid json {{{"; await writeFile(`${dir}/broken.json`, raw); @@ -405,7 +406,7 @@ test("JSON preview falls back to raw text when the file is not valid JSON", asyn test("audioFiles count excludes audio.vtt and audio.json", async ({ page }) => { await resetData("one-youtube-channel-with-data"); const dir = resolvePath( - "test-transcripts/channels/test-youtube/data/20240101_test1234567", + `${testPaths().transcriptsDir}/channels/test-youtube/data/20240101_test1234567`, ); await writeFile(`${dir}/audio.vtt`, "WEBVTT\n"); await writeFile(`${dir}/audio.json`, "{}\n"); @@ -441,7 +442,7 @@ test("Transcode card lists a kept source video (audio.mp4) so it can be re-extra // appeared and the user could not overwrite the truncated mp3 from the UI. await resetData("one-transcribe-channel-with-audio"); const dir = resolvePath( - "test-transcripts/channels/test-transcribe/data/vidA", + `${testPaths().transcriptsDir}/channels/test-transcribe/data/vidA`, ); await writeFile(`${dir}/audio.mp4`, "fake source container"); await writeFile(`${dir}/audio.mp3`, "truncated extraction"); diff --git a/editor/e2e/video-titles.spec.ts b/editor/e2e/video-titles.spec.ts @@ -15,10 +15,11 @@ import { generateReport, resetData, resolvePath, + testPaths, } from "./helpers"; const CHANNEL = "test-youtube"; -const ROOT = `test-transcripts/channels/${CHANNEL}`; +const ROOT = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; const DOWNLOADED = "fake00000001"; const SCANNED = "fake00000002"; const BARE = "fake00000003"; diff --git a/editor/e2e/whisper-video.spec.ts b/editor/e2e/whisper-video.spec.ts @@ -1,6 +1,6 @@ import { readFile, rm, writeFile } from "node:fs/promises"; import { test, expect } from "@playwright/test"; -import { pathExists, resetData, resolvePath } from "./helpers"; +import { pathExists, resetData, resolvePath, testPaths } from "./helpers"; test("one-click whisper downloads audio then transcribes a YouTube video", async ({ page, @@ -10,7 +10,7 @@ test("one-click whisper downloads audio then transcribes a YouTube video", async // page treats it as untranscribed. await rm( resolvePath( - "test-transcripts/channels/test-youtube/data/fake00000001/transcript.en.vtt", + `${testPaths().transcriptsDir}/channels/test-youtube/data/fake00000001/transcript.en.vtt`, ), ); @@ -26,12 +26,12 @@ test("one-click whisper downloads audio then transcribes a YouTube video", async expect( await pathExists( - "test-transcripts/channels/test-youtube/data/fake00000001/audio.mp3", + `${testPaths().transcriptsDir}/channels/test-youtube/data/fake00000001/audio.mp3`, ), ).toBe(true); expect( await pathExists( - "test-transcripts/channels/test-youtube/data/fake00000001/transcript.json", + `${testPaths().transcriptsDir}/channels/test-youtube/data/fake00000001/transcript.json`, ), ).toBe(true); }); @@ -51,14 +51,14 @@ test("one-click whisper skips download when audio is already on disk", async ({ expect( await pathExists( - "test-transcripts/channels/test-transcribe/data/vidA/transcript.json", + `${testPaths().transcriptsDir}/channels/test-transcribe/data/vidA/transcript.json`, ), ).toBe(true); // The fake-ytdlp script appends each invocation to fake-ytdlp.invocations // in the channel root. Confirm no download-one entry was written for vidA. const invocationsPath = resolvePath( - "test-transcripts/channels/test-transcribe/fake-ytdlp.invocations", + `${testPaths().transcriptsDir}/channels/test-transcribe/fake-ytdlp.invocations`, ); const invocations = await readFile(invocationsPath, "utf8").catch(() => ""); expect(invocations).not.toContain("download-one:"); @@ -75,12 +75,12 @@ test("one-click whisper ignores a leftover live-chat .part sidecar", async ({ await resetData("youtube-with-playlist"); await rm( resolvePath( - "test-transcripts/channels/test-youtube/data/fake00000001/transcript.en.vtt", + `${testPaths().transcriptsDir}/channels/test-youtube/data/fake00000001/transcript.en.vtt`, ), ); await writeFile( resolvePath( - "test-transcripts/channels/test-youtube/data/fake00000001/audio.live_chat.json.part", + `${testPaths().transcriptsDir}/channels/test-youtube/data/fake00000001/audio.live_chat.json.part`, ), "[]", ); @@ -99,12 +99,12 @@ test("one-click whisper ignores a leftover live-chat .part sidecar", async ({ expect( await pathExists( - "test-transcripts/channels/test-youtube/data/fake00000001/audio.mp3", + `${testPaths().transcriptsDir}/channels/test-youtube/data/fake00000001/audio.mp3`, ), ).toBe(true); expect( await pathExists( - "test-transcripts/channels/test-youtube/data/fake00000001/transcript.json", + `${testPaths().transcriptsDir}/channels/test-youtube/data/fake00000001/transcript.json`, ), ).toBe(true); }); @@ -118,12 +118,12 @@ test("one-click whisper ignores a completed live-chat sidecar", async ({ await resetData("youtube-with-playlist"); await rm( resolvePath( - "test-transcripts/channels/test-youtube/data/fake00000001/transcript.en.vtt", + `${testPaths().transcriptsDir}/channels/test-youtube/data/fake00000001/transcript.en.vtt`, ), ); await writeFile( resolvePath( - "test-transcripts/channels/test-youtube/data/fake00000001/audio.live_chat.json", + `${testPaths().transcriptsDir}/channels/test-youtube/data/fake00000001/audio.live_chat.json`, ), "[]", ); diff --git a/editor/e2e/whisper.spec.ts b/editor/e2e/whisper.spec.ts @@ -7,6 +7,7 @@ import { pathExists, resetData, resolvePath, + testPaths, } from "./helpers"; // A video the downloader couldn't produce real audio for: the dir exists but the @@ -14,7 +15,7 @@ import { // `failed-corrupt-source` outcome. Helper writes that state plus a stale // failed-transcriptions entry (the bug being fixed wrongly left these behind). async function writeCorruptSourceVideo(id: string, alreadyFailed: boolean) { - const dir = `test-transcripts/channels/test-transcribe/data/${id}`; + const dir = `${testPaths().transcriptsDir}/channels/test-transcribe/data/${id}`; await mkdir(resolvePath(dir), { recursive: true }); await writeFile(resolvePath(`${dir}/audio.m4a.part`), "partial-bytes"); await writeFile( @@ -30,7 +31,7 @@ async function writeCorruptSourceVideo(id: string, alreadyFailed: boolean) { if (alreadyFailed) { await writeFile( resolvePath( - "test-transcripts/channels/test-transcribe/failed-transcriptions", + `${testPaths().transcriptsDir}/channels/test-transcribe/failed-transcriptions`, ), `${id}\n`, ); @@ -49,7 +50,7 @@ test("transcribes every audio file with no transcript", async ({ page }) => { for (const id of ["vidA", "vidB", "vidC"]) { expect( await pathExists( - `test-transcripts/channels/test-transcribe/data/${id}/transcript.json`, + `${testPaths().transcriptsDir}/channels/test-transcribe/data/${id}/transcript.json`, ), ).toBe(true); } @@ -71,7 +72,7 @@ test("Transcribe missing excludes VTT-only videos instead of failing them", asyn ); const failPath = - "test-transcripts/channels/test-youtube/failed-transcriptions"; + `${testPaths().transcriptsDir}/channels/test-youtube/failed-transcriptions`; if (await pathExists(failPath)) { const raw = await readFile(resolvePath(failPath), "utf8"); expect(raw).not.toContain("fake00000001"); @@ -79,7 +80,7 @@ test("Transcribe missing excludes VTT-only videos instead of failing them", asyn expect( await pathExists( - "test-transcripts/channels/test-youtube/data/fake00000001/transcript.json", + `${testPaths().transcriptsDir}/channels/test-youtube/data/fake00000001/transcript.json`, ), ).toBe(false); }); @@ -103,14 +104,14 @@ test("Transcribe missing skips corrupt-source videos and auto-prunes them from t // must not have been transcribed or re-recorded as failed. const raw = await readFile( resolvePath( - "test-transcripts/channels/test-transcribe/failed-transcriptions", + `${testPaths().transcriptsDir}/channels/test-transcribe/failed-transcriptions`, ), "utf8", ); expect(raw).not.toContain("vidBad"); expect( await pathExists( - "test-transcripts/channels/test-transcribe/data/vidBad/transcript.json", + `${testPaths().transcriptsDir}/channels/test-transcribe/data/vidBad/transcript.json`, ), ).toBe(false); }); @@ -167,7 +168,7 @@ test("Retry failures button is gone; Clear failure list takes its place", async await resetData("one-transcribe-channel-with-audio"); await writeFile( resolvePath( - "test-transcripts/channels/test-transcribe/failed-transcriptions", + `${testPaths().transcriptsDir}/channels/test-transcribe/failed-transcriptions`, ), "vidA\nvidB\n", ); @@ -187,7 +188,7 @@ test("clearing the failure list lets the next Transcribe missing retry them", as await resetData("one-transcribe-channel-with-audio"); await writeFile( resolvePath( - "test-transcripts/channels/test-transcribe/failed-transcriptions", + `${testPaths().transcriptsDir}/channels/test-transcribe/failed-transcriptions`, ), "vidA\nvidB\n", ); @@ -209,7 +210,7 @@ test("clearing the failure list lets the next Transcribe missing retry them", as expect( await readFile( resolvePath( - "test-transcripts/channels/test-transcribe/failed-transcriptions", + `${testPaths().transcriptsDir}/channels/test-transcribe/failed-transcriptions`, ), "utf8", ), @@ -231,7 +232,7 @@ test("Clean audio removes audio files only from transcribed videos", async ({ // vidA gets a transcript so its audio should be cleaned. await writeFile( resolvePath( - "test-transcripts/channels/test-transcribe/data/vidA/transcript.json", + `${testPaths().transcriptsDir}/channels/test-transcribe/data/vidA/transcript.json`, ), JSON.stringify({ result: { language: "en" }, transcription: [] }), ); @@ -245,18 +246,18 @@ test("Clean audio removes audio files only from transcribed videos", async ({ // vidA's audio is gone, transcript stays. expect( await pathExists( - "test-transcripts/channels/test-transcribe/data/vidA/audio.m4a", + `${testPaths().transcriptsDir}/channels/test-transcribe/data/vidA/audio.m4a`, ), ).toBe(false); expect( await pathExists( - "test-transcripts/channels/test-transcribe/data/vidA/transcript.json", + `${testPaths().transcriptsDir}/channels/test-transcribe/data/vidA/transcript.json`, ), ).toBe(true); // vidB has no transcript, its audio is left alone. expect( await pathExists( - "test-transcripts/channels/test-transcribe/data/vidB/audio.m4a", + `${testPaths().transcriptsDir}/channels/test-transcribe/data/vidB/audio.m4a`, ), ).toBe(true); }); diff --git a/editor/e2e/widget.spec.ts b/editor/e2e/widget.spec.ts @@ -17,6 +17,7 @@ import { writeSettings, writeChannelConfig, generateReport, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; @@ -28,7 +29,7 @@ async function seedCleanableChannel( slug: string = CLEAN_SLUG, bytes: number = 2_621_440, ): Promise<void> { - const full = resolvePath(`test-transcripts/channels/${slug}/snapshot.json`); + const full = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}/snapshot.json`); await mkdir(dirname(full), { recursive: true }); await writeFile( full, @@ -807,7 +808,7 @@ test("the widget's controls hold and release the backfill lane", async ({ const laneHeld = async () => ( await readJson<{ autoQueue?: { backfill?: { held?: boolean } } }>( - "test-settings.json", + testPaths().settingsFile, ).catch(() => ({}) as { autoQueue?: { backfill?: { held?: boolean } } }) ).autoQueue?.backfill?.held ?? false; diff --git a/editor/e2e/worker-remote.spec.ts b/editor/e2e/worker-remote.spec.ts @@ -15,13 +15,14 @@ import { resetData, resolvePath, writeSettings, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; const TOKEN = "test-worker-token"; async function makeTranscribeChannel(slug: string, ids: string[]) { - const root = resolvePath(`test-transcripts/channels/${slug}`); + const root = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}`); await mkdir(root, { recursive: true }); await writeFile( `${root}/config.json`, @@ -149,7 +150,7 @@ test("a batch dispatched to a remote worker transcribes via the HTTP round-trip" .poll( () => pathExists( - "test-transcripts/channels/remote-chan/data/vidremote1/transcript.json", + `${testPaths().transcriptsDir}/channels/remote-chan/data/vidremote1/transcript.json`, ), { timeout: 30_000 }, ) @@ -179,7 +180,7 @@ test("an unreachable remote is auto-disabled and the video fails over to a local .poll( () => pathExists( - "test-transcripts/channels/failover-chan/data/vidfo1/transcript.json", + `${testPaths().transcriptsDir}/channels/failover-chan/data/vidfo1/transcript.json`, ), { timeout: 30_000 }, ) diff --git a/editor/e2e/workers.spec.ts b/editor/e2e/workers.spec.ts @@ -13,6 +13,7 @@ import { resetData, resolvePath, writeSettings, + testPaths, } from "./helpers"; import { baseUrl } from "./baseUrl"; @@ -25,7 +26,7 @@ async function relaunchPool() { } async function makeTranscribeChannel(slug: string, ids: string[]) { - const root = resolvePath(`test-transcripts/channels/${slug}`); + const root = resolvePath(`${testPaths().transcriptsDir}/channels/${slug}`); await mkdir(root, { recursive: true }); await writeFile( `${root}/config.json`, @@ -46,7 +47,7 @@ async function transcriptCount(slug: string, ids: string[]): Promise<number> { let n = 0; for (const id of ids) { if ( - await pathExists(`test-transcripts/channels/${slug}/data/${id}/transcript.json`) + await pathExists(`${testPaths().transcriptsDir}/channels/${slug}/data/${id}/transcript.json`) ) { n++; } @@ -216,7 +217,7 @@ test("Set as default persists the enabled workers and re-applies them on relaunc // Persisted to the worker-defaults file as just the GPU id. const saved = await readJson<{ enabledWorkerIds: string[] }>( - "test-transcripts/.workers/defaults.json", + `${testPaths().transcriptsDir}/.workers/defaults.json`, ); expect(saved.enabledWorkerIds).toEqual(["gpu"]); @@ -297,7 +298,7 @@ test.describe("worker configuration", () => { const saved = await readJson<{ workers?: { name: string; appId?: string; priority: number }[]; - }>("test-settings.json"); + }>(testPaths().settingsFile); expect(saved.workers).toHaveLength(3); expect(saved.workers?.[2].name).toBe("CPU chough"); expect(saved.workers?.[2].appId).toBe("chough"); @@ -325,7 +326,7 @@ test.describe("worker configuration", () => { const saved = await readJson<{ workers?: { appId?: string; config?: { remoteUrl?: string } }[]; - }>("test-settings.json"); + }>(testPaths().settingsFile); const choughs = (saved.workers ?? []).filter((w) => w.appId === "chough"); expect(choughs.length).toBe(2); expect(choughs.every((w) => w.config?.remoteUrl === "http://localhost:8165")).toBe( diff --git a/editor/e2e/x-session.spec.ts b/editor/e2e/x-session.spec.ts @@ -5,7 +5,7 @@ // under the test corpus, never a real browser profile. import { test, expect } from "@playwright/test"; -import { readJson, resetData, resolvePath, writeSettings } from "./helpers"; +import { readJson, resetData, resolvePath, writeSettings, testPaths } from "./helpers"; // By relative path: a runtime import of the package specifier does not resolve // under playwright's loader (digest.spec.ts says why). import { writeFirefoxCookieStore } from "../../common/social/__fixtures__/firefoxCookieStore"; @@ -29,7 +29,7 @@ test("settings page renders the X session section", async ({ page }) => { test("the login source select persists, and Check shows a status line", async ({ page }) => { await resetData("empty"); - const profileDir = resolvePath("test-transcripts/firefox-fixture/xl.default-release"); + const profileDir = resolvePath(`${testPaths().transcriptsDir}/firefox-fixture/xl.default-release`); await writeFirefoxCookieStore(profileDir, [ { host: ".x.com", @@ -61,7 +61,7 @@ test("the login source select persists, and Check shows a status line", async ({ await select.selectOption("profile"); await expect(section.getByRole("status")).toHaveText("Login source saved."); await expect(inUse).toHaveText("In use: Connected profile"); - expect((await readJson<{ social?: unknown }>("test-settings.json")).social).toEqual({ + expect((await readJson<{ social?: unknown }>(testPaths().settingsFile)).social).toEqual({ x: { cookieSource: "profile" }, }); @@ -74,7 +74,7 @@ test("the login source select persists, and Check shows a status line", async ({ // Back to automatic: nothing stored, the default decides again. await select.selectOption("auto"); await expect(inUse).toHaveText(`In use: Browser login (${spec}) (automatic)`); - expect((await readJson<{ social?: unknown }>("test-settings.json")).social).toEqual({ x: {} }); + expect((await readJson<{ social?: unknown }>(testPaths().settingsFile)).social).toEqual({ x: {} }); }); // Where X posts appear — `social.x.visibility` (release 17 slice XP). The two X @@ -86,7 +86,7 @@ test("where X posts appear persists, beside the login source and without it", as const visibility = page.getByLabel("Where X posts appear"); const source = page.getByLabel("x cookie source", { exact: true }); const social = async () => - (await readJson<{ social?: unknown }>("test-settings.json")).social; + (await readJson<{ social?: unknown }>(testPaths().settingsFile)).social; await expect(visibility).toHaveValue("public"); await expect(page.locator("[data-x-posts-visibility]")).toContainText( diff --git a/editor/package.json b/editor/package.json @@ -5,8 +5,8 @@ "type": "module", "scripts": { "dev": "next dev --port ${EDITOR_PORT:-3001}", - "dev:test": "WORKER_TOKEN=test-worker-token TRANSCRIPTS_DIR=$(pwd)/test-transcripts EXPORT_PUBLIC_DIR=$(pwd)/test-transcripts/.export-public SETTINGS_FILE=$(pwd)/test-settings.json EDITOR_CHANGELOG_FILE=$(pwd)/test-changelog.md EXPORT_CHANGELOG_FILE=$(pwd)/test-export-changelog.md YTDLP_BIN=$(pwd)/e2e/fixtures/bin/fake-ytdlp.mjs GALLERY_DL_BIN=$(pwd)/e2e/fixtures/bin/fake-gallery-dl.mjs WHISPER_BIN=$(pwd)/e2e/fixtures/bin/fake-whisper.mjs WHISPER_MODEL=/dev/null CHOUGH_BIN=$(pwd)/e2e/fixtures/bin/fake-chough.mjs CHOUGH_MODEL=/dev/null PARAKEET_STITCH_BIN=$(pwd)/e2e/fixtures/bin/fake-parakeet-stitch.mjs PARAKEET_CLI=/dev/null PARAKEET_MODEL=/dev/null DIARIZE_BIN=$(pwd)/e2e/fixtures/bin/fake-diarize.mjs FFMPEG_BIN=$(pwd)/e2e/fixtures/bin/fake-ffmpeg.mjs FFPROBE_BIN=$(pwd)/e2e/fixtures/bin/fake-ffprobe.mjs OLLAMA_URL=http://127.0.0.1:${OLLAMA_STUB_PORT:-11435} CLAUDE_BIN=$(pwd)/e2e/fixtures/bin/fake-claude.mjs FINDMNT_BIN=$(pwd)/e2e/fixtures/bin/fake-findmnt.mjs UDISKSCTL_BIN=$(pwd)/e2e/fixtures/bin/fake-udisksctl.mjs next dev --port ${PORT:-3011}", - "start:test": "WORKER_TOKEN=test-worker-token TRANSCRIPTS_DIR=$(pwd)/test-transcripts EXPORT_PUBLIC_DIR=$(pwd)/test-transcripts/.export-public SETTINGS_FILE=$(pwd)/test-settings.json EDITOR_CHANGELOG_FILE=$(pwd)/test-changelog.md EXPORT_CHANGELOG_FILE=$(pwd)/test-export-changelog.md YTDLP_BIN=$(pwd)/e2e/fixtures/bin/fake-ytdlp.mjs GALLERY_DL_BIN=$(pwd)/e2e/fixtures/bin/fake-gallery-dl.mjs WHISPER_BIN=$(pwd)/e2e/fixtures/bin/fake-whisper.mjs WHISPER_MODEL=/dev/null CHOUGH_BIN=$(pwd)/e2e/fixtures/bin/fake-chough.mjs CHOUGH_MODEL=/dev/null PARAKEET_STITCH_BIN=$(pwd)/e2e/fixtures/bin/fake-parakeet-stitch.mjs PARAKEET_CLI=/dev/null PARAKEET_MODEL=/dev/null DIARIZE_BIN=$(pwd)/e2e/fixtures/bin/fake-diarize.mjs FFMPEG_BIN=$(pwd)/e2e/fixtures/bin/fake-ffmpeg.mjs FFPROBE_BIN=$(pwd)/e2e/fixtures/bin/fake-ffprobe.mjs OLLAMA_URL=http://127.0.0.1:${OLLAMA_STUB_PORT:-11435} CLAUDE_BIN=$(pwd)/e2e/fixtures/bin/fake-claude.mjs FINDMNT_BIN=$(pwd)/e2e/fixtures/bin/fake-findmnt.mjs UDISKSCTL_BIN=$(pwd)/e2e/fixtures/bin/fake-udisksctl.mjs next start --port ${PORT:-3011}", + "dev:test": "WORKER_TOKEN=test-worker-token TRANSCRIPTS_DIR=${E2E_DATA_ROOT:-$(pwd)}/test-transcripts EXPORT_PUBLIC_DIR=${E2E_DATA_ROOT:-$(pwd)}/test-transcripts/.export-public SETTINGS_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-settings.json EDITOR_CHANGELOG_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-changelog.md EXPORT_CHANGELOG_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-export-changelog.md YTDLP_BIN=$(pwd)/e2e/fixtures/bin/fake-ytdlp.mjs GALLERY_DL_BIN=$(pwd)/e2e/fixtures/bin/fake-gallery-dl.mjs WHISPER_BIN=$(pwd)/e2e/fixtures/bin/fake-whisper.mjs WHISPER_MODEL=/dev/null CHOUGH_BIN=$(pwd)/e2e/fixtures/bin/fake-chough.mjs CHOUGH_MODEL=/dev/null PARAKEET_STITCH_BIN=$(pwd)/e2e/fixtures/bin/fake-parakeet-stitch.mjs PARAKEET_CLI=/dev/null PARAKEET_MODEL=/dev/null DIARIZE_BIN=$(pwd)/e2e/fixtures/bin/fake-diarize.mjs FFMPEG_BIN=$(pwd)/e2e/fixtures/bin/fake-ffmpeg.mjs FFPROBE_BIN=$(pwd)/e2e/fixtures/bin/fake-ffprobe.mjs OLLAMA_URL=http://127.0.0.1:${OLLAMA_STUB_PORT:-11435} CLAUDE_BIN=$(pwd)/e2e/fixtures/bin/fake-claude.mjs FINDMNT_BIN=$(pwd)/e2e/fixtures/bin/fake-findmnt.mjs UDISKSCTL_BIN=$(pwd)/e2e/fixtures/bin/fake-udisksctl.mjs next dev --port ${PORT:-3011}", + "start:test": "WORKER_TOKEN=test-worker-token TRANSCRIPTS_DIR=${E2E_DATA_ROOT:-$(pwd)}/test-transcripts EXPORT_PUBLIC_DIR=${E2E_DATA_ROOT:-$(pwd)}/test-transcripts/.export-public SETTINGS_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-settings.json EDITOR_CHANGELOG_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-changelog.md EXPORT_CHANGELOG_FILE=${E2E_DATA_ROOT:-$(pwd)}/test-export-changelog.md YTDLP_BIN=$(pwd)/e2e/fixtures/bin/fake-ytdlp.mjs GALLERY_DL_BIN=$(pwd)/e2e/fixtures/bin/fake-gallery-dl.mjs WHISPER_BIN=$(pwd)/e2e/fixtures/bin/fake-whisper.mjs WHISPER_MODEL=/dev/null CHOUGH_BIN=$(pwd)/e2e/fixtures/bin/fake-chough.mjs CHOUGH_MODEL=/dev/null PARAKEET_STITCH_BIN=$(pwd)/e2e/fixtures/bin/fake-parakeet-stitch.mjs PARAKEET_CLI=/dev/null PARAKEET_MODEL=/dev/null DIARIZE_BIN=$(pwd)/e2e/fixtures/bin/fake-diarize.mjs FFMPEG_BIN=$(pwd)/e2e/fixtures/bin/fake-ffmpeg.mjs FFPROBE_BIN=$(pwd)/e2e/fixtures/bin/fake-ffprobe.mjs OLLAMA_URL=http://127.0.0.1:${OLLAMA_STUB_PORT:-11435} CLAUDE_BIN=$(pwd)/e2e/fixtures/bin/fake-claude.mjs FINDMNT_BIN=$(pwd)/e2e/fixtures/bin/fake-findmnt.mjs UDISKSCTL_BIN=$(pwd)/e2e/fixtures/bin/fake-udisksctl.mjs next start --port ${PORT:-3011}", "build": "next build", "start": "UV_THREADPOOL_SIZE=${UV_THREADPOOL_SIZE:-16} next start --port ${EDITOR_PORT:-3001}", "test": "tsx --test \"app/**/*.test.ts\"", diff --git a/editor/playwright.config.ts b/editor/playwright.config.ts @@ -2,6 +2,7 @@ import { spawnSync } from "node:child_process"; import path from "node:path"; import { defineConfig, devices } from "@playwright/test"; import { portFor } from "yt-dlp-transcript-common/lib/ports.mjs"; +import { testPaths } from "./e2e/testPaths"; // THE TEST-ONLY ENVIRONMENT, declared here (one-core Phase 4 slice 3). Every // variable only a harness reads carries the E2E_ prefix; the ones this config @@ -40,6 +41,11 @@ import { portFor } from "yt-dlp-transcript-common/lib/ports.mjs"; // E2E_BUILD_CHECKED set below once the stamp was checked, so the // config's second load (a worker's) does not check // again +// E2E_DATA_ROOT where the test server's data lives (default: +// this directory) — `test-transcripts/`, +// `test-settings.json`, the disposable changelogs. +// Read by `dev:test`/`start:test` and by the +// specs' testPaths() (e2e/testPaths.ts) // E2E_RACK_SHOTS=1 run the /channels rack screenshot audit // E2E_FAKE_YTDLP_AUDIO_CHECK_MODE, E2E_FAKE_YTDLP_CHUNK_DELAY_MS, // E2E_FAKE_YTDLP_CORRUPT_AFTER_CHUNK, E2E_FAKE_YTDLP_CORRUPT_RUNS, @@ -157,10 +163,7 @@ const exportBaseURL = `http://localhost:${EXPORT_PORT}`; // Share the editor's test-settings.json with the export server so the // footer (and any other server-rendered settings consumers) can be // driven from a single fixture file during E2E. -const exportSettingsFile = path.resolve( - process.cwd(), - "test-settings.json", -); +const exportSettingsFile = testPaths().settingsFile; // Footer/branding on the export server now come from a per-site config // (currentSite()), so point it at a fixture site for deterministic E2E. const exportSitesDir = path.resolve(