Skip to content

The fastest browser for AI agents to run browser automation, built for sharing your logged-in browser state with your AI agents, like Codex or Claude Code, without disturbing you. Zero cost, zero config.

test(ego-browser): cover bare Meta input isolation

0x08b1b52a1f869
diff --git a/package/ego-browser/scripts/real-browser-e2e/cases/index.mjs b/package/ego-browser/scripts/real-browser-e2e/cases/index.mjs
index 3d2981d..2cb1985 100644
--- a/package/ego-browser/scripts/real-browser-e2e/cases/index.mjs
+++ b/package/ego-browser/scripts/real-browser-e2e/cases/index.mjs
@@ -12,6 +12,7 @@ import {
} from "./pointer.mjs";
import { keyboardCase } from "./keyboard.mjs";
import { keyboardRegressionCase } from "./keyboard-regression.mjs";
+import { macosInputRegressionCase } from "./macos-input-regression.mjs";
import {
cdpJsHelpCase,
fetchHelpersCase,
@@ -40,6 +41,10 @@ export const e2eCases = [
},
{ name: "keyboard and file helpers", body: keyboardCase },
{ name: "keyboard regression", body: keyboardRegressionCase },
+ {
+ name: "macOS bare Meta input isolation",
+ body: macosInputRegressionCase,
+ },
{ name: "wait helpers", body: waitHelpersCase },
{ name: "fetch helpers", body: fetchHelpersCase },
{ name: "cdp js help", body: cdpJsHelpCase },
diff --git a/package/ego-browser/scripts/real-browser-e2e/cases/macos-input-regression.mjs b/package/ego-browser/scripts/real-browser-e2e/cases/macos-input-regression.mjs
new file mode 100644
index 0000000..1a50406
--- /dev/null
+++ b/package/ego-browser/scripts/real-browser-e2e/cases/macos-input-regression.mjs
@@ -0,0 +1,69 @@
+export function macosInputRegressionCase() {
+ return `
+ assertEqual(process.platform, "darwin", "bare Meta input isolation runs on macOS");
+
+ const { execFile } = await import("node:child_process");
+ const { promisify } = await import("node:util");
+ const execFileAsync = promisify(execFile);
+
+ async function isSystemInformationRunning() {
+ const { stdout } = await execFileAsync("/usr/bin/lsappinfo", ["list"]);
+ return /bundleID="com\\.apple\\.SystemProfiler"/.test(stdout);
+ }
+
+ await taskSpaces.useOrCreate(taskName);
+ await resetHome();
+
+ const systemInformationWasRunning = await isSystemInformationRunning();
+ assertEqual(
+ systemInformationWasRunning,
+ false,
+ "System Information is closed before the bare Meta input probe"
+ );
+
+ let systemInformationLaunched = false;
+ try {
+ await cdp("Input.dispatchKeyEvent", {
+ type: "keyDown",
+ key: "Meta",
+ code: "MetaLeft",
+ windowsVirtualKeyCode: 91,
+ nativeVirtualKeyCode: 55,
+ metaKey: true,
+ modifiers: 4,
+ });
+ await cdp("Input.dispatchKeyEvent", {
+ type: "keyUp",
+ key: "Meta",
+ code: "MetaLeft",
+ windowsVirtualKeyCode: 91,
+ nativeVirtualKeyCode: 55,
+ metaKey: false,
+ modifiers: 0,
+ });
+
+ const deadline = Date.now() + 2000;
+ while (Date.now() <= deadline) {
+ systemInformationLaunched = await isSystemInformationRunning();
+ if (systemInformationLaunched) break;
+ await page.waitForTimeout(100);
+ }
+ } finally {
+ systemInformationLaunched =
+ systemInformationLaunched ||
+ (await isSystemInformationRunning().catch(() => false));
+ if (!systemInformationWasRunning && systemInformationLaunched) {
+ await execFileAsync("/usr/bin/osascript", [
+ "-e",
+ 'tell application id "com.apple.SystemProfiler" to quit',
+ ]);
+ }
+ }
+
+ assertEqual(
+ systemInformationLaunched,
+ false,
+ "raw Meta CDP input does not launch macOS System Information"
+ );
+ `;
+}