Archilyzer · Source

archilyzer

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

commit 29cc853307778f5bdef7756fb32f1a384c23faf6
parent f8dba78c577dc829f48ff0d06e4128c388c5708e
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 14 Oct 2026 07:30:01 -0400

umtool: specs for the article piece — the frame, the video tabs, the redirect, the note landing (P4a-2)

- piece.spec: an article piece's nine tabs, its stepper by what exists, the
  policy chip's href, keys 3 and 9; the video tabs show the article's Cut and
  another project by ?project=; a claimed project's address answers 307 to
  the article piece on the same tab (a note's tab, ?all=1's Cut), /browse
  rides both hops, the benches stay and link back; a note on the video lands
  on its tab inside the piece; 1366×768 for both kinds of piece.
- The article specs open the tab they mean through urls.articleHref (the
  reader is the Article tab, the iterations their tab); Delete article is in
  the head's ⋯; the reader's ?rv= keeps the tab beside it.

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

Diffstat:
Mumtool/e2e/article-delete.spec.ts | 13+++++++++----
Mumtool/e2e/article-evidence.spec.ts | 5+++--
Mumtool/e2e/article-integration.spec.ts | 5+++--
Mumtool/e2e/article-iterations.spec.ts | 24++++++++++++++----------
Mumtool/e2e/article-notes.spec.ts | 4+++-
Mumtool/e2e/article-slides.spec.ts | 20++++++++++++--------
Mumtool/e2e/media-draft.spec.ts | 3++-
Mumtool/e2e/media-surfaces.spec.ts | 2+-
Mumtool/e2e/piece.spec.ts | 136++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
Mumtool/e2e/projects.spec.ts | 4++--
10 files changed, 173 insertions(+), 43 deletions(-)

