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:
1 parent
bed47c0c7a
commit
c4d6856649
17 files changed
+584
-490
No files matched your search
+7
-7
@@ -6,13 +6,13 @@
|
||||
* other spec uses, and undo what they write.
|
||||
*/
|
||||
import { expect, test, type Locator, type Page } from "@playwright/test";
|
||||
import { autoLayout, command, idle, keys, settle, state } from "./helpers";
|
||||
import { autoLayout, command, idle, keys, settle, state, visit } from "./helpers";
|
||||
|
||||
const DOC = "/doc/tuning-and-temperament";
|
||||
const DOC = "Tuning and temperament";
|
||||
const FIRST = "Two notes sound smooth together when their frequencies stand in a simple ratio such as 2 to 1 or 3 to 2.";
|
||||
|
||||
async function open(page: Page, path = DOC) {
|
||||
await page.goto(path);
|
||||
await visit(page, path);
|
||||
await page.waitForSelector("article .outline, .strip .pane");
|
||||
await page.evaluate(() => document.fonts.ready);
|
||||
}
|
||||
@@ -236,13 +236,13 @@ test("the menu's keys: ↑ ↓ Home End move, Enter runs, Esc closes and gives t
|
||||
await expect(menu(page)).toBeVisible();
|
||||
const focused = () => page.evaluate(() => document.activeElement?.querySelector(".lbl")?.textContent ?? document.activeElement?.textContent);
|
||||
await keys(page, "ArrowDown");
|
||||
expect(await focused()).toBe("Documents…");
|
||||
await keys(page, "ArrowDown");
|
||||
expect(await focused()).toBe("Jump to a section…");
|
||||
await keys(page, "ArrowDown");
|
||||
expect(await focused()).toBe("History and branches");
|
||||
await keys(page, "ArrowUp ArrowUp");
|
||||
expect(await focused()).toBe("Keys and help");
|
||||
await keys(page, "Home");
|
||||
expect(await focused()).toBe("Documents…");
|
||||
expect(await focused()).toBe("Jump to a section…");
|
||||
await keys(page, "End Enter");
|
||||
await expect(menu(page)).toHaveCount(0);
|
||||
await expect(page.locator(".help")).toBeVisible();
|
||||
@@ -439,6 +439,6 @@ test.describe("on a phone", () => {
|
||||
// The top bar's menu, a sheet too.
|
||||
await page.locator(".docbar .tool[aria-haspopup]").tap();
|
||||
await expect(page.locator(".menu.sheet")).toBeVisible();
|
||||
await expect(item(page, "Documents…")).toHaveCount(1);
|
||||
await expect(item(page, "Jump to a section…")).toHaveCount(1);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user