mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:40:44 +00:00
perf(test): shorten browser chrome timeout probes
This commit is contained in:
@@ -178,7 +178,7 @@ async function diagnoseCdpHealthCommand(
|
||||
: `WebSocket handshake did not complete within ${timeoutMs}ms`,
|
||||
});
|
||||
},
|
||||
Math.max(50, timeoutMs + 25),
|
||||
Math.max(1, timeoutMs + Math.min(25, timeoutMs)),
|
||||
);
|
||||
|
||||
ws.once("open", () => {
|
||||
|
||||
@@ -430,7 +430,7 @@ describe("browser chrome helpers", () => {
|
||||
// Simulate a stale command channel: WS opens but never responds to commands.
|
||||
onConnection: (wss) => wss.on("connection", (_ws) => {}),
|
||||
run: async (baseUrl) => {
|
||||
await expect(isChromeCdpReady(baseUrl, 300, 150)).resolves.toBe(false);
|
||||
await expect(isChromeCdpReady(baseUrl, 300, 5)).resolves.toBe(false);
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -440,7 +440,7 @@ describe("browser chrome helpers", () => {
|
||||
wsPath: "/devtools/browser/stale-diagnostic",
|
||||
onConnection: (wss) => wss.on("connection", (_ws) => {}),
|
||||
run: async (baseUrl) => {
|
||||
const diagnostic = await diagnoseChromeCdp(baseUrl, 300, 150);
|
||||
const diagnostic = await diagnoseChromeCdp(baseUrl, 300, 5);
|
||||
expect(diagnostic).toMatchObject({
|
||||
ok: false,
|
||||
code: "websocket_health_command_timeout",
|
||||
|
||||
@@ -433,7 +433,8 @@ export async function stopOpenClawChrome(
|
||||
if (!(await isChromeReachable(cdpUrlForPort(running.cdpPort), CHROME_STOP_PROBE_TIMEOUT_MS))) {
|
||||
return;
|
||||
}
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
const remainingMs = timeoutMs - (Date.now() - start);
|
||||
await new Promise((r) => setTimeout(r, Math.max(1, Math.min(100, remainingMs))));
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user