Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit e1b176096d233b3b491cac9152d3f1c58ec184fd
parent ddef84dd012e93a99454665c1d174ed6907b9b9b
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Mon, 19 Oct 2026 12:26:32 -0400

umtool e2e: clip-look.spec.ts — the Look panel saves and reads back, a voice named, a short framed, made and listed

The clip editor's fixture takes a name: reports/clip-look-fixture is a second copy, so the two specs never
edit one project.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Aumtool/e2e/clip-look.spec.ts | 114+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/e2e/fixtures/clip-editor-fixture.mjs | 11+++++++----
Mumtool/e2e/fixtures/make-fixture.mjs | 2++
3 files changed, 123 insertions(+), 4 deletions(-)

diff --git a/umtool/e2e/clip-look.spec.ts b/umtool/e2e/clip-look.spec.ts @@ -0,0 +1,114 @@ +import { test, expect } from "@playwright/test"; +import { existsSync, readFileSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import * as urls from "./urls"; + +// --------------------------------------------------------------------------- +// The look of a highlights cut (release 36 lane C). The Build tab's Look +// panel saves the header, the QR, the join, the loudness and the speaker +// captions into the manifest (and reads them back); the clip editor's +// Speakers list names a voice for the captions (reactions.json); Frame the +// short drags a 9:16 box on the player (the clip's vertical.crop); Make a +// short runs the job (build-video --short) and the Deliver tab's Shorts list +// shows it and plays it. Fixture: e2e/fixtures/clip-editor-fixture.mjs, as +// reports/clip-look-fixture. +// --------------------------------------------------------------------------- + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +const FIXTURE = path.join(HERE, "..", ".e2e-song"); +const PROJECT = "reports/clip-look-fixture"; +const DIR = path.join(FIXTURE, "reports", "clip-look-fixture"); +const json = (name: string) => { + try { + return JSON.parse(readFileSync(path.join(DIR, name), "utf8")); + } catch { + return null; + } +}; +const render = () => json("video.manifest.json")?.render ?? {}; +const clip = (id: string) => (json("video.manifest.json")?.timeline ?? []).find((e: { id: string }) => e.id === id) ?? null; + +test("the look: the panel saves and reads back; a voice named; a short framed, made and listed", async ({ page }) => { + test.setTimeout(240_000); + await page.setViewportSize({ width: 1366, height: 900 }); + + // ---- the Look panel -------------------------------------------------------- + await page.goto(urls.section(PROJECT, "build")); + const panel = page.locator("[data-look-panel]"); + await expect(panel).toHaveAttribute("data-look-panel", ""); + await expect(page.locator("[data-look-header]")).toBeChecked(); + await expect(page.locator("[data-look-save]")).toBeDisabled(); + await page.locator("[data-look-header]").uncheck(); + await page.locator("[data-look-qr]").uncheck(); + await page.locator("[data-look-transition]").fill("0.5"); + await page.locator("[data-look-style]").selectOption("fadeblack"); + await page.locator("[data-look-loudness]").selectOption("-16"); + await page.locator("[data-look-captions]").check(); + await page.locator("[data-look-label-host]").fill("The host"); + await page.locator("[data-look-size]").selectOption("l"); + await page.locator("[data-look-save]").click(); + await expect(page.locator("[data-look-status]")).toHaveText("Saved — the next render uses it"); + const r = render(); + expect(r.headerHeight).toBe(0); + expect(r.qr).toBe(false); + expect(r.transition).toBe(0.5); + expect(r.transitionStyle).toBe("fadeblack"); + expect(r.loudness).toEqual({ target: -16 }); + expect(r.captions).toEqual({ style: "speakers", labels: { host: "The host" }, size: "l" }); + expect(r.width).toBe(640); + // Read back after a reload. + await page.reload(); + await expect(page.locator("[data-look-panel]")).toHaveAttribute("data-look-panel", ""); + await expect(page.locator("[data-look-header]")).not.toBeChecked(); + await expect(page.locator("[data-look-qr]")).not.toBeChecked(); + await expect(page.locator("[data-look-style]")).toHaveValue("fadeblack"); + await expect(page.locator("[data-look-loudness]")).toHaveValue("-16"); + await expect(page.locator("[data-look-captions]")).toBeChecked(); + await expect(page.locator("[data-look-label-host]")).toHaveValue("The host"); + + // ---- the clip editor: a voice named, the short framed -------------------- + await page.goto(urls.clipEditorHref(PROJECT, { clip: "r001" })); + await expect(page.locator("[data-clip-editor]")).toHaveAttribute("data-clip-editor", "r001"); + const subject = page.locator('[data-speaker-label="1"]'); + await subject.fill("The narrator"); + await subject.press("Enter"); + await expect.poll(() => json("reactions.json")?.speakers?.find((s: { index: number }) => s.index === 1)?.label).toBe("The narrator"); + + await expect(page.locator("[data-editor-player]")).toHaveAttribute("data-editor-player", /^(?!looking|none)/, { timeout: 20_000 }); + await page.locator("[data-frame-short]").click(); + const box = page.locator("[data-crop-box]"); + await expect(box).toBeVisible(); + const at = await box.boundingBox(); + if (!at) throw new Error("no crop box"); + await page.mouse.move(at.x + at.width / 2, at.y + at.height / 2); + await page.mouse.down(); + await page.mouse.move(at.x + at.width / 2 + 120, at.y + at.height / 2, { steps: 6 }); + await page.mouse.up(); + await expect.poll(() => clip("r001")?.vertical?.crop?.[0] ?? null).toBeGreaterThan(0.36); + const crop = clip("r001").vertical.crop as number[]; + expect(crop[3]).toBe(1); + expect(Math.abs((crop[2] * (640 / 360)) / crop[3] - 9 / 16)).toBeLessThan(0.01); + await expect(page.locator("[data-short-maker]")).toContainText("Framed by you"); + + // ---- Make a short: the job, then the file -------------------------------- + await page.locator('[data-make-short="r001"]').click(); + await expect(page.locator("[data-short-job]")).toHaveAttribute("data-short-job", "done", { timeout: 180_000 }); + expect(existsSync(path.join(DIR, "shorts", "r001.mp4"))).toBe(true); + const rec = json("shorts/r001.json"); + expect(rec.width).toBe(1080); + expect(rec.height).toBe(1920); + expect(rec.crop).toEqual(crop); + await expect(page.locator('[data-make-short="r001"]')).toHaveText("Make the short again"); + + // ---- the Shorts list on the Deliver tab ---------------------------------- + await page.goto(urls.section(PROJECT, "deliver")); + const row = page.locator('[data-short="r001"]'); + await expect(row).toBeVisible(); + await expect(page.locator("[data-shorts]")).toHaveAttribute("data-shorts", "1"); + await row.locator('[data-short-play="r001"]').click(); + const player = page.locator('[data-short-player="r001"]'); + await expect(player).toBeVisible(); + await expect.poll(() => player.evaluate((v: HTMLVideoElement) => v.videoHeight)).toBe(1920); + await expect(row.locator('[data-short-download="r001"]')).toHaveAttribute("href", /download=1/); +}); diff --git a/umtool/e2e/fixtures/clip-editor-fixture.mjs b/umtool/e2e/fixtures/clip-editor-fixture.mjs @@ -20,13 +20,16 @@ const write = (dir, name, doc) => { }; /** - * @param {{ reports: string, manifest: Function, cachedWindow: string, cues: Array<[number, number, string]> }} o + * `name`: another copy under another name (release 36: clip-look.spec.ts's + * clip-look-fixture), so two specs never edit one project. + * + * @param {{ reports: string, manifest: Function, cachedWindow: string, cues: Array<[number, number, string]>, name?: string, title?: string }} o */ -export function makeClipEditorFixture({ reports, manifest, cachedWindow, cues }) { - const dir = path.join(reports, "clip-editor-fixture"); +export function makeClipEditorFixture({ reports, manifest, cachedWindow, cues, name = "clip-editor-fixture", title = "The Clip Editor Fixture" }) { + const dir = path.join(reports, name); const assist = (p, s, e, cs, ce, score, why) => ({ by: "assistant", proposal: p, score, why, original: { start: s, end: e, cutStart: cs, cutEnd: ce }, edits: [] }); const clip = (id, s, e, cs, ce, p, score, why, quote) => ({ type: "clip", id, video: "vid1", start: s, end: e, cutStart: cs, cutEnd: ce, quote, assist: assist(p, s, e, cs, ce, score, why) }); - const doc = manifest("clip-editor-fixture", "The Clip Editor Fixture", { siteOrigin: "https://archive.example" }, [ + const doc = manifest(name, title, { siteOrigin: "https://archive.example" }, [ clip("r001", 0.5, 3.5, 1, 3, "p001", 0.8, "host laughs at the line", "This is a complete sentence."), clip("r002", 4, 6, 4, 6, "p002", 0.7, "a comment", "And this one runs on"), clip("r003", 6.5, 8.5, 6.5, 8.5, "p003", 0.6, "a short comment", "of that it finishes here."), diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs @@ -1810,6 +1810,8 @@ makeClipDeckFixture({ reports, manifest, cachedWindow: path.join(REPORT, "out", makeMontageOpsFixture({ reports, channels: CHANNELS, manifest }); // Release 35 C2: the clip editor, an assistant's clips adjusted by hand (clip-editor.spec.ts). makeClipEditorFixture({ reports, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), cues: CUES.vid1 }); +// Release 36 lane C: the Look panel, a short's framing and Make a short (clip-look.spec.ts). +makeClipEditorFixture({ reports, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"), cues: CUES.vid1, name: "clip-look-fixture", title: "The Clip Look Fixture" }); // P4b: the bench shell's own clips, and the Media tab's fields with their draft files. makeBenchShellFixture({ reports, manifest, cachedWindow: path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4") }); // Release 28 M6: the YouTube text, previewed and built (media-draft-e.spec.ts).