Skip to content

An agentic browser harness: an AI side panel & orb in your own logged-in Chrome, Edge, Arc, Brave or even Firefox run by the agent/subscription you already use (Claude Code, Codex, Antigravity). Free, open source, no API key. Also an MCP server.

test(daemon): wait for a drifted fake browser to have answered for its manifest before reading the list it is served, because under coverage the read could land before the daemon had adopted it

Shahriarafd272af1328
diff --git a/src/daemon/test/browsers.test.ts b/src/daemon/test/browsers.test.ts
index 981ffe2..39e7c8c 100644
--- a/src/daemon/test/browsers.test.ts
+++ b/src/daemon/test/browsers.test.ts
@@ -197,7 +197,8 @@ describe('the tool list a caller is offered', () => {
const drifted: Profile = { ...brave, tools: [{ name: 'page.onlyHere', description: 'from a build we never saw', inputSchema: {} }] };
const odd = await pair(drifted);
const second = await pair(chrome);
- await settled();
+ // The daemon adopts the list once the reply reaches it; the pong behind `focus` proves it has.
+ await odd.described;
await odd.focus();
const viaDrifted = await control();
const [oddTools, oddStatus] = [await offeredTo(viaDrifted), await viaDrifted.status()];
diff --git a/src/daemon/test/fake-browser.ts b/src/daemon/test/fake-browser.ts
index 5f29f49..6db8577 100644
--- a/src/daemon/test/fake-browser.ts
+++ b/src/daemon/test/fake-browser.ts
@@ -23,6 +23,9 @@ const EXTENSION_VERSION = '0.0.0-test';
export class FakeBrowser {
readonly invoked: string[] = [];
readonly closed: Promise<string>;
+ /** Resolves once this browser has answered the daemon's request for its manifest — a drifted build is asked right behind the welcome. */
+ readonly described: Promise<void>;
+ private tellDescribed!: () => void;
private readonly pongs = new Map<string, () => void>();
private constructor(
@@ -32,6 +35,7 @@ export class FakeBrowser {
backlog: (SocketFrame | null)[],
) {
this.closed = new Promise((resolve) => socket.once('close', (_code, reason) => resolve(String(reason))));
+ this.described = new Promise((resolve) => (this.tellDescribed = resolve));
socket.on('message', (raw) => this.receive(parseFrame(String(raw))));
for (const frame of backlog) this.receive(frame);
}
@@ -94,7 +98,10 @@ export class FakeBrowser {
this.pongs.get(frame.id)?.();
this.pongs.delete(frame.id);
}
- if (frame?.t === 'describe') return send(this.socket, { t: 'manifest', id: frame.id, tools: toolsOf(this.profile) });
+ if (frame?.t === 'describe') {
+ send(this.socket, { t: 'manifest', id: frame.id, tools: toolsOf(this.profile) });
+ return this.tellDescribed();
+ }
if (frame?.t !== 'invoke') return;
this.invoked.push(frame.action);
send(this.socket, { t: 'result', id: frame.id, result: { ok: true, data: { answeredBy: this.profile.installId } } });