Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Train fix (#7921, #7908, #7948): their tests render in Advanced mode, where those controls show

milind-soni939630d0211d
diff --git a/src/components/McpServersPanel.add.test.ts b/src/components/McpServersPanel.add.test.ts
index 296161b84a..ba16d437a3 100644
--- a/src/components/McpServersPanel.add.test.ts
+++ b/src/components/McpServersPanel.add.test.ts
@@ -1,9 +1,10 @@
// @vitest-environment happy-dom
import { act, createElement } from "react";
import { createRoot, type Root } from "react-dom/client";
-import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { afterEach, beforeEach, describe, expect, it, onTestFinished, vi } from "vitest";
import { setLocale } from "@/lib/i18n";
+import { setAdvancedMode } from "@/lib/interface-mode";
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
@@ -357,6 +358,9 @@ describe("Adding an MCP server on a Team Cloud", () => {
});
it("shows the sign-in app's return address, copies it, and saves an edited one", async () => {
+ // The return address field and Copy are Advanced-mode controls.
+ setAdvancedMode(true);
+ onTestFinished(() => setAdvancedMode(false));
fixture.servers = [{
name: "mail", type: "http", url: "https://mail.example.com/mcp", headerKeys: [], enabled: true,
oauth: { clientId: "fixture-client-id", scopes: [], clientSecretConfigured: false, redirectUri: "https://maus.example/mcp-oauth/callback", redirectUriDefault: false },
diff --git a/src/components/Sidebar.recent-conversations.dom.test.ts b/src/components/Sidebar.recent-conversations.dom.test.ts
index 7564a869d8..2da23498af 100644
--- a/src/components/Sidebar.recent-conversations.dom.test.ts
+++ b/src/components/Sidebar.recent-conversations.dom.test.ts
@@ -31,6 +31,8 @@ beforeEach(() => {
vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
vi.stubGlobal("fetch", () => new Promise(() => {}));
localStorage.clear();
+ // The recent list is drawn in Advanced mode.
+ localStorage.setItem("omb-advanced-mode", "1");
setLocale("en");
dispatch.mockClear();
onClose.mockClear();
diff --git a/src/components/SoulField.large.dom.test.ts b/src/components/SoulField.large.dom.test.ts
index 8b7f3e4d04..e2c6d1d771 100644
--- a/src/components/SoulField.large.dom.test.ts
+++ b/src/components/SoulField.large.dom.test.ts
@@ -7,6 +7,8 @@ import { setLocale } from "@/lib/i18n";
import type { Bot } from "@/state/store";
const fx = vi.hoisted(() => ({ request: vi.fn() }));
+// "Open large" is an Advanced-mode action.
+vi.mock("@/lib/interface-mode", async (original) => ({ ...await original<typeof import("@/lib/interface-mode")>(), useAdvancedMode: () => true }));
vi.mock("@/state/store", async (importOriginal) => {
const original = await importOriginal<typeof import("@/state/store")>();
return { ...original, useStore: () => ({ state: original.initialState, dispatch: vi.fn(), flushBotPatches: () => Promise.resolve() }) };