test: avoid real waits in cdp and outbound tests · openclaw/openclaw@6da5eda
steipete
·
2026-05-06
·
via Recent Commits to openclaw:main
File tree
extensions/browser/src/browser
| Original file line number | Diff line number | Diff line change |
|---|
@@ -963,6 +963,22 @@ describe("cdp internal", () => {
|
963 | 963 | const msg = JSON.parse(rawDataToString(raw)) as { id?: number; method?: string }; |
964 | 964 | if (msg.method === "Target.createTarget") { |
965 | 965 | socket.send(JSON.stringify({ id: msg.id, result: { targetId: "T_BARE_WS" } })); |
| 966 | +return; |
| 967 | +} |
| 968 | +if (msg.method === "Target.attachToTarget") { |
| 969 | +socket.send(JSON.stringify({ id: msg.id, result: { sessionId: "S_BARE_WS" } })); |
| 970 | +return; |
| 971 | +} |
| 972 | +if ( |
| 973 | +msg.method === "Page.enable" || |
| 974 | +msg.method === "Runtime.enable" || |
| 975 | +msg.method === "Network.enable" || |
| 976 | +msg.method === "DOM.enable" || |
| 977 | +msg.method === "Accessibility.enable" || |
| 978 | +msg.method === "Runtime.runIfWaitingForDebugger" || |
| 979 | +msg.method === "Target.detachFromTarget" |
| 980 | +) { |
| 981 | +socket.send(JSON.stringify({ id: msg.id, result: {} })); |
966 | 982 | } |
967 | 983 | }); |
968 | 984 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -125,7 +125,28 @@ describe("runMessageAction core send routing", () => {
|
125 | 125 | }); |
126 | 126 | |
127 | 127 | it("accepts Telegram numeric forum topic targets through plugin-owned grammar", async () => { |
128 | | -setActivePluginRegistry(createTestRegistry([])); |
| 128 | +setActivePluginRegistry( |
| 129 | +createTestRegistry([ |
| 130 | +{ |
| 131 | +pluginId: "telegram", |
| 132 | +source: "test", |
| 133 | +plugin: createOutboundTestPlugin({ |
| 134 | +id: "telegram", |
| 135 | +outbound: { |
| 136 | +deliveryMode: "direct", |
| 137 | +sendText: vi.fn(), |
| 138 | +}, |
| 139 | +messaging: { |
| 140 | +normalizeTarget: (raw) => |
| 141 | +raw === "-1001234567890:topic:42" ? "telegram:-1001234567890:topic:42" : undefined, |
| 142 | +targetResolver: { |
| 143 | +looksLikeId: (raw) => raw === "-1001234567890:topic:42", |
| 144 | +}, |
| 145 | +}, |
| 146 | +}), |
| 147 | +}, |
| 148 | +]), |
| 149 | +); |
129 | 150 | |
130 | 151 | const result = await runMessageAction({ |
131 | 152 | cfg: { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。