Teach the web console to read right inside the desktop app

AI Assisted
This commit is contained in:
jparkerweb committed 2026-10-25 12:46:52 -07:00
1 parent 72043e20fc
commit c1f41e4a82
25 files changed
+951 -85

No files matched your search

+4 -2
View File
@@ -46,10 +46,10 @@ export function tempProject(files = {}) {
// test still cleans up, and a page error fails the test. `clock: true` gives
// the page Playwright's fake clock before it loads (s.page.clock), so a test
// can jump past the page's silence limits instead of sitting through them.
export async function openSession(browser, { t, workflow, payload: first, project, open = [], clock = false }) {
export async function openSession(browser, { t, workflow, payload: first, project, open = [], clock = false, env, init } = {}) {
fs.rmSync(REMEMBERED, { force: true });
const cwd = project || tempProject();
const opened = cli(["open", "--workflow", workflow, "--no-open", ...open], { cwd }).json;
const opened = cli(["open", "--workflow", workflow, "--no-open", ...open], { cwd, env }).json;
const s = {
sid: opened.sid,
session: opened.session,
@@ -95,6 +95,8 @@ export async function openSession(browser, { t, workflow, payload: first, projec
if (first) s.post(first);
s.context = await browser.newContext({ viewport: { width: 1280, height: 800 } });
if (clock) await s.context.clock.install();
// A script run before the page's own, such as a stand-in for the app's frame.
if (init) await s.context.addInitScript(init);
s.page = await s.context.newPage();
// Playwright's own default (30s) assumes a dedicated machine: the whole
// suite runs dozens of these pages at once, and a host under that load can
+49 -2
View File
@@ -257,9 +257,9 @@ function handoffProject(t) {
return { project, made };
}
async function openHandoffMenu(t) {
async function openHandoffMenu(t, env) {
const { project, made } = handoffProject(t);
const s = await openSession(await suite.browser(), { t, workflow: "dashboard", payload: MENU, project });
const s = await openSession(await suite.browser(), { t, workflow: "dashboard", payload: MENU, project, env });
const main = await toTheMenu(s);
const chip = chipFor(main, "Lunch vote");
await chip.waitFor();
@@ -320,6 +320,20 @@ test("Read it all opens the handoff's text, and Copy puts a prompt naming its fi
assert.ok(text.includes(made.id), `the prompt names the handoff's file: ${text}`);
});
// Under the app, "a new conversation" is this console's own wording for what
// New Session does, so the handoff's copy button says "another session"
// instead, still naming the same clipboard prompt.
test("under the app, a handoff's copy button says Copy for another session, and still works", async (t) => {
const { s, main, chip } = await openHandoffMenu(t, { PLAN2CODE_IN_APP: "1" });
await s.context.grantPermissions(["clipboard-read", "clipboard-write"], { origin: new URL(s.url).origin });
await chip.click();
assert.equal(await main.getByRole("button", { name: "Copy for a new conversation" }).count(), 0, "no classic-mode wording under the app");
const copy = main.getByRole("button", { name: "Copy for another session" });
await copy.click();
await main.getByRole("button", { name: "Copied" }).waitFor();
await copy.waitFor();
});
// What a person would see break: Delete asks for a name, or sends a spec
// delete instead of the handoff's.
test("a handoff's Delete asks once in its own dialog and sends a delete naming the handoff", async (t) => {
@@ -366,6 +380,39 @@ test("the update banner shows on the dashboard only, and its dismiss hides it",
await banner.waitFor({ state: "hidden" });
});
// Under the desktop app (PLAN2CODE_IN_APP=1) the app's own top bar already
// nags about a skills/app mismatch and updates in one click, so this banner
// (a copy-pasted shell command) must never show there, newer release or not.
test("under the app, the update banner never shows", async (t) => {
aNewerReleaseExists(t);
const dash = await openSession(await suite.browser(), {
t,
workflow: "dashboard",
payload: MENU,
project: tempProject(DRAFT_PROJECT),
env: { PLAN2CODE_IN_APP: "1" },
});
const main = await toTheMenu(dash);
await main.getByText("One spec on disk, with a plan drafted.").waitFor();
assert.equal(await main.getByText("UPDATE AVAILABLE").count(), 0, "no banner under the app");
});
// Same reasoning for the dashboard's own red-meter banner: under the app it
// must point at New Session, never at starting a new console session.
test("under the app, the dashboard's red-meter banner points at New Session", async (t) => {
const dash = await openSession(await suite.browser(), {
t,
workflow: "dashboard",
payload: MENU,
project: tempProject(DRAFT_PROJECT),
env: { PLAN2CODE_IN_APP: "1" },
});
const main = await toTheMenu(dash);
dash.post({ run: { event: "implement-phase", id: "phase-1", tasks: 30 } });
await main.getByText("Press New Session at the top of the window to start the agent fresh.").waitFor();
assert.equal(await main.getByText("Starting a new console session").count(), 0, "no classic-mode wording under the app");
});
// What a person would see break: two dashboard tabs of one session, on
// different picks, keep taking the workspace's folders back from each other.
test("two dashboard tabs on different picks leave the workspace scope with the last pick and ask for it no more", async (t) => {
+258 -1
View File
@@ -12,9 +12,17 @@ import path from "node:path";
import test from "node:test";
import assert from "node:assert/strict";
import { pageSuite, openSession, tempProject, textOf, drawn } from "./page-test-helpers.mjs";
import { HOME } from "./web-console-test-helpers.mjs";
import { HOME, cli, until } from "./web-console-test-helpers.mjs";
import { HELP_TABS } from "../src/web-console/public/help.js";
import { CATALOG_GROUPS, SKILL_CATALOG } from "../src/web-console/public/answers.js";
import { GONE_AFTER_MS } from "../src/web-console/public/screens/core.js";
// The agent's side of `stop`, leaving the browser context open (s.stop()
// closes it, which would hide what the page does next).
async function stopServer(s) {
cli(["stop", "--session", s.sid], { cwd: s.project });
assert.ok(await until(async () => !(await s.answers()), 5000), "the server still answers after stop");
}
const suite = pageSuite(test);
@@ -290,3 +298,252 @@ test("the update banner opens a modal with the exact update commands, and its di
await toTheDashboard(s);
assert.equal(await main.getByRole("button", { name: /UPDATE AVAILABLE/ }).count(), 0, "the banner came back after a reload");
});
// Under the app the dashboard's own UPDATE AVAILABLE banner never shows (a
// separate test already covers that), so Help's own line about it must not
// send an in-app reader to a terminal command for a banner they can never see.
test("under the app, Help's update line points at Update skills, not the dashboard banner's terminal command", async (t) => {
savedLooks(t, { welcomeSeen: true });
const s = await openSession(await suite.browser(), {
t,
workflow: "dashboard",
payload: { agent: { status: "waiting" } },
project: tempProject(),
env: { PLAN2CODE_IN_APP: "1" },
});
await toTheDashboard(s);
await openHelp(s);
await tabButton(s, "dashboard").click();
const text = s.page.locator("#help-update-text");
await text.getByText("Update skills", { exact: false }).waitFor();
assert.equal(await text.locator("code").count(), 0, "no terminal command under the app");
assert.equal(await text.getByText("UPDATE AVAILABLE", { exact: false }).count(), 0, "no mention of a banner that never shows there");
});
// Under the app, when the console server itself is gone, the live "About"
// line must not send the reader hunting for a link in a terminal: the app's
// own bar already notices and offers to reconnect it.
test("under the app, Help's live line about a gone console names the app's bar, not a terminal link", async (t) => {
savedLooks(t, { welcomeSeen: true });
const s = await openSession(await suite.browser(), {
t,
workflow: "plan",
payload: { items: [{ id: "q1", kind: "text", title: "What to call it", body: "A short name." }], agent: { status: "waiting" } },
env: { PLAN2CODE_IN_APP: "1" },
clock: true,
});
await stopServer(s);
for (let i = 0; i < 20 && !(await s.page.locator("#planny.is-gone").count()); i++) {
await s.page.clock.fastForward(GONE_AFTER_MS);
await new Promise((r) => setTimeout(r, 250));
}
await openHelp(s);
// Help opens on "stuck" while gone (helpTabFor); the live line itself lives
// on "about", built the same regardless of which tab is first shown.
await tabButton(s, "about").click();
const live = s.page.locator("#about-live");
await live.getByText("The app's own bar notices and offers to reconnect it", { exact: false }).waitFor();
assert.equal(await live.getByText("link from the terminal", { exact: false }).count(), 0, "no terminal-link wording under the app");
});
// Help's own "Running the next command" explainer (the Finishing topic) said
// "paste into the terminal... in a new conversation": wrong under the app,
// where it's the one terminal panel, not a separate conversation.
test("under the app, Help's Finishing topic says to paste into the terminal panel, not a new conversation", async (t) => {
savedLooks(t, { welcomeSeen: true });
const s = await openSession(await suite.browser(), {
t,
workflow: "plan",
payload: { items: [{ id: "q1", kind: "text", title: "What to call it", body: "A short name." }], agent: { status: "waiting" } },
project: tempProject(),
env: { PLAN2CODE_IN_APP: "1" },
});
await openHelp(s);
await tabButton(s, "finishing").click();
const text = s.page.locator("#help-finishing-command-text");
await text.getByText("terminal panel below", { exact: false }).waitFor();
assert.equal(await text.getByText("new conversation", { exact: false }).count(), 0, "no classic-mode wording under the app");
});
// The same topic's "Back to the dashboard" and "Continue here" explainers
// also described classic-only behavior the screens themselves no longer show
// under the app: a command to copy, and a new conversation to start fresh in.
test("under the app, Help's dashboard and Continue here explainers point at the app's own controls", async (t) => {
savedLooks(t, { welcomeSeen: true });
const s = await openSession(await suite.browser(), {
t,
workflow: "plan",
payload: { items: [{ id: "q1", kind: "text", title: "What to call it", body: "A short name." }], agent: { status: "waiting" } },
project: tempProject(),
env: { PLAN2CODE_IN_APP: "1" },
});
await openHelp(s);
await tabButton(s, "finishing").click();
const dash = s.page.locator("#help-finishing-dashboard-text");
await dash.getByText("the app's own bar notices and offers to reconnect it", { exact: false }).waitFor();
assert.equal(await dash.locator("code").count(), 0, "no /plan2code command under the app");
const cont = s.page.locator("#help-finishing-continue-text");
await cont.getByText("press New Session at the top of the window", { exact: false }).waitFor();
assert.equal(await cont.getByText("new conversation", { exact: false }).count(), 0, "no classic-mode wording under the app");
});
// The Welcome dialog's own onboarding tip gave the same classic-only advice.
test("under the app, the Welcome dialog's refresh tip names New Session, not a new conversation", async (t) => {
savedLooks(t, null);
const s = await openSession(await suite.browser(), {
t,
workflow: "dashboard",
payload: { agent: { status: "waiting" } },
project: tempProject(),
env: { PLAN2CODE_IN_APP: "1" },
});
await toTheDashboard(s);
const welcome = s.page.locator("#welcome-modal");
await welcome.waitFor();
const text = s.page.locator("#welcome-refresh-text");
await text.getByText("press New Session at the top of the window", { exact: false }).waitFor();
assert.equal(await text.getByText("new conversation", { exact: false }).count(), 0, "no classic-mode wording under the app");
});
// The Troubleshooting tab's own "getting a new link" recovery flow is
// classic-only (it ends in a command that prints a fresh browser link);
// under the app, Reconnect the console in the bar already does this.
test("under the app, Help's Troubleshooting topic names Reconnect the console, not a new link to print", async (t) => {
savedLooks(t, { welcomeSeen: true });
const s = await openSession(await suite.browser(), {
t,
workflow: "plan",
payload: { items: [{ id: "q1", kind: "text", title: "What to call it", body: "A short name." }], agent: { status: "waiting" } },
project: tempProject(),
env: { PLAN2CODE_IN_APP: "1" },
});
await openHelp(s);
await tabButton(s, "stuck").click();
const ref = s.page.locator("#help-stuck-not-connected-ref");
await ref.getByText("the app's own bar notices and offers to reconnect it", { exact: false }).waitFor();
await s.page.locator("#help-stuck-reconnect-title").getByText("Reconnecting").waitFor();
const text = s.page.locator("#help-stuck-reconnect-text");
await text.getByText("Reconnect the console", { exact: false }).waitFor();
assert.equal(await text.getByText("in the terminal", { exact: false }).count(), 0, "no classic-mode wording under the app");
assert.equal(await s.page.locator("#help-stuck-reconnect-command").isVisible(), false, "no command to copy under the app");
// The "What you might see" symptom table has its own, separate "Not
// connected" row making the same classic-only claim.
const tableRow = s.page.locator("#help-stuck-table-reconnect-text");
await tableRow.getByText("Reconnect the console", { exact: false }).waitFor();
assert.equal(await tableRow.getByText("new link", { exact: false }).count(), 0, "no classic-mode wording under the app");
});
// The Ask tab's "carry away" prompt is meant to start a genuinely fresh task:
// under the app that means New Session first, then the terminal panel, not
// "a new conversation" that does not exist there.
test("under the app, Help's Ask topic says to press New Session and paste into the terminal panel, not a new conversation", async (t) => {
savedLooks(t, { welcomeSeen: true });
const s = await openSession(await suite.browser(), {
t,
workflow: "plan",
payload: { items: [{ id: "q1", kind: "text", title: "What to call it", body: "A short name." }], agent: { status: "waiting" } },
project: tempProject(),
env: { PLAN2CODE_IN_APP: "1" },
});
await openHelp(s);
await tabButton(s, "ask").click();
const text = s.page.locator("#help-ask-prompt-text");
await text.getByText("Press New Session for a clean context, then paste it into the terminal panel", { exact: false }).waitFor();
assert.equal(await text.getByText("new conversation", { exact: false }).count(), 0, "no classic-mode wording under the app");
});
// "Stopping early" also pointed to a terminal command "in a new conversation":
// matches ending.js's own renderStopping, which already says the terminal panel.
test("under the app, Help's Stopping early topic says to paste into the terminal panel, not a new conversation", async (t) => {
savedLooks(t, { welcomeSeen: true });
const s = await openSession(await suite.browser(), {
t,
workflow: "plan",
payload: { items: [{ id: "q1", kind: "text", title: "What to call it", body: "A short name." }], agent: { status: "waiting" } },
project: tempProject(),
env: { PLAN2CODE_IN_APP: "1" },
});
await openHelp(s);
await tabButton(s, "finishing").click();
const text = s.page.locator("#help-finishing-stop-text");
await text.getByText("to paste into the terminal panel", { exact: false }).waitFor();
assert.equal(await text.getByText("new conversation", { exact: false }).count(), 0, "no classic-mode wording under the app");
});
// The Planny-poses catalog's own "Done" entry also said "close the tab":
// there is no tab under the app, only the one window.
test("under the app, Planny's Done pose says to close the window, not the tab", async (t) => {
savedLooks(t, { welcomeSeen: true });
const s = await openSession(await suite.browser(), {
t,
workflow: "plan",
payload: { items: [{ id: "q1", kind: "text", title: "What to call it", body: "A short name." }], agent: { status: "waiting" } },
project: tempProject(),
env: { PLAN2CODE_IN_APP: "1" },
});
await openHelp(s);
await tabButton(s, "planny").click();
const text = s.page.locator("#help-planny-done-text");
await text.getByText("close the window", { exact: false }).waitFor();
assert.equal(await text.getByText("close the tab", { exact: false }).count(), 0, "no classic-mode wording under the app");
});
// Help's own description of the handoff Copy button named "a new conversation",
// the console's own wording for what New Session does under the app.
test("under the app, Help's dashboard topic calls the handoff copy button Copy for another session", async (t) => {
savedLooks(t, { welcomeSeen: true });
const s = await openSession(await suite.browser(), {
t,
workflow: "dashboard",
payload: { agent: { status: "waiting" } },
project: tempProject(),
env: { PLAN2CODE_IN_APP: "1" },
});
await toTheDashboard(s);
await openHelp(s);
await tabButton(s, "dashboard").click();
const text = s.page.locator("#help-handoff-copy-text");
await text.getByText("Copy for another session", { exact: false }).waitFor();
assert.equal(await text.getByText("Copy for a new conversation", { exact: false }).count(), 0, "no classic-mode wording under the app");
});
// Every Help topic, as the reader sees it in each mode: the visible text of
// each panel in turn. A browser tab's wording never shows under the app, and
// the app's never shows in a browser, wherever in Help it sits.
async function visibleHelpText(s) {
await openHelp(s);
const texts = {};
for (const t of HELP_TABS) {
await tabButton(s, t.id).click();
texts[t.id] = await s.page.locator("#help-panel-" + t.id).innerText();
}
return texts;
}
const BROWSER_ONLY = [/browser tab/i, /this tab\b/i, /close the tab/i, /closed tab/i, /in your browser/i, /your terminal/i, /in a new conversation/i, /new link/i, /same link/i, /address bar/i, /terminal you started/i];
const APP_ONLY = [/terminal panel/i, /app's window/i, /app's own bar/i, /New Session/];
for (const inApp of [true, false]) {
test(`every Help topic reads right ${inApp ? "under the app" : "in a browser"}`, async (t) => {
savedLooks(t, { welcomeSeen: true });
const s = await openSession(await suite.browser(), {
t,
workflow: "plan",
payload: { items: [{ id: "q1", kind: "text", title: "What to call it", body: "A short name." }], agent: { status: "waiting" } },
project: tempProject(),
...(inApp ? { env: { PLAN2CODE_IN_APP: "1" } } : {}),
});
const texts = await visibleHelpText(s);
const hits = [];
for (const [tab, text] of Object.entries(texts)) {
for (const re of inApp ? BROWSER_ONLY : APP_ONLY) {
const hit = text.match(re);
if (hit) hits.push(`${tab}: ...${text.slice(Math.max(0, hit.index - 50), hit.index + 50).replace(/\s+/g, " ")}...`);
}
}
assert.deepEqual(hits, [], "wording from the other mode");
// And each mode's own wording is really there, so the sweep is reading the panels.
const all = Object.values(texts).join(" ");
assert.match(all, inApp ? /terminal panel/ : /your terminal/);
});
}
+172
View File
@@ -161,6 +161,98 @@ test("Continue here is hidden once the session meter is red, and the command and
assert.equal(await closeGuide(s).count(), 1, "the fresh-session advice stays");
});
// Under the desktop app (PLAN2CODE_IN_APP=1) the fresh-session advice in the
// meter's popover and the dashboard's red banner must point at the app's own
// New Session, never a command to copy into a terminal that is not there:
// the popover's is a button filled with the user's highlight colour.
test("under the app, the meter popover and the dashboard's red banner point at New Session, not a command", async (t) => {
const s = await openSession(await suite.browser(), {
t,
workflow: "implement",
payload: { agent: { status: "working", activity: "Task 1 of 1" } },
env: { PLAN2CODE_IN_APP: "1" },
});
s.post({ run: { event: "implement-phase", id: "phase-1", tasks: 30 } });
const pill = s.page.locator("#meter-pill[data-level='red']");
await pill.waitFor();
await pill.click();
const fresh = s.page.locator("#meter-fresh");
const press = fresh.getByRole("button", { name: "Start a New Session" });
await press.waitFor();
assert.equal(await fresh.locator(".meter-fresh-text").count(), 0, "the button is the whole note, no sentence around it");
// The page's highlight, resolved the same way the button's fill is.
const [fill, highlight] = await press.evaluate((n) => {
const probe = document.createElement("i");
probe.style.color = "var(--accent)";
n.append(probe);
const colour = getComputedStyle(probe).color;
probe.remove();
return [getComputedStyle(n).backgroundColor, colour];
});
assert.equal(fill, highlight, "filled with the user's highlight colour");
assert.equal(await fresh.locator("code").count(), 0, "no command to copy under the app");
});
// The desktop app's frame, as the page sees it: a parent that keeps every
// message posted to it, for the test to read back.
const FAKE_APP_FRAME = () => {
window.__toApp = [];
Object.defineProperty(window, "parent", { configurable: true, get: () => ({ postMessage: (m) => window.__toApp.push(m) }) });
};
const toApp = (s, kind) => s.page.evaluate((k) => window.__toApp.filter((m) => m.plan2code === k), kind);
test("under the app, the meter popover's Start a New Session button asks the app for its New Session", async (t) => {
const s = await openSession(await suite.browser(), {
t,
workflow: "implement",
payload: { agent: { status: "working", activity: "Task 1 of 1" } },
env: { PLAN2CODE_IN_APP: "1" },
init: FAKE_APP_FRAME,
});
s.post({ run: { event: "implement-phase", id: "phase-1", tasks: 30 } });
const pill = s.page.locator("#meter-pill[data-level='red']");
await pill.waitFor();
await pill.click();
await s.page.locator("#meter-fresh").getByRole("button", { name: "Start a New Session" }).click();
await until(async () => (await toApp(s, "new-session")).length === 1, 5000);
assert.deepEqual(await toApp(s, "new-session"), [{ plan2code: "new-session" }], "a named request, nothing else in it");
});
test("under the app, the not running line's continue is a button that asks the app to type it, and the page hands the app its highlight", async (t) => {
const s = await openSession(await suite.browser(), {
t,
workflow: "implement",
clock: true,
payload: { items: [{ id: "q1", kind: "text", title: "What to call it", body: "A short name." }], agent: { status: "waiting" } },
env: { PLAN2CODE_IN_APP: "1" },
init: FAKE_APP_FRAME,
});
const looks = await toApp(s, "looks");
assert.ok(looks.length >= 1, "the page told the app its highlight");
assert.deepEqual(looks.at(-1).accent, ["#619fe5", "#1a2533", "#0c1117", "#3d5978"], "the default highlight, in its dark shades");
await s.page.clock.fastForward(200_000);
await lineSays(s, /^Plan2Code is not running right now\./);
const press = s.page.locator("#agent-text .agent-key-btn");
assert.equal(await press.textContent(), "continue");
await press.click();
await until(async () => (await toApp(s, "agent-continue")).length === 1, 5000);
assert.ok(await press.isDisabled(), "held off, so a double press does not type it twice");
});
test("outside the app, the not running line's continue stays a word to type", async (t) => {
const s = await openSession(await suite.browser(), {
t,
workflow: "implement",
clock: true,
payload: { items: [{ id: "q1", kind: "text", title: "What to call it", body: "A short name." }], agent: { status: "waiting" } },
});
await s.page.clock.fastForward(200_000);
await lineSays(s, /^Plan2Code is not running right now\./);
assert.equal(await s.page.locator("#agent-text .agent-key-btn").count(), 0);
assert.equal(await s.page.locator("#agent-text strong.agent-key").textContent(), "continue");
});
test("Stop session, confirmed, sends __stop with no handoff", async (t) => {
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
await s.page.click("#btn-stop");
@@ -553,6 +645,71 @@ test("every finished shape shows Before you close this with its three rows, and
assert.equal(await s.page.locator("#btn-home").isVisible(), false, "a finished screen carries its own way back");
});
// Under the app the same three rows point at the app's own controls instead:
// New Session for "Start fresh", the top bar's dashboard button for "Carry
// on", and no stray command to copy into a shell that is not there.
test("under the app, Before you close this points at New Session, and never at a \"new conversation\" that does not exist there", async (t) => {
const s = await openSession(await suite.browser(), {
t,
workflow: "implement",
payload: { agent: { status: "working", activity: "Task 1 of 1" } },
env: { PLAN2CODE_IN_APP: "1" },
});
const main = s.page.locator("#main");
s.post({ finish: { headline: "A skill next", command: "/plan2code-4-finalize" } });
await main.getByRole("heading", { name: "A skill next" }).waitFor();
const guide = closeGuide(s);
const text = await textOf(guide);
assert.ok(text.includes("Press New Session at the top of the window to start the agent fresh."), "Start fresh points at New Session");
assert.ok(text.includes("Paste the command above into the terminal panel, or start from the dashboard with /plan2code."), "Carry on names the terminal panel");
assert.ok(!text.includes("new session") && !text.includes("new conversation"), "no classic-mode wording under the app");
// The extra "To start something else..." paragraph a classic finish also
// shows is left out here: the row above already says it once.
assert.equal(await main.getByText("To start something else, run").count(), 0, "no second mention of the same command");
// Nothing left to run: the all-done shape still offers the command (the
// app's terminal panel is a real terminal the agent runs in, so pasting it
// there works), worded for the one panel rather than a new conversation.
s.post({ finish: { headline: "AGENTS.md is updated" } });
await main.getByText(/paste .* into the terminal panel below/).waitFor();
assert.ok(await main.locator("code").filter({ hasText: /^\/plan2code --web$/ }).count(), "the command is still offered");
// The live dashboard button's own note, under it, also points at New
// Session instead of typing `/clear` by hand.
s.post({ finish: { headline: "A skill next, with a live dashboard offer", command: "/plan2code-4-finalize", dashboard: true } });
await main.getByRole("button", { name: "Back to the dashboard" }).waitFor();
assert.ok(await main.getByText("press New Session at the top of the window for a clean start instead").count(), "the dashboard note points at New Session");
assert.equal(await main.getByText("type `/clear`", { exact: false }).count(), 0, "no hand-typed /clear under the app");
});
// Once the console server itself is gone (not just finished), the review and
// dashboard offers' own "new conversation" fallback text must say the same:
// paste into the terminal panel, under the app, and never claim a command is
// needed to reconnect, since the app's own bar already does that on its own.
test("under the app, a gone session's review and dashboard fallbacks name the terminal panel, and reconnect needs no command", async (t) => {
const s = await openSession(await suite.browser(), {
t,
workflow: "quick-task",
payload: { agent: { status: "working", activity: "Task 1 of 1" } },
env: { PLAN2CODE_IN_APP: "1" },
clock: true,
});
s.post({ finish: OFFERS });
await s.page.locator("#main").getByRole("heading", { name: "Quick task done" }).waitFor();
await s.page.locator("#main").getByRole("button", { name: "Review it now" }).click();
collect(s);
await stopServer(s);
for (let i = 0; i < 20 && !(await s.page.locator("#planny.is-gone").count()); i++) {
await s.page.clock.fastForward(GONE_AFTER_MS);
await new Promise((r) => setTimeout(r, 250));
}
const main = s.page.locator("#main");
await main.getByText(/paste this into the terminal panel/i).first().waitFor();
assert.equal(await main.getByText(/new conversation/i).count(), 0, "no classic-mode wording under the app");
await main.getByText("Plan2Code will try to reconnect the console on its own; if it cannot, the app's bar offers Reconnect the console.").waitFor();
assert.equal(await main.getByText(/run this in a new conversation/i).count(), 0, "no stray reconnect command under the app");
});
// What a person sees break: the triangle leaving answers behind, or sending a
// finish-style stop instead of the way home.
test("the top bar's back triangle asks first, then sends __dashboard with the typed answers and the home reply", async (t) => {
@@ -629,3 +786,18 @@ test("Back to default in Preferences returns the theme to follow the system and
await s.page.waitForFunction(() => !document.documentElement.hasAttribute("data-theme"));
assert.equal(await s.page.locator('input[name="looks-theme"][value="system"]').isChecked(), true, "the system choice is ticked again");
});
// Planny's own spoken line said "close this tab": under the app there is no
// tab, only the one window.
test("under the app, Planny's finished line says to close the window, not the tab", async (t) => {
const s = await openSession(await suite.browser(), {
t,
workflow: "implement",
payload: { agent: { status: "working", activity: "Task 1 of 1" } },
env: { PLAN2CODE_IN_APP: "1" },
});
s.post({ finish: { headline: "All done", dashboard: true } });
await s.page.locator("#main").getByRole("heading", { name: "All done" }).waitFor();
const line = await lineSays(s, /close this window/);
assert.doesNotMatch(line, /close this tab/, "no classic-mode wording under the app");
});
+4
View File
@@ -256,6 +256,10 @@ test("a working agent's line falls back to its headline note", () => {
test("the terminal line is the exact text every command hands back", () => {
assert.equal(terminalLine("http://127.0.0.1:1/s/abc/"), "→ Look at the web console: http://127.0.0.1:1/s/abc/");
// Under the desktop app the page is beside the terminal: no address to print.
const inApp = terminalLine("http://127.0.0.1:1/s/abc/", { PLAN2CODE_IN_APP: "1" });
assert.equal(inApp.includes("127.0.0.1"), false, "no address under the app");
assert.equal(terminalLine("http://127.0.0.1:1/s/abc/", {}), "→ Look at the web console: http://127.0.0.1:1/s/abc/");
});
test("repoRoots reads the branch off disk: named, detached, a linked worktree's own, and none", () => {
+1
View File
@@ -43,6 +43,7 @@ test("state: the rest of the shared state starts as app.js always started it", (
wsFrame: null,
meterFrame: null,
updateFrame: null,
inApp: false,
subagentsFrame: null,
overview: { key: null, text: null },
wake: null,