Skip to content

Commit a762af1

Browse files
committed
test(browser): answer CDP launch mock probe
1 parent 26846c9 commit a762af1

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

extensions/browser/src/browser/chrome.internal.test.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,20 @@ async function withMockChromeCdpServer(params: {
158158
} else {
159159
wss.on("connection", (ws) => {
160160
ws.on("message", (raw) => {
161-
const msg = JSON.parse(rawDataToString(raw)) as { id?: number };
162-
if (msg.id === 1) {
163-
ws.send(JSON.stringify({ id: 1, result: { product: "Chrome/Mock" } }));
161+
const message = JSON.parse(rawDataToString(raw)) as {
162+
id?: unknown;
163+
method?: unknown;
164+
};
165+
if (message.method === "Browser.getVersion" && typeof message.id === "number") {
166+
ws.send(
167+
JSON.stringify({
168+
id: message.id,
169+
result: {
170+
product: "Chrome/Mock",
171+
userAgent: "OpenClawTest",
172+
},
173+
}),
174+
);
164175
}
165176
});
166177
});

0 commit comments

Comments
 (0)