

























@@ -153,16 +153,15 @@ describe("browser remote profile fallback and attachOnly behavior", () => {
153153const opened = await remote.openTab("https://example.com");
154154155155expect(opened.targetId).toBe("T_REMOTE");
156-expect(createTargetViaCdp).toHaveBeenCalledWith(
157-expect.objectContaining({
158-cdpUrl: "https://1.1.1.1:9222/chrome?token=abc",
159-url: "https://example.com",
160-timeouts: {
161-httpTimeoutMs: 4321,
162-handshakeTimeoutMs: 8765,
163-},
164-}),
165-);
156+expect(createTargetViaCdp).toHaveBeenCalledWith({
157+cdpUrl: "https://1.1.1.1:9222/chrome?token=abc",
158+url: "https://example.com",
159+ssrfPolicy: { allowPrivateNetwork: true },
160+timeouts: {
161+httpTimeoutMs: 4321,
162+handshakeTimeoutMs: 8765,
163+},
164+});
166165});
167166168167it("uses remote-class tab-open timeouts for attachOnly loopback CDP profiles", async () => {
@@ -195,15 +194,15 @@ describe("browser remote profile fallback and attachOnly behavior", () => {
195194const opened = await ctx.forProfile("openclaw").openTab("https://example.com");
196195197196expect(opened.targetId).toBe("T_ATTACH");
198-expect(createTargetViaCdp).toHaveBeenCalledWith(
199-expect.objectContaining({
200- cdpUrl: "http://127.0.0.1:18800",
201- timeouts: {
202- httpTimeoutMs: 2345,
203- handshakeTimeoutMs: 6789,
204-},
205-}),
206-);
197+expect(createTargetViaCdp).toHaveBeenCalledWith({
198+cdpUrl: "http://127.0.0.1:18800",
199+url: "https://example.com",
200+ssrfPolicy: undefined,
201+timeouts: {
202+httpTimeoutMs: 2345,
203+handshakeTimeoutMs: 6789,
204+},
205+});
207206});
208207209208it("keeps managed loopback tab opens on local CDP defaults", async () => {
@@ -265,12 +264,15 @@ describe("browser remote profile fallback and attachOnly behavior", () => {
265264);
266265267266expect(Date.now() - startedAt).toBeLessThan(700);
268-expect(fetchMock).toHaveBeenCalledWith(
269-expect.stringContaining("/json/new"),
270-expect.objectContaining({
271-method: "PUT",
272-signal: expect.any(AbortSignal),
273-}),
267+expect(fetchMock).toHaveBeenCalledTimes(1);
268+const [fetchUrl, fetchInit] = fetchMock.mock.calls[0] ?? [];
269+expect(String(fetchUrl)).toBe(
270+"https://1.1.1.1:9222/chrome/json/new?token=abc&url=https%3A%2F%2Fexample.com",
274271);
272+expect(fetchInit.method).toBe("PUT");
273+expect(fetchInit.headers).toEqual({});
274+expect(fetchInit.redirect).toBe("manual");
275+expect(fetchInit.signal).toBeInstanceOf(AbortSignal);
276+expect(fetchInit.dispatcher).toBeDefined();
275277});
276278});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。