test(webui): declare isolated preview support in navigation fixture
This commit is contained in:
1 parent
bcd0423ce3
commit
69a368fdf8
1 file changed
+6
@@ -1,3 +1,4 @@
|
|||||||
|
// @vitest-environment-options {"settings":{"disableIframePageLoading":true}}
|
||||||
import { act, cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
|
import { act, cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
|
||||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
@@ -10,6 +11,7 @@ import { canonicalThreadPayload } from "./thread-test-payload";
|
|||||||
|
|
||||||
let groupedTopics = false;
|
let groupedTopics = false;
|
||||||
let withFiles = false;
|
let withFiles = false;
|
||||||
|
const credentialless = Object.getOwnPropertyDescriptor(HTMLIFrameElement.prototype, "credentialless");
|
||||||
const previewFile = (path: string) => ({
|
const previewFile = (path: string) => ({
|
||||||
path: `/workspace/${path}`, display_path: path, project_path: "/workspace",
|
path: `/workspace/${path}`, display_path: path, project_path: "/workspace",
|
||||||
language: "text", content: `Preview of ${path}`, size: 20, truncated: false,
|
language: "text", content: `Preview of ${path}`, size: 20, truncated: false,
|
||||||
@@ -141,6 +143,8 @@ describe("temporary chat navigation", () => {
|
|||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
cleanup();
|
cleanup();
|
||||||
|
if (credentialless) Object.defineProperty(HTMLIFrameElement.prototype, "credentialless", credentialless);
|
||||||
|
else Reflect.deleteProperty(HTMLIFrameElement.prototype, "credentialless");
|
||||||
if (vi.isFakeTimers()) vi.clearAllTimers();
|
if (vi.isFakeTimers()) vi.clearAllTimers();
|
||||||
vi.useRealTimers();
|
vi.useRealTimers();
|
||||||
vi.restoreAllMocks();
|
vi.restoreAllMocks();
|
||||||
@@ -312,6 +316,8 @@ describe("temporary chat navigation", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("restores website targets per session, switches to files, and closes below menus", async () => {
|
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;
|
withFiles = true;
|
||||||
render(<App />);
|
render(<App />);
|
||||||
await screen.findByRole("button", { name: "Temporary chat" });
|
await screen.findByRole("button", { name: "Temporary chat" });
|
||||||
|
|||||||
Reference in new issue
Block a user