Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
test: 等待桌面面板和事件数据就绪
Zhehui Bicf1b3c0c3736
diff --git a/scripts/testing/control-omb-ui.e2e.test.ts b/scripts/testing/control-omb-ui.e2e.test.tsindex 209040db7f..7b31058ea7 100644--- a/scripts/testing/control-omb-ui.e2e.test.ts+++ b/scripts/testing/control-omb-ui.e2e.test.ts@@ -366,8 +366,11 @@ describe("control-omb ui drives the real renderer", () => {const [eventsTab] = refsNamed(inspected, "Events", "tab");expect(eventsTab).toBeDefined();await ui("click", info.ui, "--ref", eventsTab);- const events = await ui("snapshot", info.ui);- expect(events.snapshot).toContain("turn.started");+ const events = await vi.waitFor(async () => {+ const snapshot = await ui("snapshot", info.ui);+ expect(snapshot.snapshot).toContain("turn.started");+ return snapshot;+ }, { timeout: 10_000 });const [rawTab] = refsNamed(events, "Raw", "tab");await ui("click", info.ui, "--ref", rawTab);expect((await ui("snapshot", info.ui)).snapshot).toContain('tab "Raw" [selected');diff --git a/scripts/testing/trust-controls-ui.e2e.test.ts b/scripts/testing/trust-controls-ui.e2e.test.tsindex b1198022a7..b6d07075a1 100644--- a/scripts/testing/trust-controls-ui.e2e.test.ts+++ b/scripts/testing/trust-controls-ui.e2e.test.ts@@ -123,7 +123,7 @@ describe("trust controls in the real renderer", () => {await click("Team map");const openMemory = async () => {- await expect.poll(() => evaluate('Boolean(document.querySelector(\'[data-team-key=""] details\'))')).toBe(true);+ await expect.poll(() => evaluate('Boolean(document.querySelector(\'[data-team-key=""] details\'))'), { timeout: 10_000 }).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 8c952427bb..a607572d09 100644--- a/scripts/testing/usage-details-ui.e2e.test.ts+++ b/scripts/testing/usage-details-ui.e2e.test.ts@@ -2,7 +2,7 @@ import { spawn, type ChildProcess } from "node:child_process";import { readFileSync, writeFileSync } from "node:fs";import { join } from "node:path";import { fileURLToPath } from "node:url";-import { expect, it } from "vitest";+import { expect, it, vi } from "vitest";import { resolveAgentBrowserBinary } from "../../server/browser-engine.ts";import { waitForExit } from "../../server/testing/cleanup.ts";import { runControlOmb } from "../control-omb.ts";@@ -86,23 +86,27 @@ if (!enabled) console.log("skipping usage details UI: set OMB_UI_E2E=1 to instalawait agentBrowser(browser.binary, sessionEnv(browser), ["set", "viewport", "1100", "900"]);await expect.poll(() => evaluate("innerWidth")).toBe(1100);const density = await evaluate("localStorage.getItem('openmausbot.sidebarDensity')");- await ui("click", "--name", "More");- const snapshot = await ui("snapshot", "--interactive");- const usage = Object.entries(snapshot.refs as Record<string, { name: string; role: string }>).find(([, entry]) => entry.role === "menuitem" && entry.name.startsWith("Usage"))!;- await ui("click", "--ref", `@${usage[0]}`);+ const openUsage = async () => {+ await ui("click", "--name", "More");+ const ref = await vi.waitFor(async () => {+ const snapshot = await ui("snapshot", "--interactive");+ const usage = Object.entries(snapshot.refs as Record<string, { name: string; role: string }>).find(([, entry]) => entry.role === "menuitem" && entry.name.startsWith("Usage"));+ expect(usage).toBeDefined();+ return usage![0];+ }, { timeout: 10_000 });+ await ui("click", "--ref", `@${ref}`);+ };+ await openUsage();await 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`);- await expect.poll(() => evaluate("Boolean(document.querySelector('[role=dialog]'))")).toBe(true);+ await expect.poll(() => evaluate("Boolean(document.querySelector('[role=dialog]'))"), { timeout: 10_000 }).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("Boolean(document.querySelector('[aria-label=Inspector]'))"), { timeout: 10_000 }).toBe(true);+ await openUsage();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`);