diff --git a/umtool/e2e/article-delete.spec.ts b/umtool/e2e/article-delete.spec.ts @@ -4,6 +4,7 @@ import path from "node:path"; import { fileURLToPath } from "node:url"; import { WARM_TIMEOUT, warm } from "./warm"; import { makeOmega } from "./fixtures/delete-fixture.mjs"; +import * as urls from "./urls"; // --------------------------------------------------------------------------- // Deleting (release 27 follow-up): every delete shows its PLAN — what goes, @@ -37,8 +38,8 @@ test.beforeAll(async ({ playwright }) => { dropOmega(); makeOmega({ articles: ARTICLES, projects: PROJECTS }); await warm(playwright, [ - "/articles/omega?tab=iterations", - "/articles/psi", + urls.articleHref({ site: "articles", id: "omega" }, { tab: "iterations" }), + urls.articleHref({ site: "articles", id: "psi" }), "/articles", "/browse/reports/delete-fixture", "/browse/reports/delete-fixture/takes", @@ -51,7 +52,7 @@ test.afterAll(dropOmega); const card = (page: Page, n: number) => page.locator(`[data-iteration='${n}']`); test("an iteration: the current one and a parent are refused with the reason; a leaf goes with its project; then the draft", async ({ page }) => { - await page.goto("/articles/omega?tab=iterations"); + await page.goto(urls.articleHref({ site: "articles", id: "omega" }, { tab: "iterations" })); await expect(page.getByRole("region", { name: "iterations", exact: true })).toHaveAttribute("data-iterations", "3"); // The current article: refused, and nothing to confirm. @@ -89,6 +90,8 @@ test("an iteration: the current one and a parent are refused with the reason; a expect(existsSync(path.join(ARTICLES, "omega", "report.json"))).toBe(true); // Then the draft itself: its directory, its iterations and their projects. + // Delete is in the piece head's ⋯ menu (P4a-2). + await page.getByRole("button", { name: "More" }).click(); await page.getByRole("button", { name: "Delete article" }).click(); const all = page.getByRole("region", { name: "delete the article omega" }); await expect(all.getByRole("list", { name: "what goes" })).toContainText("reports/omega/"); @@ -103,8 +106,10 @@ test("an iteration: the current one and a parent are refused with the reason; a }); test("an article in the making is deleted from its page, and Work says so", async ({ page }) => { - await page.goto("/articles/psi"); + await page.goto(urls.articleHref({ site: "articles", id: "psi" })); await expect(page.locator("[data-article-meta] [data-status]")).toHaveAttribute("data-status", "pending"); + // Delete is in the piece head's ⋯ menu (P4a-2). + await page.getByRole("button", { name: "More" }).click(); await page.getByRole("button", { name: "Delete article" }).click(); const plan = page.getByRole("region", { name: "delete the article psi" }); await expect(plan.getByRole("list", { name: "what goes" })).toContainText("reports/psi/"); diff --git a/umtool/e2e/article-evidence.spec.ts b/umtool/e2e/article-evidence.spec.ts @@ -3,6 +3,7 @@ import { rmSync } from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; import { WARM_TIMEOUT, warm } from "./warm"; +import * as urls from "./urls"; // --------------------------------------------------------------------------- // A citation's evidence: the transcript around it, the window that plays it, @@ -26,7 +27,7 @@ test.beforeEach(() => rmSync(NOTES, { force: true })); test.afterAll(() => rmSync(NOTES, { force: true })); test("a citation opens its evidence: the cited cue marked, the window playing from the span", async ({ page }) => { - await page.goto("/sites/priv/polemic-alpha"); + await page.goto(urls.articleHref({ site: "priv", id: "polemic-alpha" }, { tab: "article" })); await page.locator("button[data-cite='c1']").first().click(); const ev = page.locator("[data-evidence='c1']"); await expect(ev).toContainText("The vote was rigged and everybody knew."); @@ -40,7 +41,7 @@ test("a citation opens its evidence: the cited cue marked, the window playing fr }); test("with nothing on disk it says so and offers the fetch_clip line, never yt-dlp", async ({ page }) => { - await page.goto("/sites/priv/polemic-alpha"); + await page.goto(urls.articleHref({ site: "priv", id: "polemic-alpha" }, { tab: "article" })); await page.locator("button[data-cite='c2']").first().click(); const ev = page.locator("[data-evidence='c2']"); await expect(ev.locator("[data-play]")).toHaveAttribute("data-play", "none"); diff --git a/umtool/e2e/article-integration.spec.ts b/umtool/e2e/article-integration.spec.ts @@ -3,6 +3,7 @@ import { copyFileSync, existsSync, readFileSync, readdirSync, rmSync } from "nod import path from "node:path"; import { fileURLToPath } from "node:url"; import { WARM_TIMEOUT, warm } from "./warm"; +import * as urls from "./urls"; // --------------------------------------------------------------------------- // Where the two tracks meet on the article page: @@ -61,7 +62,7 @@ test.afterEach(() => { }); test("the article's video takes timed notes, on the article's notes, beside a text note", async ({ page }) => { - await page.goto("/sites/priv/polemic-alpha"); + await page.goto(urls.articleHref({ site: "priv", id: "polemic-alpha" }, { tab: "article" })); const video = page.getByTestId("article-video"); await expect(video).toBeVisible(); const scope = page.locator("[data-timed-notes='video.mp4']"); @@ -86,7 +87,7 @@ test("the article's video takes timed notes, on the article's notes, beside a te test("Add to video: the cited span lands at the end of the linked project, with an edit note; undo restores it", async ({ page, request }) => { const before = readJson(MANIFEST).timeline.length; - await page.goto("/sites/priv/polemic-alpha"); + await page.goto(urls.articleHref({ site: "priv", id: "polemic-alpha" }, { tab: "article" })); await page.locator("button[data-cite='c1']").first().click(); const add = page.locator("[data-evidence='c1'] [data-add-to-video]"); await expect(add).toContainText("sitews/polemic-alpha"); diff --git a/umtool/e2e/article-iterations.spec.ts b/umtool/e2e/article-iterations.spec.ts @@ -3,6 +3,7 @@ import { readFileSync, rmSync } from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; import { WARM_TIMEOUT, warm } from "./warm"; +import * as urls from "./urls"; // --------------------------------------------------------------------------- // An article's Iterations tab (release 27 S8), over the editor stub: its @@ -19,30 +20,33 @@ const HERE = path.dirname(fileURLToPath(import.meta.url)); const FIXTURE = path.join(HERE, "..", ".e2e-song"); const STUB_LOG = path.join(FIXTURE, "editor-stub.requests.json"); const ARTICLE = "iter-e2e"; +const ZETA = { site: "articles", id: "zeta" }; const stubAsked = (route: string) => (JSON.parse(readFileSync(STUB_LOG, "utf8")) as { route?: string; [k: string]: unknown }[]).filter((r) => r.route === route); test.beforeAll(async ({ playwright }) => { test.setTimeout(WARM_TIMEOUT); - await warm(playwright, ["/work?kind=article", "/articles/zeta", "/api/articles/iterations?article=zeta", "/api/articles/policy"]); + await warm(playwright, ["/work?kind=article", urls.articleHref(ZETA), urls.articleHref(ZETA, { tab: "iterations" }), "/api/articles/iterations?article=zeta", "/api/articles/policy"]); }); test.afterAll(() => rmSync(path.join(FIXTURE, "articles", ARTICLE), { recursive: true, force: true })); const card = (page: Page, n: number) => page.locator(`[data-iteration='${n}']`); -test("an article in the making: listed as such on Work, and opened on its iterations", async ({ page }) => { +test("an article in the making: listed as such on Work, opened as its piece, its iterations a tab", async ({ page }) => { // /articles is Work's articles since P3: zeta is a piece at the Research stage. await page.goto("/articles"); const row = page.locator("[data-lit-line][data-piece='a:articles/zeta']"); await expect(row).toHaveAttribute("data-status", "in the making"); await expect(row).toHaveAttribute("data-stage", "research"); await row.getByRole("link", { name: "zeta" }).click(); - await expect(page).toHaveURL(/\/articles\/zeta$/); - await expect(page.getByRole("link", { name: "iterations", exact: true })).toHaveAttribute("aria-current", "page"); - - await page.goto("/articles/zeta"); + // The article piece (P4a-2) opens on its Overview, the iterations summarised there. + await expect(page).toHaveURL(new RegExp(`${urls.articleHref(ZETA)}$`)); await expect(page.locator("[data-article-meta] [data-status]")).toHaveAttribute("data-status", "pending"); - await expect(page.getByRole("link", { name: "iterations", exact: true })).toHaveAttribute("aria-current", "page"); + await expect(page.locator("[data-piece-iterations='4']")).toBeVisible(); + + await page.getByTestId("piece-tab-iterations").click(); + await expect(page).toHaveURL(new RegExp(`${urls.articleHref(ZETA, { tab: "iterations" }).replace("?", "\\?")}$`)); + await expect(page.getByTestId("piece-tab-iterations")).toHaveAttribute("aria-current", "page"); const list = page.getByRole("region", { name: "iterations", exact: true }); await expect(list).toHaveAttribute("data-iterations", "4"); // Newest first. @@ -61,7 +65,7 @@ test("an article in the making: listed as such on Work, and opened on its iterat }); test("narrate an iteration's cut on a model: a step, its job followed to done", async ({ page }) => { - await page.goto("/articles/zeta?tab=iterations"); + await page.goto(urls.articleHref(ZETA, { tab: "iterations" })); const one = card(page, 1); await one.getByRole("combobox", { name: "narration model for i1" }).selectOption("claude-sonnet-5-5"); await one.getByRole("button", { name: "Narrate" }).click(); @@ -79,7 +83,7 @@ test("use, revise, copy with model, cancel: each through the editor, the list fo expect(made.status()).toBe(200); expect(await made.json()).toMatchObject({ ok: true, iteration: 1 }); - await page.goto(`/articles/${ARTICLE}`); + await page.goto(urls.articleHref({ site: "articles", id: ARTICLE }, { tab: "iterations" })); await expect(card(page, 1)).toHaveAttribute("data-status", "done", { timeout: 20_000 }); // USE THIS ITERATION: the registry writes the article's report.json. @@ -127,7 +131,7 @@ test("use, revise, copy with model, cancel: each through the editor, the list fo test("make the video: the chain's steps, run as a umtool job, resumable where it stopped", async ({ page }) => { test.setTimeout(150_000); - await page.goto(`/articles/${ARTICLE}?tab=iterations`); + await page.goto(urls.articleHref({ site: "articles", id: ARTICLE }, { tab: "iterations" })); await card(page, 1).getByRole("button", { name: "Make the video" }).click(); const chain = page.getByRole("region", { name: "i1 video chain" }); await expect(chain.locator("[data-chain-step]")).toHaveCount(10); diff --git a/umtool/e2e/article-notes.spec.ts b/umtool/e2e/article-notes.spec.ts @@ -3,6 +3,7 @@ import { existsSync, readFileSync, rmSync } from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; import { WARM_TIMEOUT, warm } from "./warm"; +import * as urls from "./urls"; // --------------------------------------------------------------------------- // Notes on an article: written beside report.json (the one corpus file umtool @@ -14,7 +15,8 @@ import { WARM_TIMEOUT, warm } from "./warm"; const HERE = path.dirname(fileURLToPath(import.meta.url)); const NOTES = path.join(HERE, "..", ".e2e-song", "sites", "priv", "reports", "polemic-alpha", "notes.json"); -const PAGE = "/sites/priv/polemic-alpha"; +// The reader: the article piece's Article tab (P4a-2). +const PAGE = urls.articleHref({ site: "priv", id: "polemic-alpha" }, { tab: "article" }); test.beforeAll(async ({ playwright }) => { diff --git a/umtool/e2e/article-slides.spec.ts b/umtool/e2e/article-slides.spec.ts @@ -3,6 +3,7 @@ import { rmSync } from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; import { WARM_TIMEOUT, warm } from "./warm"; +import * as urls from "./urls"; // --------------------------------------------------------------------------- // An article's other shapes in umtool (release 22): the published page's @@ -17,24 +18,27 @@ import { WARM_TIMEOUT, warm } from "./warm"; const HERE = path.dirname(fileURLToPath(import.meta.url)); const NOTES = path.join(HERE, "..", ".e2e-song", "sites", "priv", "reports", "polemic-alpha", "notes.json"); -const PAGE = "/sites/priv/polemic-alpha"; +const ALPHA = { site: "priv", id: "polemic-alpha" }; +const PAGE = urls.articleHref(ALPHA); +// The reader: the article piece's Article tab (P4a-2); `?rv=` opens it too. +const READER = urls.articleHref(ALPHA, { tab: "article" }); test.beforeAll(async ({ playwright }) => { test.setTimeout(WARM_TIMEOUT); - await warm(playwright, [PAGE, `${PAGE}?tab=source`, "/sites/priv/polemic-beta?tab=source", "/api/notes?article=priv/polemic-alpha"]); + await warm(playwright, [READER, urls.articleHref(ALPHA, { tab: "source" }), urls.articleHref({ site: "priv", id: "polemic-beta" }, { tab: "source" }), "/api/notes?article=priv/polemic-alpha"]); }); test.beforeEach(() => rmSync(NOTES, { force: true })); test.afterAll(() => rmSync(NOTES, { force: true })); test("the switch: slides beside the notes rail, keys step, a citation opens its evidence, Esc goes back", async ({ page }) => { - await page.goto(PAGE); + await page.goto(READER); const sw = page.locator("main [data-view-switch]"); await expect(sw.getByRole("button")).toHaveText(["Article", "Slides", "Overview"]); await expect(sw.getByRole("button", { name: "Article" })).toHaveAttribute("aria-pressed", "true"); await sw.getByRole("button", { name: "Slides" }).click(); - await expect(page).toHaveURL(/\?rv=slides#s-1$/); + await expect(page).toHaveURL(/[?&]rv=slides#s-1$/); const stage = page.locator("[data-report-slides]"); await expect(stage.locator('[data-slide="title"]')).toContainText("Alpha: the rigged vote"); await expect(page.locator("[data-article-body]")).toBeHidden(); @@ -44,7 +48,7 @@ test("the switch: slides beside the notes rail, keys step, a citation opens its await page.keyboard.press("Home"); await page.keyboard.press("ArrowRight"); await page.keyboard.press("ArrowRight"); - await expect(page).toHaveURL(/\?rv=slides#s-3$/); + await expect(page).toHaveURL(/[?&]rv=slides#s-3$/); const slide = stage.locator('[data-slide="section:first"]'); await expect(slide).toContainText("Nobody checked the claim at the time, and the clip shows it."); @@ -65,7 +69,7 @@ test("the switch: slides beside the notes rail, keys step, a citation opens its }); test("a section's open notes are counted on its slide", async ({ page }) => { - await page.goto(PAGE); + await page.goto(READER); await page.getByRole("button", { name: "note on Later" }).click(); await page.getByLabel("note text").fill("Check the date on this."); await page.getByRole("button", { name: "save note" }).click(); @@ -90,13 +94,13 @@ test("the overview pairs each part with its slide; a card opens its slide", asyn }); test("the source tab lints the slides: a section whose first sentences run long", async ({ page }) => { - await page.goto("/sites/priv/polemic-beta?tab=source"); + await page.goto(urls.articleHref({ site: "priv", id: "polemic-beta" }, { tab: "source" })); const lint = page.locator("[data-slide-lint]"); await expect(lint).toHaveAttribute("data-slide-lint", "1"); await expect(lint.locator('[data-lint="section:only"]')).toContainText("no slide points"); await expect(lint.locator('[data-lint="section:only"] a')).toHaveAttribute("href", "/sites/priv/polemic-beta?rv=slides#only"); - await page.goto(`${PAGE}?tab=source`); + await page.goto(urls.articleHref(ALPHA, { tab: "source" })); await expect(page.locator("[data-slide-lint]")).toHaveAttribute("data-slide-lint", "0"); await expect(page.locator("[data-slide-lint]")).toContainText("nothing to fix"); }); diff --git a/umtool/e2e/media-draft.spec.ts b/umtool/e2e/media-draft.spec.ts @@ -3,6 +3,7 @@ import { readFileSync } from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; import { WARM_TIMEOUT, warm } from "./warm"; +import * as urls from "./urls"; // --------------------------------------------------------------------------- // The media drafts (release 28 M1–M3; lane E adds flips, threads, youtube): @@ -50,7 +51,7 @@ async function draft(page: Page, task: string, n: number, status = "done") { { timeout: 60_000, intervals: [1000] }, ) .toBe(status); - await page.goto(`/articles/${ARTICLE}?tab=iterations`); + await page.goto(urls.articleHref({ site: "articles", id: ARTICLE }, { tab: "iterations" })); await expect(page.locator(`[data-iteration='${n}'] [data-step='${task}']`)).toHaveAttribute("data-step-status", status); } diff --git a/umtool/e2e/media-surfaces.spec.ts b/umtool/e2e/media-surfaces.spec.ts @@ -98,7 +98,7 @@ test("Draft with <model> per section: the job followed, the badge, the last run, test("Draft everything: every draft in order on the model chosen, a refused one passed, the panels skipped, then the fast build, the podcast and out/youtube.txt", async ({ page }) => { test.setTimeout(420_000); - await page.goto(`/articles/${ARTICLE}?tab=iterations`); + await page.goto(urls.articleHref({ site: "articles", id: ARTICLE }, { tab: "iterations" })); const two = page.locator("[data-iteration='2']"); // The Iterations tab's per-step drafts, beside Narrate. await expect(two.getByRole("combobox", { name: "draft task for i2" })).toBeVisible(); diff --git a/umtool/e2e/piece.spec.ts b/umtool/e2e/piece.spec.ts @@ -168,23 +168,135 @@ test("keys: 1–7 open the tabs, n runs the Next card's action; typing in a fiel await expect(page).toHaveURL(new RegExp(`${href!.replace(/[?]/g, "\\?")}$`)); }); -test("an article's video: the stepper and the lifecycle are the article's, and the head links it", async ({ page }) => { - await page.goto(urls.projectHref("gen-projects/zeta/i1")); +// ── the article-rooted piece (P4a-2) ───────────────────────────────────────── +// zeta: an article in the making (four iterations, no report.json) whose i1 and +// i3 made video projects; no current.json, so its Cut is the newest, i3. +const ZETA = { site: "articles", id: "zeta" }; +const ZETA_CUT = "gen-projects/zeta/i3"; +const ZETA_OTHER = "gen-projects/zeta/i1"; + +test("an article piece: nine tabs, the stepper by what exists, the policy chip, its keys", async ({ page }) => { + const res = await page.goto(urls.articleHref(ZETA)); + expect(res?.status()).toBe(200); await expect(page.locator("[data-piece-frame='a:articles/zeta']")).toBeVisible(); - const link = page.locator("[data-piece-article='articles/zeta'] a"); - await expect(link).toHaveAttribute("href", urls.articleHref({ site: "articles", id: "zeta" })); - // Its iterations, summarised on the Overview, with a way to all of them. - await expect(page.locator("[data-piece-iterations]")).toBeVisible(); - await expect(page.locator("[data-piece-linked-article='articles/zeta']")).toContainText("made by its iteration"); + const tabs = page.getByRole("navigation", { name: "Piece" }).getByRole("link"); + await expect(tabs).toHaveText([/^Overview/, /^Article/, /^Iterations/, /^Cut/, /^Media/, /^Build/, /^Deliver/, /^Sources/, /^History/]); + await expect(tab(page, "overview")).toHaveAttribute("aria-current", "page"); + await expect(tab(page, "iterations")).toHaveText("Iterations4"); + await expect(tab(page, "cut")).toHaveText("Cut1"); + + // Iterations exist (Research done), no report yet (Article current), its + // iterations made a video (Video done), nothing delivered. + const steps = page.getByRole("list", { name: "Stage" }).locator("li"); + await expect(steps.nth(0)).toHaveAttribute("data-step", "done"); + await expect(steps.nth(1)).toHaveAttribute("aria-current", "step"); + await expect(steps.nth(2)).toHaveAttribute("data-step", "done"); + await expect(steps.nth(3)).toHaveAttribute("data-step", "todo"); + + // The policy is a chip linking its page, not the panel. + await expect(page.locator("[data-policy-chip]")).toHaveAttribute("href", urls.generationSettingsHref()); + await expect(page.locator("[data-policy-chip]")).toContainText("balanced"); + await expect(page.getByRole("region", { name: "generation policy" })).toHaveCount(0); + + // The Overview: the Next card, the iterations, the Cut on show. + await expect(page.locator("[data-next]:visible")).toBeVisible(); + await expect(page.locator("[data-piece-iterations='4']")).toBeVisible(); + await expect(page.locator(`[data-piece-cut='${ZETA_CUT}']`)).toContainText("Cut · i3"); + await expect(page.locator("[data-piece-videos='2']")).toContainText("i1"); + + await keysReady(page); + await page.keyboard.press("3"); + await expect(page).toHaveURL(/\?tab=iterations$/); + await expect(page.getByRole("region", { name: "iterations", exact: true })).toHaveAttribute("data-iterations", "4"); + await keysReady(page); + await page.keyboard.press("9"); + await expect(page).toHaveURL(/\?tab=history$/); + await expect(page.locator("[data-provenance]")).toBeVisible(); +}); + +test("the video tabs are the claimed project's: the article's Cut, another by ?project=", async ({ page }) => { + await page.goto(urls.articleHref(ZETA, { tab: "cut" })); + await expect(tab(page, "cut")).toHaveAttribute("aria-current", "page"); + await expect(page.locator("[data-walk-start]")).toHaveAttribute("href", urls.clipBenchHref(ZETA_CUT, "a1")); + + await page.goto(urls.articleHref(ZETA, { tab: "cut", project: ZETA_OTHER })); + await expect(page.locator("[data-walk-start]")).toHaveAttribute("href", urls.clipBenchHref(ZETA_OTHER, "a1")); + // The other project rides along from tab to tab. + await expect(tab(page, "build")).toHaveAttribute("href", urls.articleHref(ZETA, { tab: "build", project: ZETA_OTHER })); + + // An article with no video project says so on the video tabs. + await page.goto(urls.articleHref({ site: "articles", id: "delta" }, { tab: "cut" })); + await expect(page.locator("[data-video-none]")).toContainText("No video project yet"); +}); + +test("a claimed project's address redirects to its article piece on the same tab; the benches stay and link back", async ({ page, request }) => { + const at = async (href: string) => { + const r = await request.get(href, { maxRedirects: 0 }); + return { status: r.status(), location: r.headers()["location"] ?? "" }; + }; + expect(await at(urls.projectHref(ZETA_CUT, { tab: "build" }))).toEqual({ status: 307, location: urls.articleHref(ZETA, { tab: "build" }) }); + expect(await at(urls.projectHref(ZETA_CUT))).toEqual({ status: 307, location: urls.articleHref(ZETA) }); + expect(await at(urls.projectHref(ZETA_OTHER, { tab: "sources" }))).toEqual({ + status: 307, + location: urls.articleHref(ZETA, { tab: "sources", project: ZETA_OTHER }), + }); + expect(await at(urls.projectHref(ZETA_CUT, { all: true }))).toEqual({ status: 307, location: urls.articleHref(ZETA, { tab: "cut", all: true }) }); + // A project no article claims is its own page. + expect((await at(urls.projectHref(PROJECT))).status).toBe(200); + + // In a browser: the old /browse address rides both hops. + await page.goto(`/browse/${ZETA_CUT}?tab=history`); + await expect(page).toHaveURL(new RegExp(`/articles/zeta\\?tab=history$`)); + await expect(tab(page, "history")).toHaveAttribute("aria-current", "page"); + + // The benches and kind views stay at the project's address, and lead back to the piece. + expect((await at(urls.takesHref(ZETA_CUT))).status).toBe(200); + expect((await at(urls.reviewHref(ZETA_CUT))).status).toBe(200); + await page.goto(urls.clipBenchHref(ZETA_CUT, "a1")); + await expect(page).toHaveURL(new RegExp(`${urls.clipBenchHref(ZETA_CUT, "a1")}$`)); + await expect(page.getByRole("navigation", { name: "Breadcrumb" }).getByRole("link", { name: "i3" })).toHaveAttribute( + "href", + urls.articleHref(ZETA, { tab: "cut" }), + ); + await page.goto(urls.clipBenchHref(ZETA_OTHER, "a1")); + await expect(page.getByRole("navigation", { name: "Breadcrumb" }).getByRole("link", { name: "i1" })).toHaveAttribute( + "href", + urls.articleHref(ZETA, { tab: "cut", project: ZETA_OTHER }), + ); +}); + +test("a note on the video lands on its tab inside the article piece", async ({ page, request }) => { + const add = await request.post(`/api/notes?project=${ZETA_CUT}`, { + data: { op: { op: "add", text: "this clip runs long", anchor: { kind: "entry", entry: "a1" } } }, + }); + expect(add.status()).toBe(200); + const id = ((await add.json()) as { note: { id: string } }).note.id; + try { + // The Inbox links the project's address; it lands on the article piece's Cut, the note kept last. + const r = await request.get(urls.projectHref(ZETA_CUT, { note: id }), { maxRedirects: 0 }); + expect(r.status()).toBe(307); + expect(r.headers()["location"]).toBe(urls.articleHref(ZETA, { tab: "cut", note: id })); + await page.goto(urls.projectHref(ZETA_CUT, { note: id })); + await expect(page).toHaveURL(new RegExp(`[?&]note=${id}$`)); + await expect(tab(page, "cut")).toHaveAttribute("aria-current", "page"); + await expect(page.locator("[data-anchored-notes='a1']")).toHaveAttribute("data-open-notes", "1"); + // The article's own address with the note and no tab finds it on the video too. + await page.goto(urls.articleHref(ZETA, { note: id })); + await expect(tab(page, "cut")).toHaveAttribute("aria-current", "page"); + } finally { + await request.post(`/api/notes?project=${ZETA_CUT}`, { data: { op: { op: "delete", id } } }); + } }); test("fits 1366×768: the head, the tabs and the Next card's action without a horizontal scroll", async ({ page }) => { await page.setViewportSize({ width: 1366, height: 768 }); - await page.goto(urls.projectHref(PROJECT)); - await expect(page.locator("[data-next-action] > a:visible")).toBeInViewport(); - await expect(tab(page, "history")).toBeInViewport(); - const overflow = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth); - expect(overflow).toBeLessThanOrEqual(0); + for (const href of [urls.projectHref(PROJECT), urls.articleHref(ZETA)]) { + await page.goto(href); + await expect(page.locator("[data-next-action] > :is(a, button):visible")).toBeInViewport(); + await expect(tab(page, "history")).toBeInViewport(); + const overflow = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth); + expect(overflow, href).toBeLessThanOrEqual(0); + } }); test("a video started from a research board: Research done, Article not applicable, the board linked", async ({ page, request }) => { diff --git a/umtool/e2e/projects.spec.ts b/umtool/e2e/projects.spec.ts @@ -180,9 +180,9 @@ test("a pass-through folder chain collapses for DISPLAY and never in the URL", a await expect(page.locator("[data-folder='reports/deep/nested']")).toContainText("deep / nested"); // The URL is not collapsed, and every level of it resolves. - await page.goto("/browse/reports/deep/nested/solo-fixture"); + await page.goto(urls.projectHref("reports/deep/nested/solo-fixture")); await expect(page.getByText("Down A Pass-Through Chain")).toBeVisible(); - await page.goto("/browse/reports/deep/nested"); + await page.goto(urls.projectHref("reports/deep/nested")); await expect(page.locator("[data-project='reports/deep/nested/solo-fixture']")).toBeVisible(); });