From ead9c0347ddf3d8a87468022c262a562fdf4ae61 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Mon, 16 Nov 2026 23:54:14 -0500 Subject: [PATCH] Tests: a link's curve starts with its underline; the busy forest opened by places, not titles other tests rename Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab --- e2e/forks.spec.ts | 5 +++-- e2e/panes4.spec.ts | 19 +++++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/e2e/forks.spec.ts b/e2e/forks.spec.ts index 6c327b0..7bbf0d6 100644 --- a/e2e/forks.spec.ts +++ b/e2e/forks.spec.ts @@ -294,10 +294,11 @@ test("a curve per open edge, from where each pane was opened to its title; it fo expect(p.y).toBeLessThan(r.y + r.height + slack); }; await nearIn(kinds.locator(".lnk", { hasText: "Eukaryotes" }), edge("Two kinds of cell", "Eukaryote")[0].a); - // From words, the curve starts at the right end of their underline (a short step joins it to the lead-out in the gap below). + // From words, the curve starts with their underline (it draws it, from their left), then a short step down to the lead-out in the gap below. const link = (await kinds.locator(".lnk", { hasText: "Eukaryotes" }).first().boundingBox())!; const start = edge("Two kinds of cell", "Eukaryote")[0].a; - expect(Math.abs(start.x - (link.x + link.width))).toBeLessThan(2); + // (It starts with the link's underline, which it draws, from the link's left.) + expect(Math.abs(start.x - link.x)).toBeLessThan(2); expect(start.y).toBeGreaterThan(link.y + link.height - 9); expect(start.y).toBeLessThan(link.y + link.height); await nearIn(kinds.locator(".node.forked > .row", { hasText: "Simple cells" }), edge("Two kinds of cell", "Simple cells")[0].a); diff --git a/e2e/panes4.spec.ts b/e2e/panes4.spec.ts index 997104e..9b14663 100644 --- a/e2e/panes4.spec.ts +++ b/e2e/panes4.spec.ts @@ -22,9 +22,19 @@ async function still(page: Page) { await frames(page); } async function open(page: Page, inPane: string | RegExp, text: string | RegExp, sel = ".row") { - await pane(page, inPane).locator(sel, { hasText: text }).first().dispatchEvent("click"); + // A row by its exact title (the shared library has documents whose titles start the same). + const it = sel === ".row" && typeof text === "string" ? pane(page, inPane).locator(".row", { has: page.locator(`.title:text-is("${text}")`) }) : pane(page, inPane).locator(sel, { hasText: text }); + await it.first().dispatchEvent("click"); await still(page); } +/** Open the nth row of a pane's own outline; returns its title. */ +async function openNth(page: Page, inPane: string, n: number): Promise { + const row = pane(page, inPane).locator(":scope > .pane-scroll > .pane-body > .outline > li > .row").nth(n); + const title = (await row.locator(".title").first().textContent())!.trim(); + await row.dispatchEvent("click"); + await still(page); + return title; +} async function library(page: Page) { await autoLayout(page); await page.goto("/"); @@ -42,9 +52,10 @@ async function forest(page: Page) { await open(page, "Expansion by depth", "Levels of a node"); await open(page, "Expansion by depth", "Generation on demand"); await open(page, "Library", "The tides"); - await open(page, "The tides", "The force"); - await open(page, "The force", "Why two bulges"); - await open(page, "The force", "Why the Moon beats the Sun"); + // (By their places, not their titles: other tests rename sections of the shared library.) + const sec = await openNth(page, "The tides", 1); + await openNth(page, sec, 0); + await openNth(page, sec, 1); await pane(page, "Generation on demand").locator(".pane-head h2").dispatchEvent("click"); await still(page); }