commit f479d89dbad138988a75176cb5f756e6ce449814
parent d38e974bebb30a0ef9046c445c2d764def9db8ff
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 13 Oct 2026 16:55:53 -0400
umtool e2e: article-delete writes its draft itself (articles.spec counts the store's rows) and ends by deleting it whole
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
3 files changed, 42 insertions(+), 13 deletions(-)
diff --git a/umtool/e2e/article-delete.spec.ts b/umtool/e2e/article-delete.spec.ts
@@ -1,8 +1,9 @@
import { test, expect, type Page } from "@playwright/test";
-import { existsSync } from "node:fs";
+import { existsSync, rmSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { WARM_TIMEOUT, warm } from "./warm";
+import { makeOmega } from "./fixtures/delete-fixture.mjs";
// ---------------------------------------------------------------------------
// Deleting (release 27 follow-up): every delete shows its PLAN — what goes,
@@ -10,8 +11,10 @@ import { WARM_TIMEOUT, warm } from "./warm";
// The fixture's own (e2e/fixtures/delete-fixture.mjs), so no other spec's
// article or project is touched:
//
-// omega a draft: i1 (a parent), i2 (the current article),
-// i3 (a copy of i1, with a project) — i3 goes
+// omega a draft, written here (articles.spec.ts counts the
+// store's rows): i1 (a parent), i2 (the current
+// article), i3 (a copy of i1, with a project) — i3
+// goes, then the whole article
// psi an article in the making — it goes
// reports/delete-fixture a project with takes keep (the project's own
// manifest: refused) and drop — drop goes, then the
@@ -24,8 +27,15 @@ const ARTICLES = path.join(FIXTURE, "articles");
const PROJECTS = path.join(FIXTURE, "gen-projects");
const PROJECT = path.join(FIXTURE, "reports", "delete-fixture");
+const dropOmega = () => {
+ rmSync(path.join(ARTICLES, "omega"), { recursive: true, force: true });
+ rmSync(path.join(PROJECTS, "omega"), { recursive: true, force: true });
+};
+
test.beforeAll(async ({ playwright }) => {
test.setTimeout(WARM_TIMEOUT);
+ dropOmega();
+ makeOmega({ articles: ARTICLES, projects: PROJECTS });
await warm(playwright, [
"/articles/omega?tab=iterations",
"/articles/psi",
@@ -36,9 +46,11 @@ test.beforeAll(async ({ playwright }) => {
]);
});
+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", async ({ page }) => {
+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 expect(page.getByRole("region", { name: "iterations", exact: true })).toHaveAttribute("data-iterations", "3");
@@ -75,6 +87,17 @@ test("an iteration: the current one and a parent are refused with the reason; a
expect(existsSync(path.join(PROJECTS, "omega", "i3"))).toBe(false);
expect(existsSync(path.join(PROJECTS, "omega", "i1", "video.manifest.json"))).toBe(true);
expect(existsSync(path.join(ARTICLES, "omega", "report.json"))).toBe(true);
+
+ // Then the draft itself: its directory, its iterations and their projects.
+ 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/");
+ await expect(all.getByRole("list", { name: "what goes" })).toContainText("gen-projects/omega/i1/");
+ await all.getByRole("button", { name: "Confirm delete" }).click();
+ await expect(page).toHaveURL(/\/articles\?deleted=omega/);
+ await expect(page.locator("[data-article='articles/omega']")).toHaveCount(0);
+ expect(existsSync(path.join(ARTICLES, "omega"))).toBe(false);
+ expect(existsSync(path.join(PROJECTS, "omega")), "the emptied projects folder goes too").toBe(false);
});
test("an article in the making is deleted from its page, and /articles says so", async ({ page }) => {
diff --git a/umtool/e2e/fixtures/delete-fixture.mjs b/umtool/e2e/fixtures/delete-fixture.mjs
@@ -1,7 +1,8 @@
// What article-delete.spec.ts deletes (release 27 follow-up): its own, so the
// other specs' fixtures (zeta, the report projects) are never touched.
//
-// articles/omega/ a DRAFT article (report.json) with iterations:
+// articles/omega/ (makeOmega, written by the spec) a DRAFT
+// article (report.json) with iterations:
// iterations/1 sweep, done; project gen-projects/omega/i1
// iterations/2 revise-report of i1, done: the CURRENT article
// iterations/3 a copy of i1, done; project gen-projects/omega/i3
@@ -61,11 +62,11 @@ const videoManifest = (title) => ({
],
});
-export function makeDeleteFixture({ dest, articles, reports }) {
- const projects = path.join(dest, "gen-projects");
+// omega: a draft with three iterations, i2 current — written by the spec
+// itself (beforeAll) and removed after, because a draft is a row of /articles
+// and articles.spec.ts counts the store's rows.
+export function makeOmega({ articles, projects }) {
const its = (id, n) => path.join(articles, id, "iterations", String(n));
-
- // omega: a draft with three iterations, i2 current.
put(path.join(articles, "omega", "report.json"), report("omega", "Omega: the vote, revised"));
put(path.join(its("omega", 1), "iteration.json"), iteration("omega", 1, { kind: "sweep", projectDir: path.join(projects, "omega", "i1") }));
put(path.join(its("omega", 1), "report.json"), report("omega", "Omega: the vote"));
@@ -78,8 +79,12 @@ export function makeDeleteFixture({ dest, articles, reports }) {
put(path.join(projects, "omega", `i${n}`, "video.manifest.json"), videoManifest(`Omega i${n}`));
put(path.join(projects, "omega", `i${n}`, "out", "omega.mp4"), "not really a video\n");
}
+}
+
+export function makeDeleteFixture({ dest, articles, reports }) {
+ const its = (id, n) => path.join(articles, id, "iterations", String(n));
- // psi: in the making.
+ // psi: in the making (not a row of /articles: listed "in the making").
put(path.join(its("psi", 1), "iteration.json"), iteration("psi", 1, { kind: "sweep" }));
put(path.join(its("psi", 1), "report.json"), report("psi", "Psi: a first look"));
@@ -96,5 +101,5 @@ export function makeDeleteFixture({ dest, articles, reports }) {
put(path.join(project, "takes", id, "preview.mp4"), "not really a video\n");
put(path.join(project, "takes", id, "video.manifest.json"), manifest);
}
- return { projects, project };
+ return { project };
}
diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs
@@ -1911,8 +1911,9 @@ writeProject("timeline-fixture", {
const { sites: SITES, articles: ARTICLES } = makeSitesFixture({ dest, reports, channels: CHANNELS });
// Release 27: an article in the making (zeta), its projects, today's usage.
makeIterationsFixture({ dest, articles: ARTICLES });
-// The release 27 follow-up's deletes: omega (a draft with iterations), psi (in
-// the making), reports/delete-fixture (a project with two takes).
+// The release 27 follow-up's deletes: psi (in the making) and
+// reports/delete-fixture (a project with two takes); article-delete.spec.ts
+// writes its draft (omega) itself.
makeDeleteFixture({ dest, articles: ARTICLES, reports });
console.log(`fixture at ${dest}`);