From 6da5eda4880a82baf1ee18d5d175c67d40b6c7ae Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 6 May 2026 05:43:44 +0100 Subject: [PATCH] test: avoid real waits in cdp and outbound tests --- .../browser/src/browser/cdp.internal.test.ts | 16 +++++++++++++ .../message-action-runner.core-send.test.ts | 23 ++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/extensions/browser/src/browser/cdp.internal.test.ts b/extensions/browser/src/browser/cdp.internal.test.ts index ac4fcd65757..d920c726f96 100644 --- a/extensions/browser/src/browser/cdp.internal.test.ts +++ b/extensions/browser/src/browser/cdp.internal.test.ts @@ -963,6 +963,22 @@ describe("cdp internal", () => { const msg = JSON.parse(rawDataToString(raw)) as { id?: number; method?: string }; if (msg.method === "Target.createTarget") { socket.send(JSON.stringify({ id: msg.id, result: { targetId: "T_BARE_WS" } })); + return; + } + if (msg.method === "Target.attachToTarget") { + socket.send(JSON.stringify({ id: msg.id, result: { sessionId: "S_BARE_WS" } })); + return; + } + if ( + msg.method === "Page.enable" || + msg.method === "Runtime.enable" || + msg.method === "Network.enable" || + msg.method === "DOM.enable" || + msg.method === "Accessibility.enable" || + msg.method === "Runtime.runIfWaitingForDebugger" || + msg.method === "Target.detachFromTarget" + ) { + socket.send(JSON.stringify({ id: msg.id, result: {} })); } }); }); diff --git a/src/infra/outbound/message-action-runner.core-send.test.ts b/src/infra/outbound/message-action-runner.core-send.test.ts index 0507df2da0e..64fef13de6a 100644 --- a/src/infra/outbound/message-action-runner.core-send.test.ts +++ b/src/infra/outbound/message-action-runner.core-send.test.ts @@ -125,7 +125,28 @@ describe("runMessageAction core send routing", () => { }); it("accepts Telegram numeric forum topic targets through plugin-owned grammar", async () => { - setActivePluginRegistry(createTestRegistry([])); + setActivePluginRegistry( + createTestRegistry([ + { + pluginId: "telegram", + source: "test", + plugin: createOutboundTestPlugin({ + id: "telegram", + outbound: { + deliveryMode: "direct", + sendText: vi.fn(), + }, + messaging: { + normalizeTarget: (raw) => + raw === "-1001234567890:topic:42" ? "telegram:-1001234567890:topic:42" : undefined, + targetResolver: { + looksLikeId: (raw) => raw === "-1001234567890:topic:42", + }, + }, + }), + }, + ]), + ); const result = await runMessageAction({ cfg: {