* Browser: replace extension path with Chrome MCP * Browser: clarify relay stub and doctor checks * Docs: mark browser MCP migration as breaking * Browser: reject unsupported profile drivers * Browser: accept clawd alias on profile create * Doctor: narrow legacy browser driver migration
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
import { withPageScopedCdpClient } from "./pw-session.page-cdp.js";
|
|
|
|
describe("pw-session page-scoped CDP client", () => {
|
|
beforeEach(() => {
|
|
vi.clearAllMocks();
|
|
});
|
|
|
|
it("uses Playwright page sessions", async () => {
|
|
const sessionSend = vi.fn(async () => ({ ok: true }));
|
|
const sessionDetach = vi.fn(async () => {});
|
|
const newCDPSession = vi.fn(async () => ({
|
|
send: sessionSend,
|
|
detach: sessionDetach,
|
|
}));
|
|
const page = {
|
|
context: () => ({
|
|
newCDPSession,
|
|
}),
|
|
};
|
|
|
|
await withPageScopedCdpClient({
|
|
cdpUrl: "http://127.0.0.1:9222",
|
|
page: page as never,
|
|
targetId: "tab-1",
|
|
fn: async (pageSend) => {
|
|
await pageSend("Emulation.setLocaleOverride", { locale: "en-US" });
|
|
},
|
|
});
|
|
|
|
expect(newCDPSession).toHaveBeenCalledWith(page);
|
|
expect(sessionSend).toHaveBeenCalledWith("Emulation.setLocaleOverride", { locale: "en-US" });
|
|
expect(sessionDetach).toHaveBeenCalledTimes(1);
|
|
});
|
|
});
|