Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
test: 修复会话分叉 PR 的测试环境
Zhehui Bi94322432a0d0
diff --git a/scripts/testing/control-omb-ui.ts b/scripts/testing/control-omb-ui.tsindex a7632e3fab..441ce7265f 100644--- a/scripts/testing/control-omb-ui.ts+++ b/scripts/testing/control-omb-ui.ts@@ -29,6 +29,11 @@ const ROOT = fileURLToPath(new URL("../..", import.meta.url));export const UI_TOOLS_DIR = join(ROOT, ".omb-scratch", "verify-tools");/** Verbs that change the fixture or the page; they take the explicit handle, never discovery. */export const UI_MUTATING = new Set(["click", "type", "press", "flag", "eval"]);+export const ENABLE_ADVANCED_UI = `(() => {+ localStorage.setItem("omb-advanced-mode", "1");+ window.dispatchEvent(new StorageEvent("storage", { key: "omb-advanced-mode", storageArea: localStorage }));+ return true;+})()`;/** The sidebar's Tools section starts open, and a click on its header closes it. */export const OPEN_SIDEBAR_TOOLS = "(() => { document.querySelector('[data-tour=tools] button[aria-expanded=false]')?.click(); return true; })()";diff --git a/scripts/testing/cron-routines-ui.e2e.test.ts b/scripts/testing/cron-routines-ui.e2e.test.tsindex 772f9fc6a1..7e6dbb501e 100644--- a/scripts/testing/cron-routines-ui.e2e.test.ts+++ b/scripts/testing/cron-routines-ui.e2e.test.ts@@ -7,7 +7,7 @@ import { resolveAgentBrowserBinary } from "../../server/browser-engine.ts";import { waitForExit } from "../../server/testing/cleanup.ts";import type { Routine } from "../../src/lib/routines.ts";import { runControlOmb } from "../control-omb.ts";-import { UI_TOOLS_DIR } from "./control-omb-ui.ts";+import { ENABLE_ADVANCED_UI, UI_TOOLS_DIR } from "./control-omb-ui.ts";const ROOT = fileURLToPath(new URL("../..", import.meta.url));const enabled = process.env.OMB_UI_E2E === "1" || Boolean(resolveAgentBrowserBinary({ dataDir: UI_TOOLS_DIR, env: process.env }));@@ -26,6 +26,7 @@ afterAll(() => waitForExit(child, { signal: "SIGINT", graceMs: 30_000 }));try { fixture = JSON.parse(output); return Boolean(fixture.ui); } catch { return false; }}, { timeout: 600_000 }).toBe(true);const ui = (verb: string, ...args: string[]) => runControlOmb(["ui", verb, "--ui", fixture.ui, ...args]) as Promise<Record<string, any>>;+ await ui("eval", "--js", ENABLE_ADVANCED_UI);const evaluate = async (js: string) => (await ui("eval", "--js", js)).result;const click = async (name: string) => {await evaluate(`[...document.querySelectorAll('button')].find(button => button.textContent === ${JSON.stringify(name)})?.scrollIntoView({ block: 'center' })`);diff --git a/scripts/testing/one-workspace-fixture.ts b/scripts/testing/one-workspace-fixture.tsindex 430cf39bbb..f0b17ec411 100644--- a/scripts/testing/one-workspace-fixture.ts+++ b/scripts/testing/one-workspace-fixture.ts@@ -387,6 +387,7 @@ export async function launchHomeWorld(fx: CloudSendFixture, { chrome, ports, verconst started = new Map<string, number>();const syncHandlers = new Map<string, (event: any) => void>();const ipcMain = { handle: (channel: string, handler: (...args: any[]) => unknown) => { handlers.set(channel, handler); }, on: (channel: string, listener: (event: any) => void) => { syncHandlers.set(channel, listener); } };+ ipcMain.on("desktop-language:read", (event) => { event.returnValue = "en"; });const ipc: Server = createHttpServer(async (req: IncomingMessage, res: ServerResponse) => {res.setHeader("access-control-allow-origin", "*");const [path = "", query = ""] = (req.url ?? "").split("?");diff --git a/scripts/testing/reply-focus-ui.e2e.test.ts b/scripts/testing/reply-focus-ui.e2e.test.tsindex fc33278b32..6130db4dff 100644--- a/scripts/testing/reply-focus-ui.e2e.test.ts+++ b/scripts/testing/reply-focus-ui.e2e.test.ts@@ -31,11 +31,10 @@ if (!enabled) console.info("skipping reply focus UI e2e: set OMB_UI_E2E=1 to insconst evaluate = async (js: string) => (await ui("eval", "--js", js)).result;const focused = () => evaluate("document.activeElement?.getAttribute('aria-label') || document.activeElement?.tagName");- // Keyboard path: focus sits on the Reply control itself, the case the- // rule must take focus from, and Enter activates it as a person would.- await expect.poll(() => evaluate("Boolean(document.querySelector('button[aria-label=\"Reply to message\"]'))"), { timeout: 15_000 }).toBe(true);- await evaluate("(() => { document.querySelector('button[aria-label=\"Reply to message\"]').focus(); return true; })()");- expect(await focused()).toBe("Reply to message");+ await expect.poll(() => evaluate("Boolean(document.querySelector('button[aria-label=\"Message actions\"]'))"), { timeout: 15_000 }).toBe(true);+ await evaluate("(() => { document.querySelector('button[aria-label=\"Message actions\"]').focus(); return true; })()");+ await ui("press", "--keys", "Enter");+ await expect.poll(() => evaluate("document.activeElement?.getAttribute('role') === 'menuitem' && document.activeElement.textContent.trim() === 'Reply'")).toBe(true);await ui("press", "--keys", "Enter");await expect.poll(() => evaluate("/Replying to Pepper/.test(document.body.innerText)"), { timeout: 5_000 }).toBe(true);await expect.poll(focused, { timeout: 5_000 }).toBe("Message Pepper");diff --git a/scripts/testing/room-pages-ui.e2e.test.ts b/scripts/testing/room-pages-ui.e2e.test.tsindex 8cdd9505dc..2b96960f86 100644--- a/scripts/testing/room-pages-ui.e2e.test.ts+++ b/scripts/testing/room-pages-ui.e2e.test.ts@@ -188,9 +188,8 @@ async function until<T>(probe: () => Promise<T> | T, what: string, timeoutMs = 3await inView(pageId);await ui("screenshot", "--out", join(evidenceDir, "room-pages-clicked-send.png"));- const board = await inView(boardRow.id);- // The board's "Paint it red" button: under its heading and its result line, in the browser's default styles.- await click(board, 48, 124);+ await inView(boardRow.id);+ await ui("click", "--name", "Paint it red");await until(() => shows(`Error -32000: ${ROOM_VIEW_ONLY}`), "the board to show the host's refusal");await inView(boardRow.id);await ui("screenshot", "--out", join(evidenceDir, "room-pages-clicked-app.png"));diff --git a/scripts/testing/slack-management-ui.e2e.test.ts b/scripts/testing/slack-management-ui.e2e.test.tsindex ced12863b3..2b0b04d3d2 100644--- a/scripts/testing/slack-management-ui.e2e.test.ts+++ b/scripts/testing/slack-management-ui.e2e.test.ts@@ -8,7 +8,7 @@ import { afterAll, describe, expect, it } from "vitest";import { resolveAgentBrowserBinary } from "../../server/browser-engine.ts";import { waitForExit } from "../../server/testing/cleanup.ts";import { runControlOmb } from "../control-omb.ts";-import { UI_TOOLS_DIR } from "./control-omb-ui.ts";+import { ENABLE_ADVANCED_UI, UI_TOOLS_DIR } from "./control-omb-ui.ts";const ROOT = fileURLToPath(new URL("../..", import.meta.url));const binary = resolveAgentBrowserBinary({ dataDir: UI_TOOLS_DIR, env: process.env });@@ -37,6 +37,7 @@ describe("Slack management in agent settings", () => {}, { timeout: launchTimeout, interval: 250 }).toBe(true);const fixture = info!;const ui = (verb: string, ...args: string[]) => runControlOmb(["ui", verb, "--ui", fixture.ui, ...args]) as Promise<Record<string, any>>;+ await ui("eval", "--js", ENABLE_ADVANCED_UI);const evaluate = async (js: string) => (await ui("eval", "--js", js)).result;const snapshot = async () => (await ui("snapshot")).snapshot as string;const click = (name: string) => ui("click", "--name", name);diff --git a/scripts/testing/team-access-ui.e2e.test.ts b/scripts/testing/team-access-ui.e2e.test.tsindex 041553c646..fa41314ad3 100644--- a/scripts/testing/team-access-ui.e2e.test.ts+++ b/scripts/testing/team-access-ui.e2e.test.ts@@ -5,7 +5,7 @@ import { expect, it } from "vitest";import { resolveAgentBrowserBinary } from "../../server/browser-engine.ts";import { waitForExit } from "../../server/testing/cleanup.ts";import { runControlOmb } from "../control-omb.ts";-import { UI_TOOLS_DIR } from "./control-omb-ui.ts";+import { ENABLE_ADVANCED_UI, UI_TOOLS_DIR } from "./control-omb-ui.ts";const ROOT = fileURLToPath(new URL("../..", import.meta.url));const enabled = process.env.OMB_UI_E2E === "1" || Boolean(resolveAgentBrowserBinary({ dataDir: UI_TOOLS_DIR, env: process.env }));@@ -34,6 +34,7 @@ const enabled = process.env.OMB_UI_E2E === "1" || Boolean(resolveAgentBrowserBinreturn result;};const ui = (verb: string, ...args: string[]) => runControlOmb(["ui", verb, "--ui", info.ui, ...args]) as Promise<any>;+ await ui("eval", "--js", ENABLE_ADVANCED_UI);const click = (name: string) => ui("click", "--name", name);// The browser harness does not assign refs to native <summary> nodes.const toggleTeams = () => ui("eval", "--js", "document.querySelector('[data-bot-settings-section=permissions] summary').click()");@@ -52,7 +53,7 @@ const enabled = process.env.OMB_UI_E2E === "1" || Boolean(resolveAgentBrowserBinawait api("/api/sidebar-sections", { name: "Empty delivery" }, "POST");await ui("eval", "--js", "location.reload(); true");await expect.poll(snapshot, { timeout: 15_000 }).toContain("Actions for Clive");- await clickRole("button", /^Clive Rename Clive /);+ await clickRole("button", /^Clive .*Rename Clive\b/);await expect.poll(snapshot, { timeout: 10_000 }).toContain("Open Clive's profile");await clickRole("button", "Open Clive's profile");await click("Permissions");diff --git a/scripts/testing/team-canvas-ui.e2e.test.ts b/scripts/testing/team-canvas-ui.e2e.test.tsindex ed74543f5e..1ad3223e3f 100644--- a/scripts/testing/team-canvas-ui.e2e.test.ts+++ b/scripts/testing/team-canvas-ui.e2e.test.ts@@ -6,7 +6,7 @@ import { expect, it } from "vitest";import { resolveAgentBrowserBinary } from "../../server/browser-engine.ts";import { waitForExit } from "../../server/testing/cleanup.ts";import { runControlOmb } from "../control-omb.ts";-import { OPEN_SIDEBAR_TOOLS, UI_TOOLS_DIR } from "./control-omb-ui.ts";+import { ENABLE_ADVANCED_UI, OPEN_SIDEBAR_TOOLS, UI_TOOLS_DIR } from "./control-omb-ui.ts";import { fixtureApi } from "./preview-fixture.ts";const ROOT = fileURLToPath(new URL("../..", import.meta.url));@@ -39,6 +39,7 @@ type BotRecord = {const fixture = info!;const api = fixtureApi(fixture.url);const ui = (verb: string, ...args: string[]) => runControlOmb(["ui", verb, "--ui", fixture.ui, ...args]) as Promise<Record<string, any>>;+ await ui("eval", "--js", ENABLE_ADVANCED_UI);const evaluate = async (js: string) => (await ui("eval", "--js", js)).result;const snapshot = async () => (await ui("snapshot")).snapshot as string;const focused = () => evaluate("document.activeElement?.getAttribute('aria-label') || document.activeElement?.textContent?.trim()");diff --git a/scripts/testing/team-computers-ui.e2e.test.ts b/scripts/testing/team-computers-ui.e2e.test.tsindex 78fbf45e3f..25c4e9d1ed 100644--- a/scripts/testing/team-computers-ui.e2e.test.ts+++ b/scripts/testing/team-computers-ui.e2e.test.ts@@ -6,7 +6,7 @@ import { expect, it } from "vitest";import { resolveAgentBrowserBinary } from "../../server/browser-engine.ts";import { waitForExit } from "../../server/testing/cleanup.ts";import { runControlOmb } from "../control-omb.ts";-import { OPEN_SIDEBAR_TOOLS, UI_TOOLS_DIR } from "./control-omb-ui.ts";+import { ENABLE_ADVANCED_UI, OPEN_SIDEBAR_TOOLS, UI_TOOLS_DIR } from "./control-omb-ui.ts";import { fixtureApi } from "./preview-fixture.ts";const ROOT = fileURLToPath(new URL("../..", import.meta.url));@@ -37,6 +37,7 @@ type Computer = { id: string; name: string; section: string | null; state: strinconst api = fixtureApi(fixture.url);const provider = fixtureApi(fixture.boatFixtureApi);const ui = (verb: string, ...args: string[]) => runControlOmb(["ui", verb, "--ui", fixture.ui, ...args]) as Promise<Record<string, any>>;+ await ui("eval", "--js", ENABLE_ADVANCED_UI);const evaluate = async (js: string) => (await ui("eval", "--js", js)).result;const snapshot = async () => (await ui("snapshot")).snapshot as string;const ref = async (name: string, role?: string) => {diff --git a/scripts/testing/team-lifecycle-ui.e2e.test.ts b/scripts/testing/team-lifecycle-ui.e2e.test.tsindex 6b70d396f4..05b8a528fa 100644--- a/scripts/testing/team-lifecycle-ui.e2e.test.ts+++ b/scripts/testing/team-lifecycle-ui.e2e.test.ts@@ -8,7 +8,7 @@ import { waitForExit } from "../../server/testing/cleanup.ts";import { runControlOmb } from "../control-omb.ts";import { request } from "../mcp-server.ts";import { mountPreview, type MountedPreview } from "./preview-fixture.ts";-import { OPEN_SIDEBAR_TOOLS, UI_TOOLS_DIR } from "./control-omb-ui.ts";+import { ENABLE_ADVANCED_UI, OPEN_SIDEBAR_TOOLS, UI_TOOLS_DIR } from "./control-omb-ui.ts";const ROOT = fileURLToPath(new URL("../..", import.meta.url));const binary = resolveAgentBrowserBinary({ dataDir: UI_TOOLS_DIR, env: process.env });@@ -37,6 +37,7 @@ if (!enabled) console.log("skipping team lifecycle UI e2e: set OMB_UI_E2E=1 to ifixtureHandle = info!.ui;fixtureLog = info!.logPath;const ui = (verb: string, ...args: string[]) => runControlOmb(["ui", verb, "--ui", info.ui, ...args]) as Promise<Record<string, any>>;+ await ui("eval", "--js", ENABLE_ADVANCED_UI);const target = async (name: string, roles: string[]) => {let matches: Array<[string, { name: string; role: string }]> = [];await expect.poll(async () => {diff --git a/scripts/testing/team-map-computers-ui.e2e.test.ts b/scripts/testing/team-map-computers-ui.e2e.test.tsindex 09f693b45b..1f5c6a31ba 100644--- a/scripts/testing/team-map-computers-ui.e2e.test.ts+++ b/scripts/testing/team-map-computers-ui.e2e.test.ts@@ -6,7 +6,7 @@ import { expect, it } from "vitest";import { resolveAgentBrowserBinary } from "../../server/browser-engine.ts";import { waitForExit } from "../../server/testing/cleanup.ts";import { runControlOmb } from "../control-omb.ts";-import { UI_TOOLS_DIR } from "./control-omb-ui.ts";+import { ENABLE_ADVANCED_UI, UI_TOOLS_DIR } from "./control-omb-ui.ts";import { fixtureApi } from "./preview-fixture.ts";const ROOT = fileURLToPath(new URL("../..", import.meta.url));@@ -36,6 +36,7 @@ type Receipts = { calls: Array<{ method: string; path: string }>; shots: Record<const fixture = info!;const provider = fixtureApi(fixture.boatFixtureApi);const ui = (verb: string, ...args: string[]) => runControlOmb(["ui", verb, "--ui", fixture.ui, ...args]) as Promise<Record<string, any>>;+ await ui("eval", "--js", ENABLE_ADVANCED_UI);const evaluate = async (js: string) => (await ui("eval", "--js", js)).result;const snapshot = async () => (await ui("snapshot")).snapshot as string;const receipts = async () => await provider("GET", "/__fixture") as Receipts;diff --git a/scripts/testing/team-map-everyone-ui.e2e.test.ts b/scripts/testing/team-map-everyone-ui.e2e.test.tsindex f1ce7cdedb..f47efc21cf 100644--- a/scripts/testing/team-map-everyone-ui.e2e.test.ts+++ b/scripts/testing/team-map-everyone-ui.e2e.test.ts@@ -7,7 +7,7 @@ import { expect, it } from "vitest";import { resolveAgentBrowserBinary } from "../../server/browser-engine.ts";import { waitForExit } from "../../server/testing/cleanup.ts";import { runControlOmb } from "../control-omb.ts";-import { UI_TOOLS_DIR } from "./control-omb-ui.ts";+import { ENABLE_ADVANCED_UI, UI_TOOLS_DIR } from "./control-omb-ui.ts";const ROOT = fileURLToPath(new URL("../..", import.meta.url));const binary = resolveAgentBrowserBinary({ dataDir: UI_TOOLS_DIR, env: process.env });@@ -31,6 +31,7 @@ type Bot = { id: string; name: string; threadId: string; chiefOfStaff?: boolean;try { info = JSON.parse(stdout); return Boolean(info.ui); } catch { return false; }}, { timeout: binary ? 180_000 : 600_000, interval: 250 }).toBe(true);const ui = (verb: string, ...args: string[]) => runControlOmb(["ui", verb, "--ui", info.ui, ...args]) as Promise<Record<string, any>>;+ await ui("eval", "--js", ENABLE_ADVANCED_UI);const evaluate = async (js: string) => (await ui("eval", "--js", js)).result;const call = async (method: string, path: string, body?: unknown) => {const response = await fetch(`${info.url}${path}`, { method, ...(body === undefined ? {} : { headers: { "content-type": "application/json" }, body: JSON.stringify(body) }) });diff --git a/scripts/testing/threads-preview.tsx b/scripts/testing/threads-preview.tsxindex bd49bedbae..0d70eb50a9 100644--- a/scripts/testing/threads-preview.tsx+++ b/scripts/testing/threads-preview.tsx@@ -2,7 +2,7 @@ import { createRoot } from "react-dom/client";import App from "../../src/App";import { setAnalyticsEnabled, setEmailGateDone } from "../../src/lib/analytics";import { ADVANCED_MODE_KEY, setAdvancedMode } from "../../src/lib/interface-mode";-import { GROK_MOVE_NOTICE, MODELGO_OFFER_NOTICE } from "../../src/lib/notices";+import { BOAT_OFFER_NOTICE, GROK_MOVE_NOTICE, MODELGO_OFFER_NOTICE } from "../../src/lib/notices";import { markSimpleModePromptSeen } from "../../src/lib/simple-mode-prompt";import { applySkinChoice, readSkinChoice } from "../../src/lib/skins";import "../../src/styles.css";@@ -24,5 +24,6 @@ if (!new URLSearchParams(location.search).has("simpleModePrompt")) markSimpleModif (!new URLSearchParams(location.search).has("grokMovePopup")) localStorage.setItem(GROK_MOVE_NOTICE, "1");// And for the once-per-person ModelGo sponsor card, with ?modelgoOffer=1: it sits over the sidebar's foot, where tests click.if (!new URLSearchParams(location.search).has("modelgoOffer")) localStorage.setItem(MODELGO_OFFER_NOTICE, "1");+if (!new URLSearchParams(location.search).has("boatOffer")) localStorage.setItem(BOAT_OFFER_NOTICE, "1");applySkinChoice(readSkinChoice());createRoot(document.getElementById("root")!).render(<App />);diff --git a/scripts/testing/trust-controls-ui.e2e.test.ts b/scripts/testing/trust-controls-ui.e2e.test.tsindex bb249bfd61..b1198022a7 100644--- a/scripts/testing/trust-controls-ui.e2e.test.ts+++ b/scripts/testing/trust-controls-ui.e2e.test.ts@@ -5,7 +5,7 @@ import { afterAll, describe, expect, it } from "vitest";import { resolveAgentBrowserBinary } from "../../server/browser-engine.ts";import { waitForExit } from "../../server/testing/cleanup.ts";import { runControlOmb } from "../control-omb.ts";-import { UI_TOOLS_DIR } from "./control-omb-ui.ts";+import { ENABLE_ADVANCED_UI, UI_TOOLS_DIR } from "./control-omb-ui.ts";const ROOT = fileURLToPath(new URL("../..", import.meta.url));const enabled = process.env.OMB_UI_E2E === "1" || Boolean(resolveAgentBrowserBinary({ dataDir: UI_TOOLS_DIR, env: process.env }));@@ -38,6 +38,7 @@ describe("trust controls in the real renderer", () => {}, { timeout: 300_000, interval: 250 }).toBe(true);const ui = (verb: string, ...args: string[]) => runControlOmb(["ui", verb, "--ui", info.ui, ...args]) as Promise<Record<string, any>>;+ await ui("eval", "--js", ENABLE_ADVANCED_UI);const evaluate = async (js: string) => (await ui("eval", "--js", js)).result;const click = (name: string) => ui("click", "--name", name);const type = async (name: string, text: string) => {@@ -112,7 +113,7 @@ describe("trust controls in the real renderer", () => {});expect(seeded.ok).toBe(true);await click("Model");- expect(await snapshot()).toContain("Automatic recovery is off. This list stays inactive");+ expect(await snapshot()).toContain("Backup models for this bot");expect(await snapshot()).toContain("Work that may have run is not replayed");await expect.poll(() => evaluate("Boolean(document.querySelector('button[aria-label$=\"from the fallback list\"]'))"), { timeout: 10_000 }).toBe(true);await evaluate("document.querySelector('button[aria-label$=\"from the fallback list\"]').click(); true");@@ -120,9 +121,9 @@ describe("trust controls in the real renderer", () => {expect((await saved()).modelSelection).toEqual(bot.modelSelection);await ui("press", "--keys", "Escape");- await evaluate(`(() => { localStorage.setItem('omb-advanced-mode','1'); window.dispatchEvent(new StorageEvent('storage', {key:'omb-advanced-mode'})); return true; })()`);await click("Team map");const openMemory = async () => {+ await expect.poll(() => evaluate('Boolean(document.querySelector(\'[data-team-key=""] details\'))')).toBe(true);await evaluate(`(() => { const menu = document.querySelector('[data-team-key=""] details'); if (!menu) throw new Error('No General team menu'); if (!menu.open) menu.querySelector('summary').click(); return true; })()`);await click("General department memory");};diff --git a/scripts/testing/usage-details-ui.e2e.test.ts b/scripts/testing/usage-details-ui.e2e.test.tsindex 6a6aabbc2c..8c952427bb 100644--- a/scripts/testing/usage-details-ui.e2e.test.ts+++ b/scripts/testing/usage-details-ui.e2e.test.ts@@ -6,7 +6,7 @@ import { expect, it } from "vitest";import { resolveAgentBrowserBinary } from "../../server/browser-engine.ts";import { waitForExit } from "../../server/testing/cleanup.ts";import { runControlOmb } from "../control-omb.ts";-import { agentBrowser, sessionEnv, UI_TOOLS_DIR, type UiHandle } from "./control-omb-ui.ts";+import { ENABLE_ADVANCED_UI, agentBrowser, sessionEnv, UI_TOOLS_DIR, type UiHandle } from "./control-omb-ui.ts";const ROOT = fileURLToPath(new URL("../..", import.meta.url));const enabled = process.env.OMB_UI_E2E === "1" || Boolean(resolveAgentBrowserBinary({ dataDir: UI_TOOLS_DIR, env: process.env }));@@ -28,6 +28,7 @@ if (!enabled) console.log("skipping usage details UI: set OMB_UI_E2E=1 to instal}, { timeout: 600_000, interval: 250 }).toBe(true);const handle = info!;const ui = (verb: string, ...args: string[]) => runControlOmb(["ui", verb, "--ui", handle.ui, ...args]) as Promise<Record<string, any>>;+ await ui("eval", "--js", ENABLE_ADVANCED_UI);await ui("type", "--name", "Message Pepper", "--text", "Check the fixture usage");await ui("press", "--keys", "Enter");const settled = await ui("wait-settle", "--timeout", "60");@@ -45,7 +46,7 @@ if (!enabled) console.log("skipping usage details UI: set OMB_UI_E2E=1 to instal// Header actions stay usable in the consolidated menu, including a// denied clipboard. Only this disposable browser's clipboard is stubbed.const evaluate = async (js: string) => (await ui("eval", "--js", js)).result;- await evaluate(`Object.defineProperty(navigator.clipboard, 'writeText', { configurable: true, value: async () => { throw new Error('fixture denial'); } }); true`);+ await evaluate(`Object.defineProperty(navigator.clipboard, 'writeText', { configurable: true, value: async () => { throw new Error('fixture denial'); } }); document.execCommand = () => false; true`);await ui("click", "--name", "Copy as Markdown");await expect.poll(() => evaluate("document.querySelector('[role=menu] [role=status]')?.textContent")).toBe("Couldn't copy. Use Download instead.");await evaluate(`Object.defineProperty(navigator.clipboard, 'writeText', { configurable: true, value: async text => { window.copiedTranscript = text; } }); true`);@@ -92,16 +93,17 @@ if (!enabled) console.log("skipping usage details UI: set OMB_UI_E2E=1 to instalawait expect.poll(() => evaluate("document.querySelector('[data-sidebar]').getBoundingClientRect().width")).toBe(80);expect(await evaluate("localStorage.getItem('openmausbot.sidebarDensity')")).toBe(density);await ui("screenshot", "--out", `${handle.logPath}.settings-1100.png`);- expect(await evaluate("Boolean(document.querySelector('[role=dialog]'))")).toBe(true);+ await expect.poll(() => evaluate("Boolean(document.querySelector('[role=dialog]'))")).toBe(true);await ui("press", "--keys", "Escape");await expect.poll(() => evaluate("document.querySelector('[data-sidebar]').getBoundingClientRect().width")).toBe(320);await ui("click", "--name", "More");await ui("click", "--name", "Inspector");+ await expect.poll(() => evaluate("Boolean(document.querySelector('[aria-label=Inspector]'))")).toBe(true);await ui("click", "--name", "More");const withInspector = await ui("snapshot", "--interactive");const usageWithInspector = Object.entries(withInspector.refs as Record<string, { name: string; role: string }>).find(([, entry]) => entry.role === "menuitem" && entry.name.startsWith("Usage"))!;await ui("click", "--ref", `@${usageWithInspector[0]}`);- await expect.poll(() => evaluate("getComputedStyle(document.querySelector('[role=dialog]')).position")).toBe("absolute");+ await expect.poll(() => evaluate("document.querySelector('[role=dialog]') && getComputedStyle(document.querySelector('[role=dialog]')).position")).toBe("absolute");expect(await evaluate("document.querySelector('main').getBoundingClientRect().width")).toBeGreaterThan(400);await ui("screenshot", "--out", `${handle.logPath}.two-panels-1100.png`);await agentBrowser(browser.binary, sessionEnv(browser), ["set", "viewport", "1600", "900"]);diff --git a/scripts/testing/workspace-backup-ui.e2e.test.ts b/scripts/testing/workspace-backup-ui.e2e.test.tsindex dc15f202bd..11a01ddb8c 100644--- a/scripts/testing/workspace-backup-ui.e2e.test.ts+++ b/scripts/testing/workspace-backup-ui.e2e.test.ts@@ -8,7 +8,7 @@ import { afterAll, describe, expect, it } from "vitest";import { resolveAgentBrowserBinary } from "../../server/browser-engine.ts";import { waitForExit } from "../../server/testing/cleanup.ts";import { runControlOmb } from "../control-omb.ts";-import { UI_TOOLS_DIR } from "./control-omb-ui.ts";+import { ENABLE_ADVANCED_UI, UI_TOOLS_DIR } from "./control-omb-ui.ts";const ROOT = fileURLToPath(new URL("../..", import.meta.url));const binary = resolveAgentBrowserBinary({ dataDir: UI_TOOLS_DIR, env: process.env });@@ -37,8 +37,11 @@ describe("full backup Settings in the real renderer", () => {try { info = JSON.parse(stdout); return Boolean(info.ui); } catch { return false; }}, { timeout: LAUNCH_TIMEOUT_MS, interval: 250 }).toBe(true);const ui = (verb: string, ...args: string[]) => runControlOmb(["ui", verb, "--ui", info.ui, ...args]) as Promise<Record<string, any>>;+ await ui("eval", "--js", ENABLE_ADVANCED_UI);const evaluate = async (js: string) => (await ui("eval", "--js", js)).result;- const click = (name: string) => ui("click", "--name", name);+ const click = (name: string) => ui("click", "--name", name).catch((error: Error) => {+ throw new Error(`Click ${name}: ${error.message}`, { cause: error });+ });const type = async (name: string, text: string) => {await click(name);// Select the focused native input. `ui type` appends and its focus@@ -84,10 +87,11 @@ describe("full backup Settings in the real renderer", () => {await expect.poll(snapshot, { timeout: 10_000 }).toContain('button "You"');await click("New or share");const menu = await snapshot();- expect(menu).toContain('button "Templates"');- expect(menu).not.toContain('button "Export backup"');+ expect(menu).toContain('menuitem "Templates"');+ expect(menu).not.toContain('"Export backup"');await click("Templates");- await ui("press", "--keys", "Escape");+ await expect.poll(snapshot).toContain('button "Close templates"');+ await click("Close templates");await click("You");await click("Settings");await click("Backups");@@ -124,7 +128,7 @@ describe("full backup Settings in the real renderer", () => {const evidence = join(ROOT, ".omb-scratch", "verify-evidence", "workspace-backup-preview.png");await ui("screenshot", "--out", evidence);await click("Replace installation");- await expect.poll(snapshot, { timeout: 10_000 }).toContain("Fully quit OpenMausBot");+ await expect.poll(snapshot, { timeout: 10_000 }).toContain("and reopen it to finish");expect(await evaluate("window.backupFixture.calls.find(call => call.path.endsWith('/restore')).body")).toEqual({ id: "validated-stage", confirmation: "REPLACE" });expect(await evaluate("window.backupFixture.calls.find(call => call.path.endsWith('/upload')).rawFile")).toBe(true);expect(await evaluate("localStorage.getItem('omb-pending-workspace-restore')")).toBe("validated-stage");diff --git a/server/data-format.test.ts b/server/data-format.test.tsindex b60b31b455..de8d1381a6 100644--- a/server/data-format.test.ts+++ b/server/data-format.test.ts@@ -19,7 +19,7 @@ const dataDir = () => {return dir;};afterEach(() => {- for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true });+ for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true, maxRetries: 3 });});describe("the N-1 rule", () => {diff --git a/server/engine-install.test.ts b/server/engine-install.test.tsindex 3fe4ebb3ed..590d8866cf 100644--- a/server/engine-install.test.ts+++ b/server/engine-install.test.ts@@ -1,5 +1,5 @@import { createHash } from "node:crypto";-import { chmodSync, linkSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, writeFileSync } from "node:fs";+import { chmodSync, linkSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, symlinkSync, writeFileSync } from "node:fs";import { tmpdir } from "node:os";import { delimiter, join } from "node:path";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";@@ -64,6 +64,7 @@ function useFakeNpm() {ctx.binDir = join(ctx.scratch, "fake-path");ctx.base = join(ctx.scratch, "data");mkdirSync(ctx.binDir);+ if (process.platform !== "win32") symlinkSync(process.execPath, join(ctx.binDir, "node"));writeFakeNpm(ctx.binDir);originalPath = process.env.PATH;process.env.PATH = ctx.binDir;diff --git a/server/harness/registry.test.ts b/server/harness/registry.test.tsindex 04a2bab429..23ead893fe 100644--- a/server/harness/registry.test.ts+++ b/server/harness/registry.test.ts@@ -1,6 +1,6 @@// A config written by a newer or differently built app must load as an unavailable shadow, never crash the fleet.import { execFileSync } from "node:child_process";-import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync } from "node:fs";+import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, symlinkSync, writeFileSync } from "node:fs";import { tmpdir } from "node:os";import { join } from "node:path";import { afterEach, describe, expect, it, vi } from "vitest";@@ -548,6 +548,7 @@ process.exit(0);originalPath = process.env.PATH;const binDir = join(scratch, "fake-path");mkdirSync(binDir);+ symlinkSync(process.execPath, join(binDir, "node"));if (present) addFakeNpm(binDir);process.env.PATH = binDir;process.env.FAKE_NPM_LOG = join(scratch, "npm-calls.jsonl");