mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-12-05 08:15:41 -08:00
- Implement's and Review's confirm panes carry a Loop checkbox in place of the dashboard's loop cards; loop end-screen buttons show a spinner. - The stacked Notes panel gets a drag handle. - Every skill prompt and the console contracts say to reply in US English. - The desktop app offers Update to latest when the skills are newer, and plan2code update refetches an app that install.json does not record. - Devin Balanced maps to Sonnet 5.5 Medium.
95 lines
4.8 KiB
JavaScript
95 lines
4.8 KiB
JavaScript
// Page tests for the page shell: what keeps the console page itself from
|
|
// scrolling (only its panels scroll), checked at wide and narrow window sizes.
|
|
// A change to src/web-console/public/styles/ or index.html needs only this
|
|
// file, not the whole page suites. Run with:
|
|
// npm run test:page -- scripts/test-web-console-page-layout.mjs
|
|
//
|
|
// Each test drives the real console in a real Chrome or Edge through
|
|
// scripts/page-test-helpers.mjs: one browser for the file, a fresh console
|
|
// session per test.
|
|
|
|
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { pageSuite, openSession } from "./page-test-helpers.mjs";
|
|
|
|
const suite = pageSuite(test);
|
|
|
|
// A plan session on the person's turn: one text question and the agent listening.
|
|
const PLAN_QUESTION = {
|
|
items: [{ id: "q1", kind: "text", title: "What to call it", body: "A short name for the export." }],
|
|
agent: { status: "waiting" },
|
|
};
|
|
|
|
test("the page itself never scrolls: oversized content stays inside its own panel", async (t) => {
|
|
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
|
await s.page.locator("#main [data-item=\"q1\"]").first().waitFor();
|
|
const page = await s.page.evaluate(() => {
|
|
const big = document.createElement("div");
|
|
big.style.cssText = "height: 5000px";
|
|
document.querySelector(".main").append(big);
|
|
const root = document.documentElement;
|
|
const before = { scrollHeight: root.scrollHeight, innerHeight: innerHeight };
|
|
scrollTo(0, 400);
|
|
return {
|
|
...before,
|
|
scrolled: scrollY,
|
|
rootOverflow: getComputedStyle(root).overflowY,
|
|
bodyOverflow: getComputedStyle(document.body).overflowY,
|
|
bodyHeight: Math.round(document.body.getBoundingClientRect().height),
|
|
};
|
|
});
|
|
assert.equal(page.rootOverflow, "hidden", "the page root never scrolls");
|
|
assert.equal(page.bodyOverflow, "hidden", "the body never scrolls");
|
|
assert.equal(page.bodyHeight, page.innerHeight, "the body is exactly the window tall");
|
|
assert.ok(page.scrollHeight <= page.innerHeight, "the page is never taller than the window (an absolutely placed bit in a panel stretched it)");
|
|
assert.equal(page.scrolled, 0, "the page does not move when asked to scroll");
|
|
});
|
|
|
|
test("the one-column layout (900px and narrower) keeps its page scroll", async (t) => {
|
|
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
|
await s.page.setViewportSize({ width: 600, height: 700 });
|
|
const narrow = await s.page.evaluate(() => getComputedStyle(document.documentElement).overflowY);
|
|
assert.equal(narrow, "visible", "its content sits under the first screen, so the lock must not apply");
|
|
});
|
|
|
|
test("a stacked Notes panel has a handle that drags its height, keeps it and resets on double-click", async (t) => {
|
|
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
|
await s.page.setViewportSize({ width: 1000, height: 700 });
|
|
await s.page.locator("#main [data-item=\"q1\"]").first().waitFor();
|
|
const grip = s.page.locator("#aside .aside-grip");
|
|
await grip.waitFor();
|
|
const asideHeight = async () => Math.round((await s.page.locator("#aside").boundingBox()).height);
|
|
const auto = await asideHeight();
|
|
|
|
const drag = async (dy) => {
|
|
const box = await grip.boundingBox();
|
|
const x = box.x + box.width / 2;
|
|
const y = box.y + box.height / 2;
|
|
await s.page.mouse.move(x, y);
|
|
await s.page.mouse.down();
|
|
await s.page.mouse.move(x, y + dy / 2, { steps: 4 });
|
|
await s.page.mouse.move(x, y + dy, { steps: 4 });
|
|
await s.page.mouse.up();
|
|
};
|
|
|
|
await drag(-120);
|
|
const taller = await asideHeight();
|
|
assert.ok(taller >= auto + 100, `dragging the handle up makes the panel taller (${auto} -> ${taller})`);
|
|
await s.page.waitForFunction((h) => Number(document.querySelector("#aside .aside-grip").getAttribute("aria-valuenow")) === h, taller);
|
|
await drag(60);
|
|
const shorter = await asideHeight();
|
|
assert.ok(shorter <= taller - 40 && shorter >= 96, `dragging it down makes the panel shorter (${taller} -> ${shorter})`);
|
|
|
|
// Kept with the saved looks, so the next session opens at this height.
|
|
const saved = async () => s.page.evaluate(async () => (await (await fetch("/looks")).json()).looks?.asideHeight);
|
|
await s.page.waitForFunction(async (h) => (await (await fetch("/looks")).json()).looks?.asideHeight === h, shorter);
|
|
assert.equal(await saved(), shorter, "the height is kept in the saved looks");
|
|
|
|
await grip.dblclick();
|
|
assert.equal(await asideHeight(), auto, "a double-click goes back to the automatic height");
|
|
assert.equal(await s.page.evaluate(() => document.documentElement.hasAttribute("data-aside-h")), false);
|
|
|
|
await s.page.setViewportSize({ width: 1400, height: 700 });
|
|
assert.equal(await grip.isVisible(), false, "side by side, the panel has no handle");
|
|
});
|