mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-12-06 00:15:42 -08:00
Make the frame page test Notebook tab through the server route, which keys folders as macOS does
AI Assisted
This commit is contained in:
1 parent
beca6e62da
commit
fcce530fa4
1 file changed
+9
-2
@@ -12,7 +12,6 @@ import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { pageSuite, openSession, drawn } from "./page-test-helpers.mjs";
|
||||
import { until, HOME } from "./web-console-test-helpers.mjs";
|
||||
import { createTab, listTabs } from "../src/web-console/notepads.mjs";
|
||||
|
||||
const suite = pageSuite(test);
|
||||
|
||||
@@ -34,7 +33,6 @@ test("under the frame's prefix, with no cookie, the dashboard draws, its stream
|
||||
t.after(() => fs.rmSync(LOOKS_FILE, { force: true }));
|
||||
const browser = await suite.browser();
|
||||
const s = await openSession(browser, { t, workflow: "dashboard", env: FRAME_ENV });
|
||||
if (!listTabs(s.project).tabs.length) createTab(s.project, "Notes");
|
||||
|
||||
const signIn = new URL(s.url);
|
||||
const token = /^\/s\/([^/]+)\/$/.exec(signIn.pathname)[1];
|
||||
@@ -65,6 +63,15 @@ test("under the frame's prefix, with no cookie, the dashboard draws, its stream
|
||||
const res = await page.goto(signIn.origin + prefix, { waitUntil: "domcontentloaded" });
|
||||
assert.equal(res.status(), 200, "the page itself, under the prefix");
|
||||
await drawn(page);
|
||||
// A Notebook tab to open, made through the server's own route from the page:
|
||||
// the server here believes it runs on macOS, where a folder's notepad key is
|
||||
// lowercased (foldKey), so a tab this test process made on Linux would sit
|
||||
// under another key and the Notebook would open empty and read-only.
|
||||
const made = await page.evaluate(async () => {
|
||||
const res = await fetch("notepad/tab", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ name: "Notes" }) });
|
||||
return res.status;
|
||||
});
|
||||
assert.equal(made, 200, "a Notebook tab, made under the prefix");
|
||||
// Past Planny's wake-up, to the menu.
|
||||
const skip = page.getByRole("button", { name: "Skip the intro" });
|
||||
await skip.click();
|
||||
|
||||
Reference in new issue
Block a user