Skip to content

Your lightweight open-source personal agent.

test(webui): declare isolated preview support in navigation fixture

Xubin Ren69a368fdf8bf
diff --git a/webui/src/tests/temporary-chat-navigation.test.tsx b/webui/src/tests/temporary-chat-navigation.test.tsx
index eac7b19d4..d2f34d8af 100644
--- a/webui/src/tests/temporary-chat-navigation.test.tsx
+++ b/webui/src/tests/temporary-chat-navigation.test.tsx
@@ -1,3 +1,4 @@
+// @vitest-environment-options {"settings":{"disableIframePageLoading":true}}
import { act, cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
@@ -10,6 +11,7 @@ import { canonicalThreadPayload } from "./thread-test-payload";
let groupedTopics = false;
let withFiles = false;
+const credentialless = Object.getOwnPropertyDescriptor(HTMLIFrameElement.prototype, "credentialless");
const previewFile = (path: string) => ({
path: `/workspace/${path}`, display_path: path, project_path: "/workspace",
language: "text", content: `Preview of ${path}`, size: 20, truncated: false,
@@ -141,6 +143,8 @@ describe("temporary chat navigation", () => {
afterEach(() => {
cleanup();
+ if (credentialless) Object.defineProperty(HTMLIFrameElement.prototype, "credentialless", credentialless);
+ else Reflect.deleteProperty(HTMLIFrameElement.prototype, "credentialless");
if (vi.isFakeTimers()) vi.clearAllTimers();
vi.useRealTimers();
vi.restoreAllMocks();
@@ -312,6 +316,8 @@ describe("temporary chat navigation", () => {
});
it("restores website targets per session, switches to files, and closes below menus", async () => {
+ // Exercise the working embed path; unsupported browsers do not offer it.
+ Object.defineProperty(HTMLIFrameElement.prototype, "credentialless", { configurable: true, value: false });
withFiles = true;
render(<App />);
await screen.findByRole("button", { name: "Temporary chat" });