commit 76d39c06ebd833ccee1ddec4d19225b2c896dd38
parent f1c7d0eb7f56668df6c2f379aa94f45b8bf9e4ed
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 14 Oct 2026 02:55:31 -0400
umtool e2e: work.spec; shell.spec covers the new rail and ⌘K; last-page follows the redirects
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
3 files changed, 228 insertions(+), 40 deletions(-)
diff --git a/umtool/e2e/last-page.spec.ts b/umtool/e2e/last-page.spec.ts
@@ -1,10 +1,11 @@
import { test, expect, type Page } from "@playwright/test";
import { LAST_PAGE_KEY } from "../lib/last-page";
-// / is the dashboard now. It used to REPLACE itself with wherever you were
-// last; it OFFERS that URL as a chip instead, with the same storage, the same
-// guard and the same HEAD-probed walk-up -- so a stale URL degrades to its
-// parent, and a hostile one is not offered at all.
+// / is the Inbox. It used to REPLACE itself with wherever you were last; it
+// OFFERS that URL as a chip instead, with the same storage, the same guard and
+// the same HEAD-probed walk-up -- so a stale URL degrades to its parent, and a
+// hostile one is not offered at all. An old address is offered where it lands
+// now (redirects.mjs): the chip shows the address after the redirect.
//
// The suite runs workers: 1 with NO state reset between tests, so a remembered
// URL leaks forward unless each test says what storage holds.
@@ -29,30 +30,40 @@ async function remembered(page: Page, value: string | null) {
const chip = (page: Page) => page.locator("[data-resume]");
-test("/ is the dashboard, and with nothing remembered there is no chip", async ({ page }) => {
+test("/ is the Inbox, and with nothing remembered there is no chip", async ({ page }) => {
await remembered(page, null);
await page.goto("/");
await expect(page).toHaveURL(/\/$/);
- await expect(page.getByRole("link", { name: "home", exact: true })).toHaveAttribute("aria-current", "page");
- await expect(page.locator("[data-panel=now]")).toBeVisible();
+ await expect(page.locator("[data-app-rail] [data-place=inbox]")).toHaveAttribute("aria-current", "page");
// Give the effect time to have run before asserting absence.
- await expect(page.locator("[data-panel=projects]")).toBeVisible();
+ await expect(page.locator("[data-inbox-count]")).toBeVisible();
+ await expect(page.locator("[data-lit-list]").first()).toHaveAttribute("data-hydrated", "");
await expect(chip(page)).toHaveCount(0);
});
test("the chip offers the page you were last on, query string included", async ({ page }) => {
// No planted value: this is the recorder's OWN write, which is what ships.
+ // /sort?limit=5 rides its redirect; the recorder writes where it landed.
await page.goto("/sort?limit=5");
+ await expect(page).toHaveURL(/\/tools\/song\/sort\?limit=5$/);
await page.goto("/");
- await expect(chip(page)).toHaveAttribute("data-resume", "/sort?limit=5");
+ await expect(chip(page)).toHaveAttribute("data-resume", "/tools/song/sort?limit=5");
await chip(page).click();
- await expect(page).toHaveURL(/\/sort\?limit=5$/);
+ await expect(page).toHaveURL(/\/tools\/song\/sort\?limit=5$/);
+});
+
+test("an old remembered address is offered where it lands now", async ({ page }) => {
+ await remembered(page, "/browse/reports/report-fixture");
+ await page.goto("/");
+ await expect(chip(page)).toHaveAttribute("data-resume", "/projects/reports/report-fixture");
});
test("a remembered URL that has gone stale walks UP instead of offering a 404", async ({ page }) => {
+ // /browse/__gone__/wide → /projects/__gone__/wide (404) → … → /browse, which
+ // lands on Work.
await remembered(page, "/browse/__gone__/wide");
await page.goto("/");
- await expect(chip(page)).toHaveAttribute("data-resume", "/browse");
+ await expect(chip(page)).toHaveAttribute("data-resume", "/work");
// And the URL really is dead -- otherwise this passes for the wrong reason
// the day that route quietly starts rendering something.
expect((await page.request.get("/browse/__gone__/wide")).status()).toBe(404);
@@ -65,19 +76,20 @@ for (const hostile of ["//evil.example", "https://evil.example", "/api/verdict",
// and one is this page.
await remembered(page, hostile);
await page.goto("/");
- await expect(page.locator("[data-panel=projects]")).toBeVisible();
+ await expect(page.locator("[data-inbox-count]")).toBeVisible();
+ await expect(page.locator("[data-lit-list]").first()).toHaveAttribute("data-hydrated", "");
await expect(chip(page)).toHaveCount(0);
});
}
-test("the song piles are one nav entry, and every pile URL still works", async ({ page }) => {
- await page.goto("/");
+test("the song piles are one nav entry under Tools, and every pile URL still works", async ({ page }) => {
+ await page.goto("/tools");
await page.locator("[data-nav-group=song] button").click();
await page.getByRole("menuitem", { name: "sort" }).click();
- await expect(page).toHaveURL(/\/sort$/);
+ await expect(page).toHaveURL(/\/tools\/song\/sort$/);
// On a pile page the group itself is lit, since the pile is under it.
await expect(page.locator("[data-nav-group=song] button")).toHaveAttribute("aria-current", "page");
- for (const p of ["/salvage", "/verify", "/keeps", "/browse/sources"]) {
+ for (const p of ["/salvage", "/verify", "/keeps", "/browse/sources", "/tools/song", "/tools/song/keeps"]) {
const res = await page.goto(p);
expect(res?.status(), `${p} should still be 200`).toBe(200);
}
diff --git a/umtool/e2e/shell.spec.ts b/umtool/e2e/shell.spec.ts
@@ -2,48 +2,116 @@ import { test, expect, type Page } from "@playwright/test";
import * as urls from "./urls";
// ---------------------------------------------------------------------------
-// The shell (plans/umtool-redesign.md, P1): the rail on every page, the place
-// you are in lit, a bench without it, the theme choice surviving a reload in
+// The shell (plans/umtool-redesign.md, P1, P3): the rail on every page --
+// Inbox · Research · Work · Tools · Settings -- with the place you are in lit,
+// a bench without it, the ⌘K palette, the theme choice surviving a reload in
// both directions, and the lit line's keys and motion.
// ---------------------------------------------------------------------------
const rail = (page: Page) => page.locator("[data-app-rail]");
-const place = (page: Page, name: string) =>
- rail(page).getByRole("navigation", { name: "Main" }).getByRole("link", { name, exact: true });
-
-// Every top-level page today, and the rail entry it lights.
-const PLACES: { url: string; lit: string }[] = [
- { url: urls.homeHref(), lit: "home" },
- { url: urls.browseHref(), lit: "browse" },
- { url: urls.decisionsHref(), lit: "decisions" },
- { url: urls.articlesHref(), lit: "articles" },
- { url: urls.sitesHref(), lit: "articles" },
- { url: urls.mixHref(), lit: "mix" },
- { url: urls.findHref(), lit: "find" },
+const place = (page: Page, id: string) => rail(page).locator(`nav[aria-label=Main] > a[data-place=${id}]`);
+
+// Every place, a page under each, and what the rail says: "page" on the
+// place's own page, "true" on a page under it.
+const PLACES: { url: string; lit: string; current: "page" | "true" }[] = [
+ { url: urls.homeHref(), lit: "inbox", current: "page" },
+ { url: urls.workHref(), lit: "work", current: "page" },
+ { url: urls.projectsHref(), lit: "work", current: "true" },
+ { url: urls.articleHref({ site: "articles", id: "delta" }), lit: "work", current: "true" },
+ { url: urls.siteHref("priv"), lit: "work", current: "true" },
+ { url: urls.toolsHref(), lit: "tools", current: "page" },
+ { url: urls.mixHref(), lit: "tools", current: "true" },
+ { url: urls.findHref(), lit: "tools", current: "true" },
+ { url: urls.systemHref(), lit: "settings", current: "page" },
];
-for (const { url, lit } of PLACES) {
+for (const { url, lit, current } of PLACES) {
test(`${url} has the rail, with ${lit} lit`, async ({ page }) => {
const res = await page.goto(url);
expect(res?.status()).toBe(200);
await expect(rail(page)).toBeVisible();
- await expect(place(page, lit)).toHaveAttribute("aria-current", "page");
+ await expect(place(page, lit)).toHaveAttribute("aria-current", current);
// Exactly one place is lit.
- await expect(rail(page).locator("nav[aria-label=Main] > a[aria-current=page]")).toHaveCount(1);
+ await expect(rail(page).locator("nav[aria-label=Main] > a[aria-current]")).toHaveCount(1);
// The page head: one Breadcrumb nav, the page's name its h1.
await expect(page.getByRole("navigation", { name: "Breadcrumb" }).locator("h1")).toHaveCount(1);
});
}
-test("a song pile lights the song group, and its menu opens in the rail", async ({ page }) => {
+test("the rail's places, in order, with Research beside them and counts in Meter", async ({ page }) => {
+ await page.goto(urls.homeHref());
+ const places = rail(page).locator("nav[aria-label=Main] > a[data-place]");
+ await expect(places).toHaveText([/^Inbox/, "Research", /^Work/, "Tools", "Settings"]);
+ // Research is R1's; the rail links it whether or not this build has it.
+ await expect(place(page, "research")).toHaveAttribute("href", urls.researchHref());
+ await expect(place(page, "settings")).toHaveAttribute("href", urls.systemHref());
+ await expect(rail(page).locator("[data-rail-count=inbox]")).toHaveText(/^\d+$/);
+ await expect(rail(page).locator("[data-rail-count=work]")).toHaveText(/^\d+$/);
+ // Tools opens into its tools only while you are in one.
+ await expect(rail(page).locator("[data-rail-sub=tools]")).toHaveCount(0);
+});
+
+test("a song pile lights Tools and the song group, and its menu opens in the rail", async ({ page }) => {
await page.goto(urls.pileHref("sort"));
+ await expect(place(page, "tools")).toHaveAttribute("aria-current", "true");
const group = rail(page).locator("[data-nav-group=song]");
await expect(group.getByRole("button")).toHaveAttribute("aria-current", "page");
- await expect(rail(page).locator("nav[aria-label=Main] > a[aria-current=page]")).toHaveCount(0);
await group.getByRole("button").click();
await expect(group.getByRole("menuitem", { name: "sort", exact: true })).toHaveAttribute("aria-current", "page");
});
+// ── ⌘K ─────────────────────────────────────────────────────────────────────
+
+const palette = (page: Page) => page.locator("dialog[data-jump]");
+
+test("⌘K opens the palette on a bench too; typing narrows it, Enter goes", async ({ page }) => {
+ await page.goto(urls.clipBenchHref("reports/report-fixture", "c01"));
+ await expect(rail(page)).toHaveCount(0);
+ await page.keyboard.press("Control+k");
+ await expect(palette(page)).toBeVisible();
+ await expect(palette(page).locator("[data-jump-input]")).toBeFocused();
+ await page.keyboard.type("find");
+ await expect(palette(page).locator("[role=option][aria-selected=true]")).toHaveAttribute("data-jump-item", "find");
+ await page.keyboard.press("Enter");
+ await expect(page).toHaveURL(/\/tools\/find$/);
+ await expect(palette(page)).toBeHidden();
+});
+
+test("the palette jumps to a piece, moves with the arrows, closes on Escape, and fits 1366×768", async ({ page }) => {
+ await page.setViewportSize({ width: 1366, height: 768 });
+ await page.goto(urls.homeHref());
+ await rail(page).locator("[data-rail-section=jump]").click();
+ await expect(palette(page)).toBeVisible();
+ const box = await palette(page).boundingBox();
+ expect(box!.y + box!.height).toBeLessThanOrEqual(768);
+ // Places, tools and create actions first; the pieces arrive from the server.
+ await expect(palette(page).locator("[data-jump-item=inbox]")).toBeVisible();
+ await expect(palette(page).locator("[data-jump-item=new-article]")).toBeVisible();
+
+ await page.keyboard.press("ArrowDown");
+ await expect(palette(page).locator("[role=option]").nth(1)).toHaveAttribute("aria-selected", "true");
+ await page.keyboard.press("Escape");
+ await expect(palette(page)).toBeHidden();
+
+ await page.keyboard.press("Control+k");
+ await page.keyboard.type("zeta");
+ const zeta = palette(page).locator("[data-jump-item='a:articles/zeta']");
+ await expect(zeta).toBeVisible();
+ await expect(zeta).toHaveAttribute("aria-selected", "true");
+ await page.keyboard.press("Enter");
+ await expect(page).toHaveURL(/\/articles\/zeta$/);
+});
+
+test("a create action from the palette", async ({ page }) => {
+ await page.goto(urls.workHref());
+ await page.keyboard.press("Control+k");
+ await page.keyboard.type("new project");
+ await expect(palette(page).locator("[role=option][aria-selected=true]")).toHaveAttribute("data-jump-item", "new-project");
+ await page.keyboard.press("Enter");
+ await expect(page).toHaveURL(/\/projects\?new=1$/);
+ await expect(page.locator("[data-new-project-form]")).toBeVisible();
+});
+
test("a bench collapses the rail; its head still links home", async ({ page }) => {
await page.goto(urls.clipBenchHref("reports/report-fixture", "c01"));
await expect(page.locator("[data-app-header=bench]")).toBeVisible();
@@ -63,7 +131,7 @@ test("the theme choice is a cookie the server stamps on <html>, both ways", asyn
await control(page).getByRole("button", { name: "Light" }).click();
await expect(page.locator("html")).toHaveAttribute("data-theme", "light");
expect(await themeCookie()).toBe("light");
- let html = await (await page.request.get(urls.browseHref())).text();
+ let html = await (await page.request.get(urls.workHref())).text();
expect(html).toMatch(/<html[^>]*data-theme="light"/);
await page.reload();
await expect(page.locator("html")).toHaveAttribute("data-theme", "light");
@@ -87,18 +155,18 @@ test("the theme choice is a cookie the server stamps on <html>, both ways", asyn
await expect(page.locator("html")).not.toHaveAttribute("data-theme", /.+/);
const lightGround = await page.evaluate(() => getComputedStyle(document.documentElement).getPropertyValue("--ground").trim());
expect(lightGround).toBe("#f1efec");
- html = await (await page.request.get(urls.browseHref())).text();
+ html = await (await page.request.get(urls.workHref())).text();
expect(html).not.toMatch(/<html[^>]*data-theme=/);
});
test("j and k move the lit line, and focus goes with it", async ({ page }) => {
- await page.goto(urls.decisionsHref());
+ await page.goto(urls.homeHref());
const list = page.locator("[data-lit-list]").first();
await expect(list).toHaveAttribute("data-hydrated", "");
const lines = list.locator("[data-lit-line]");
expect(await lines.count()).toBeGreaterThan(2);
await expect(lines.nth(0)).toHaveAttribute("data-lit", "");
- // From anywhere on the page: the decision list is the page's one list.
+ // From anywhere on the page: the Inbox is the page's one list.
await page.locator("body").press("j");
await expect(lines.nth(1)).toHaveAttribute("data-lit", "");
await expect(lines.nth(0)).not.toHaveAttribute("data-lit", "");
@@ -119,7 +187,7 @@ test("j and k move the lit line, and focus goes with it", async ({ page }) => {
test("the head glides, and does not under reduced motion", async ({ page }) => {
const duration = () =>
page.locator("[data-lit-list] .lit-head").first().evaluate((el) => getComputedStyle(el).transitionDuration);
- await page.goto(urls.decisionsHref());
+ await page.goto(urls.homeHref());
await expect(page.locator("[data-lit-list] .lit-head[data-placed]").first()).toBeAttached();
expect(await duration()).toMatch(/^0\.12s/);
await page.emulateMedia({ reducedMotion: "reduce" });
diff --git a/umtool/e2e/work.spec.ts b/umtool/e2e/work.spec.ts
@@ -0,0 +1,108 @@
+import { test, expect, type APIRequestContext } from "@playwright/test";
+import * as urls from "./urls";
+import { warm, WARM_TIMEOUT } from "./warm";
+
+// ---------------------------------------------------------------------------
+// WORK (plans/umtool-redesign.md, P3): every piece in one lit list, faceted by
+// stage, kind, site and lifecycle (active by default), with a search -- and
+// the old /browse, /articles and /sites keys still filtering.
+//
+// WRITES the fixture's REPORTS_ROOT/.umtool/lifecycle.json (a project parked,
+// then active again).
+// ---------------------------------------------------------------------------
+
+type Piece = { id: string; kind: string; lifecycle: string; title: string };
+const pieces = async (request: APIRequestContext): Promise<Piece[]> =>
+ ((await (await request.get("/api/pieces")).json()) as { pieces: Piece[] }).pieces;
+const rows = "[data-lit-list] [data-lit-line][data-piece]";
+const ids = async (page: import("@playwright/test").Page) =>
+ page.locator(rows).evaluateAll((els) => els.map((e) => e.getAttribute("data-piece")));
+
+const REPORT = "p:reports/report-fixture";
+
+test.beforeAll(async ({ playwright }) => {
+ test.setTimeout(WARM_TIMEOUT);
+ await warm(playwright, ["/work", "/work?life=all", "/api/pieces"]);
+});
+
+test("every active piece, one lit line each, and the rail's count agrees", async ({ page, request }) => {
+ const active = (await pieces(request)).filter((p) => p.lifecycle === "active");
+ await page.goto(urls.workHref());
+ await expect(page.locator("[data-app-rail] [data-place=work]")).toHaveAttribute("aria-current", "page");
+ await expect(page.locator("[data-work-count]")).toHaveAttribute("data-work-count", String(active.length));
+ expect((await ids(page)).sort()).toEqual(active.map((p) => p.id).sort());
+ await expect(page.locator("[data-rail-count=work]")).toHaveText(String(active.length));
+ // Articles and projects alike, each with its stage on the bar.
+ await expect(page.locator(`${rows}[data-piece^='a:']`).first()).toBeVisible();
+ await expect(page.locator(`${rows}[data-piece^='p:']`).first()).toBeVisible();
+ const stage = await page.locator(rows).first().getAttribute("data-stage");
+ expect(["research", "article", "video", "deliver"]).toContain(stage);
+});
+
+test("the facets filter, compose, and count what they would show", async ({ page }) => {
+ await page.goto(urls.workHref());
+ const kind = page.locator("[data-facet=kind]").getByRole("link", { name: /^Article \d+$/ });
+ const n = Number((await kind.textContent())?.replace(/\D+/g, ""));
+ await kind.click();
+ await expect(page).toHaveURL(/kind=article/);
+ expect((await ids(page)).every((id) => id?.startsWith("a:"))).toBe(true);
+ await expect(page.locator(rows)).toHaveCount(n);
+
+ // A stage within it.
+ await page.locator("[data-facet=stage]").getByRole("link", { name: /^Research \d+$/ }).click();
+ await expect(page).toHaveURL(/stage=research/);
+ await expect(page).toHaveURL(/kind=article/);
+ for (const s of await page.locator(rows).evaluateAll((els) => els.map((e) => e.getAttribute("data-stage")))) expect(s).toBe("research");
+
+ // The search, under the facets it was typed with; `/` puts the cursor there.
+ await page.goto(urls.workHref());
+ await page.locator("body").press("/");
+ await expect(page.locator("[data-work-search]")).toBeFocused();
+ await page.keyboard.type("report-fixture");
+ await page.keyboard.press("Enter");
+ await expect(page).toHaveURL(/q=report-fixture/);
+ await expect(page.locator(`${rows}[data-piece='${REPORT}']`)).toBeVisible();
+});
+
+test("the old lists' keys land on the same set", async ({ page }) => {
+ // /browse?kind=<a project kind> → Work, and the kind is a facet chip.
+ await page.goto("/browse?kind=report-video");
+ await expect(page).toHaveURL(/\/work\?kind=report-video$/);
+ await expect(page.locator("[data-facet=kind] [aria-current=true]")).toHaveText(/^report video \d+$/);
+ await expect(page.locator(`${rows}[data-piece='${REPORT}']`)).toBeVisible();
+ // ...and /browse's state, a key with no chip group, is a chip you can take off.
+ await page.goto("/browse?state=draft");
+ await expect(page.locator("[data-extra=state]")).toHaveText(/state: draft/);
+ for (const id of await ids(page)) expect(id).toMatch(/^[ap]:/);
+ await page.locator("[data-extra=state]").click();
+ await expect(page).not.toHaveURL(/state=/);
+
+ // /sites?site=priv → Work by site, the site's page a link from the facet.
+ await page.goto("/sites?site=priv");
+ await expect(page).toHaveURL(/by=site/);
+ await expect(page.locator("[data-site=priv]")).toBeVisible();
+ await expect(page.locator("[data-site-page=priv]")).toHaveAttribute("href", urls.siteHref("priv"));
+});
+
+test("Park takes a piece out of the active list, Parked lists it, Reactivate brings it back", async ({ page, request }) => {
+ try {
+ await page.goto(urls.workHref());
+ const line = page.locator(`${rows}[data-piece='${REPORT}']`);
+ await expect(page.locator("[data-lit-list]").first()).toHaveAttribute("data-hydrated", "");
+ await line.click();
+ await line.locator("[data-lifecycle-to=parked]").click();
+ await expect(page.locator(`[data-undo='${REPORT}']`)).toContainText("Parked");
+ await expect(line).toHaveCount(0);
+
+ await page.locator("[data-facet=life]").getByRole("link", { name: /^Parked \d+$/ }).click();
+ await expect(page).toHaveURL(/life=parked/);
+ const parked = page.locator(`${rows}[data-piece='${REPORT}']`);
+ await expect(parked).toHaveAttribute("data-lifecycle", "parked");
+ await parked.click();
+ await parked.locator("[data-lifecycle-to=active]").click();
+ await expect(parked).toHaveCount(0);
+ expect((await pieces(request)).find((p) => p.id === REPORT)?.lifecycle).toBe("active");
+ } finally {
+ await request.post("/api/pieces/lifecycle", { data: { piece: REPORT, state: "active" } });
+ }
+});