Browser tests: nodes instead of documents; addresses by node id; /linkhere and /linkall

menu.spec.ts becomes nodes.spec.ts: standing on the library root, /n/<id> addresses through a
reload, Back and Forward (and an old /doc/ address), the jump box, a file imported into a node two
levels down with a link relative to its top, exported back the same and copied just after itself,
Move under… by key and by the menu (never under itself; the root offered first), history's f and r
on the node the reader is on, the offline round trip, the node routes over HTTP, and panes and
phone width.

The other specs open a tree by its titles (helpers openAt, openPage, visit: /n/<id>, hoisted in the
column as /doc/ was), make top-level sections from the library page instead of /new, scan with
/linkhere (and check its scope against /linkall's), and expect a section's head on every pane but
the first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
thalladaandClaude Opus 5.5 committed 2026-11-17 01:49:22 -05:00
1 parent bed47c0c7a
commit c4d6856649
17 files changed
+584 -490

No files matched your search

+14 -9
View File
@@ -1,11 +1,9 @@
/** The mouse, narrow screens, hover previews, hoisting, speculation, orphans, and an outside agent over HTTP. */
import { expect, test, type Page } from "@playwright/test";
import { idle, jump, keys, settle, state } from "./helpers";
import { idle, jump, keys, openPage, settle, state } from "./helpers";
async function open(page: Page) {
await page.goto("/doc/infinispand");
await page.waitForSelector("article");
}
/** The first tree as the page (hoisted), with the library one step out. */
const open = (page: Page) => openPage(page, "Infinispand");
test.afterEach(({ page }) => settle(page));
@@ -60,20 +58,27 @@ test("on a narrow screen a margin note falls into the column", async ({ page })
expect(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(true);
});
test("hoisting makes one node the whole page; Esc steps out to its document, and from its top to the library", async ({ page }) => {
test("hoisting makes one node the whole page; Esc at its top steps out to its parent's page, and on up to the library", async ({ page }) => {
await open(page);
await jump(page, "Semantic conflicts");
await page.keyboard.press("z");
await expect(page.locator("h1")).toHaveText("Semantic conflicts");
await expect(page.locator(".crumbs")).toContainText("Versioning and merge");
await expect(page.locator(".crumbs")).toHaveText(/^Library › Infinispand › Versioning and merge ›/);
await expect(page.locator("article > .outline > .node")).toHaveCount(3);
await page.keyboard.press("Escape");
await expect(page.locator("h1")).toHaveText("Infinispand");
// The focus stays on the section it stepped out of, now a row; from the document's own top, out again.
await expect(page.locator("h1")).toHaveText("Versioning and merge");
// The focus stays on the section it stepped out of, now a row; from each page's own top, out again.
expect(await state(page, (s) => s.snap.nodes[s.focus.node].title)).toBe("Semantic conflicts");
await page.keyboard.press("O"); // collapse everything: the focus goes to the top
await page.keyboard.press("Escape");
await expect(page.locator("h1")).toHaveText("Infinispand");
await page.keyboard.press("O");
await page.keyboard.press("Escape");
await expect(page.locator("h1")).toHaveText("Library");
expect(await state(page, (s) => s.snap.nodes[s.focus.node].title)).toBe("Infinispand");
await expect(page).toHaveURL(/\/n\/[^/]+$/);
// On the root itself, the address is the library's.
await page.keyboard.press("O");
await expect(page).toHaveURL(/\/$/);
});