Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

Use shared Electron harness for macOS tests

Francesco Bonacci2e1a89ce5f91
diff --git a/libs/cua-driver/rust/tests/integration/v2/conftest.py b/libs/cua-driver/rust/tests/integration/v2/conftest.py
index 47a163f35e..8580c8f429 100644
--- a/libs/cua-driver/rust/tests/integration/v2/conftest.py
+++ b/libs/cua-driver/rust/tests/integration/v2/conftest.py
@@ -7,7 +7,7 @@ Fixtures:
ux_guard → UXMonitor — started before the test, assert_clean() after
html_server → str — base URL of a local HTTP server serving assets/
tauri_app → (proc, pid, base_url) — Tauri desktop-test-app
- electron_app → (proc, pid, base_url) — Electron desktop-test-app
+ electron_app → (proc, pid, base_url) — repo-local Electron harness
"""
from __future__ import annotations
@@ -17,10 +17,8 @@ import subprocess
import sys
import time
import threading
-import zipfile
import urllib.request
from http.server import HTTPServer, SimpleHTTPRequestHandler
-from typing import Optional
import pytest
@@ -29,6 +27,8 @@ _INTEG_DIR = os.path.dirname(_HERE)
_TESTS_DIR = os.path.dirname(_INTEG_DIR)
_DRIVER_RS_ROOT = os.path.dirname(_TESTS_DIR)
_LIBS_ROOT = os.path.dirname(_DRIVER_RS_ROOT)
+_CUA_DRIVER_ROOT = os.path.join(_LIBS_ROOT, "cua-driver")
+_TEST_HARNESS_ROOT = os.path.join(_CUA_DRIVER_ROOT, "test-harness")
sys.path.insert(0, _INTEG_DIR)
from driver_client import default_binary_path # noqa: E402
@@ -39,7 +39,7 @@ _FOCUS_APP_DIR = os.path.join(_LIBS_ROOT, "cua-driver", "Tests", "FocusMonitorAp
_FOCUS_APP_BUNDLE = os.path.join(_FOCUS_APP_DIR, "FocusMonitorApp.app")
_FOCUS_APP_EXE = os.path.join(_FOCUS_APP_BUNDLE, "Contents", "MacOS", "FocusMonitorApp")
-# Tauri / Electron app download config
+# Tauri app download config
# Tauri releases a raw Mach-O binary (no .app bundle, no zip).
_TAURI_VERSION = "v0.2.2"
_TAURI_BINARY_NAME = "desktop-test-app-macos-arm64"
@@ -50,14 +50,20 @@ _TAURI_DOWNLOAD_URL = (
_TAURI_APP_DIR = os.path.join(_HERE, "assets", "tauri")
_TAURI_BINARY_PATH = os.path.join(_TAURI_APP_DIR, _TAURI_BINARY_NAME)
-# Electron releases a zip containing a proper .app bundle.
-_ELECTRON_VERSION = "v0.1.0"
-_ELECTRON_APP_NAME = "desktop-test-app-electron.app"
-_ELECTRON_DOWNLOAD_URL = (
- f"https://github.com/trycua/desktop-test-app-electron/releases/download/"
- f"{_ELECTRON_VERSION}/desktop-test-app-electron-{_ELECTRON_VERSION[1:]}-arm64-mac.zip"
+# Electron is built from the repo-local shared harness rather than downloaded.
+_ELECTRON_HARNESS_DIR = os.path.join(
+ _TEST_HARNESS_ROOT, "apps", "cross-platform", "electron"
+)
+_ELECTRON_BUILD_SCRIPT = os.path.join(_ELECTRON_HARNESS_DIR, "build.sh")
+_ELECTRON_APP_BUNDLE = os.path.join(
+ _DRIVER_RS_ROOT,
+ "test-apps",
+ "harness-electron",
+ "CuaTestHarness.Electron.app",
+)
+_ELECTRON_APP_EXE = os.path.join(
+ _ELECTRON_APP_BUNDLE, "Contents", "MacOS", "Electron"
)
-_ELECTRON_APP_DIR = os.path.join(_HERE, "assets", "electron")
# ── binary ────────────────────────────────────────────────────────────────────
@@ -197,25 +203,6 @@ def html_server():
# ── Tauri / Electron helpers ──────────────────────────────────────────────────
-def _download_and_extract(url: str, dest_dir: str, marker_path: str) -> None:
- """Download a zip and extract it; skip if marker_path already exists.
-
- Uses the system `unzip` command to preserve symlinks (Python's zipfile
- module does not handle macOS zip symlinks correctly, which breaks
- framework bundles like Electron Framework.framework).
- """
- if os.path.exists(marker_path):
- return
- os.makedirs(dest_dir, exist_ok=True)
- zip_path = os.path.join(dest_dir, "_download.zip")
- print(f"\n Downloading {url} …")
- urllib.request.urlretrieve(url, zip_path)
- # Use system unzip to preserve symlinks and executable bits.
- subprocess.run(["unzip", "-q", "-o", zip_path, "-d", dest_dir], check=True)
- # Remove quarantine attribute (Gatekeeper blocks downloaded apps).
- subprocess.run(["xattr", "-cr", dest_dir], check=False)
- os.remove(zip_path)
-
def _download_binary(url: str, dest_path: str) -> None:
"""Download a raw binary; skip if it already exists."""
@@ -263,45 +250,38 @@ def tauri_app():
# ── Electron app ──────────────────────────────────────────────────────────────
@pytest.fixture(scope="session")
-def electron_app(html_server):
- """Download, launch, and yield (proc, pid, base_url) for the Electron test app.
+def electron_app():
+ """Build, launch, and yield (proc, pid, base_url) for the Electron harness.
- The Electron release ships a zip containing a proper .app bundle.
- We launch the binary directly (not via `open -a`) so that CUA_LOAD_URL
- env var is inherited by the app process.
+ This uses test-harness/apps/cross-platform/electron, the same shared DOM
+ harness used by the Rust harness tests. It does not download a prebuilt
+ Electron app release.
"""
- app_path = os.path.join(_ELECTRON_APP_DIR, _ELECTRON_APP_NAME)
- _download_and_extract(_ELECTRON_DOWNLOAD_URL, _ELECTRON_APP_DIR, app_path)
-
- if not os.path.exists(app_path):
- pytest.skip("Electron app not found after download")
-
- test_page_url = f"{html_server}/test_page.html"
-
- subprocess.run(["pkill", "-f", "desktop-test-app-electron"], check=False)
+ if not os.path.exists(_ELECTRON_APP_EXE):
+ if not os.path.exists(_ELECTRON_BUILD_SCRIPT):
+ pytest.skip("repo-local Electron harness build script not found")
+ try:
+ subprocess.run([_ELECTRON_BUILD_SCRIPT], check=True)
+ except (OSError, subprocess.CalledProcessError) as e:
+ pytest.skip(f"Electron harness build failed: {e}")
+
+ if not os.path.exists(_ELECTRON_APP_EXE):
+ pytest.skip("Electron harness app not found after build")
+
+ subprocess.run(["pkill", "-f", "CuaTestHarness.Electron"], check=False)
+ subprocess.run(["pkill", "-f", "Electron.app/Contents/MacOS/Electron"], check=False)
time.sleep(0.5)
- # Set CUA_LOAD_URL via launchctl so `open -a` picks it up.
- subprocess.run(
- ["launchctl", "setenv", "CUA_LOAD_URL", test_page_url],
- check=False,
- )
-
proc = subprocess.Popen(
- ["open", "-a", app_path, "--args", "--force-renderer-accessibility"],
+ [_ELECTRON_APP_EXE, "--force-renderer-accessibility"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
time.sleep(4.0) # Electron takes a bit longer with AX enabled
- # Get the real pid of the launched app.
- out = subprocess.run(
- ["pgrep", "-f", "desktop-test-app-electron"],
- capture_output=True, text=True,
- ).stdout.strip()
- pid = int(out.split("\n")[0]) if out else 0
+ pid = proc.pid
- base_url = "http://localhost:6769"
+ base_url = "file://shared-web-harness"
yield proc, pid, base_url
proc.terminate()
@@ -309,4 +289,5 @@ def electron_app(html_server):
proc.wait(timeout=5)
except subprocess.TimeoutExpired:
proc.kill()
- subprocess.run(["pkill", "-f", "desktop-test-app-electron"], check=False)
+ subprocess.run(["pkill", "-f", "CuaTestHarness.Electron"], check=False)
+ subprocess.run(["pkill", "-f", "Electron.app/Contents/MacOS/Electron"], check=False)
diff --git a/libs/cua-driver/rust/tests/integration/v2/test_electron.py b/libs/cua-driver/rust/tests/integration/v2/test_electron.py
index 5c9818ceca..e6b9a80b20 100644
--- a/libs/cua-driver/rust/tests/integration/v2/test_electron.py
+++ b/libs/cua-driver/rust/tests/integration/v2/test_electron.py
@@ -1,10 +1,8 @@
-"""Electron desktop-test-app background automation tests — v2 harness.
+"""Electron shared-harness background automation tests — v2 harness.
-The Electron test app (v0.1.0) loads CUA_LOAD_URL in a Chromium window
-and exposes an HTTP API on port 6769 for event logging.
-
-We load test_page.html (served by html_server fixture) which has:
- button, text input, checkbox, select, textarea, link, canvas.
+The Electron test app is built from test-harness/apps/cross-platform/electron
+and loads test-harness/shared/web/index.html, the same DOM used by the WebView2
+and Rust Electron harness tests.
Run: python3 -m pytest test_electron.py -v
"""
@@ -18,37 +16,8 @@ import os
import pytest
-try:
- import requests as _requests
- _REQUESTS_AVAILABLE = True
-except ImportError:
- _REQUESTS_AVAILABLE = False
-
_HERE = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, _HERE)
-from harness.driver import Driver
-from harness import tree as Tree
-
-_ELECTRON_API = "http://localhost:6769"
-
-
-def _http_events(base_url: str = _ELECTRON_API) -> list[dict]:
- if not _REQUESTS_AVAILABLE:
- return []
- try:
- resp = _requests.get(f"{base_url}/events", timeout=2)
- return resp.json() if resp.ok else []
- except Exception:
- return []
-
-
-def _http_reset(base_url: str = _ELECTRON_API) -> None:
- if not _REQUESTS_AVAILABLE:
- return
- try:
- _requests.post(f"{base_url}/reset", timeout=2)
- except Exception:
- pass
@pytest.fixture(autouse=True)
@@ -66,31 +35,29 @@ def _reactivate_focus(focus_monitor):
class TestElectronButton:
def test_click_increments_counter(self, driver, electron_app, ux_guard):
- _, pid, base_url = electron_app
+ _, pid, _ = electron_app
if pid == 0:
pytest.skip("Electron app pid not found")
- _http_reset(base_url)
wid = driver.find_window(pid)
- before = driver.get_window_state(pid, wid, query="Click Me")
- idx = before.find_element("Click Me")
- assert idx is not None, f"'Click Me' not found:\n{before.tree}"
+ before = driver.get_window_state(pid, wid, query="Increment")
+ idx = before.find_button("Increment") or before.find_element("Increment")
+ assert idx is not None, f"'Increment' not found:\n{before.tree}"
driver.click(pid, wid, element_index=idx)
time.sleep(0.5)
after = driver.get_window_state(pid, wid)
- assert after.has_text("clicks: 1"), f"Counter not incremented:\n{after.tree}"
+ assert after.has_text("counter=1"), f"Counter not incremented:\n{after.tree}"
class TestElectronTextInput:
def test_type_text(self, driver, electron_app, ux_guard):
- _, pid, base_url = electron_app
+ _, pid, _ = electron_app
if pid == 0:
pytest.skip("Electron app pid not found")
- _http_reset(base_url)
wid = driver.find_window(pid)
before = driver.get_window_state(pid, wid)
@@ -109,10 +76,7 @@ class TestElectronTextInput:
"delay_ms": 30,
})
except Exception as e:
- events = _http_events(base_url)
- key_events = [ev for ev in events if ev.get("type") in ("keydown", "keypress", "input")]
print(f"\n driver raised {type(e).__name__}: {e}")
- print(f" key events before crash: {len(key_events)}")
pytest.skip(f"Driver crashed interacting with Electron text field (known issue): {e}")
time.sleep(1.5)
@@ -135,61 +99,42 @@ class TestElectronTextInput:
if after is None or not after.tree:
pytest.skip("AX tree unavailable after typing (Electron AX rebuild timeout)")
- print(f"\n after tree length: {len(after.tree)}, has text: {after.has_text('hello electron')}")
- assert after.has_text("hello electron"), f"Text not in AX tree:\n{after.tree[:500]}"
+ print(f"\n after tree length: {len(after.tree)}, has mirror: {after.has_text('mirror=hello electron')}")
+ assert after.has_text("mirror=hello electron"), f"Text not in AX tree:\n{after.tree[:500]}"
-class TestElectronCanvas:
- def test_canvas_pixel_click_no_focus_steal(self, driver, electron_app, ux_guard):
- """Send a pixel click to the canvas without stealing focus.
-
- Background Chromium windows may not render DOM changes from synthetic
- pixel clicks. We only assert the click was delivered without error.
- """
- _, pid, base_url = electron_app
+class TestElectronClickTarget:
+ def test_click_target_no_focus_steal(self, driver, electron_app, ux_guard):
+ """Click the shared harness click target without stealing focus."""
+ _, pid, _ = electron_app
if pid == 0:
pytest.skip("Electron app pid not found")
- # Retry until we get a screenshot (AX tree may be rebuilding after previous test).
- mid = None
- for attempt in range(5):
- wid = driver.find_window(pid)
- mid = driver.get_window_state(pid, wid)
- if mid.screenshot_b64:
- break
- print(f"\n No screenshot (attempt {attempt+1}/5), retrying …")
- time.sleep(1.0)
- assert mid.screenshot_b64, "No screenshot after 5 retries"
-
- from harness.cv import decode, diff_ratio
- before_img = decode(mid.screenshot_b64)
-
- x = mid.screenshot_width // 2
- y = int(mid.screenshot_height * 0.88)
- print(f"\n electron canvas click at ({x}, {y})")
+ wid = driver.find_window(pid)
+ before = driver.get_window_state(pid, wid, query="Click target")
+ idx = before.find_element("Click target")
+ assert idx is not None, f"'Click target' not found:\n{before.tree}"
- result = driver.click(pid, wid, x=x, y=y)
+ result = driver.click(pid, wid, element_index=idx)
time.sleep(0.5)
after = driver.get_window_state(pid, wid)
- after_img = decode(after.screenshot_b64)
- ratio = diff_ratio(before_img, after_img)
- canvas_clicked = "canvas: clicked" in after.tree
- print(f" electron canvas diff_ratio: {ratio:.4f}, JS fired: {canvas_clicked}")
+ print(f" electron click target tree contains last_action: {after.has_text('last_action=left_click')}")
assert result is not None, "click returned None"
+ assert after.has_text("last_action=left_click"), f"Click target not updated:\n{after.tree}"
# UX assertions via ux_guard teardown
class TestElectronNoFocusSteal:
def test_interactions_no_focus_steal(self, driver, electron_app, ux_guard):
- _, pid, base_url = electron_app
+ _, pid, _ = electron_app
if pid == 0:
pytest.skip("Electron app pid not found")
wid = driver.find_window(pid)
- before = driver.get_window_state(pid, wid, query="Click Me")
- idx = before.find_element("Click Me")
+ before = driver.get_window_state(pid, wid, query="Increment")
+ idx = before.find_button("Increment") or before.find_element("Increment")
if idx is not None:
driver.click(pid, wid, element_index=idx)
time.sleep(0.3)
diff --git a/libs/cua-driver/test-harness/README.md b/libs/cua-driver/test-harness/README.md
index fb68d7926f..340b275263 100644
--- a/libs/cua-driver/test-harness/README.md
+++ b/libs/cua-driver/test-harness/README.md
@@ -24,7 +24,7 @@ test-harness/
│ ├── winui3/ # CuaTestHarness.WinUI3 (.NET 8 WinUI3 unpackaged)
│ └── webview2/ # CuaTestHarness.WebView (WPF + Microsoft.Edge.WebView2)
├── build/ # host-OS build scripts (publish into ../rust/test-apps/)
-│ ├── macos.sh # builds appkit + swiftui
+│ ├── macos.sh # builds appkit + swiftui + wkwebview + electron
│ └── windows.ps1 # builds wpf + winui3 + webview2 + electron
└── smoke/ # host-OS per-tool CLI smoke runners
├── macos.sh # spawns appkit harness, iterates every tool
@@ -111,11 +111,12 @@ macOS:
## Build
-macOS (requires Xcode CLT for `xcrun swiftc`):
+macOS (requires Xcode CLT for `xcrun swiftc`; Node.js + npm for Electron):
```bash
-libs/cua-driver/test-harness/build/macos.sh # both apps
-libs/cua-driver/test-harness/build/macos.sh --skip swiftui # AppKit only
+libs/cua-driver/test-harness/build/macos.sh # all macOS-runnable harnesses
+libs/cua-driver/test-harness/build/macos.sh --skip swiftui # skip one target
+libs/cua-driver/test-harness/build/macos.sh --skip electron # skip Electron / npm
libs/cua-driver/test-harness/build/macos.sh --clean # nuke stage dirs first
```
@@ -127,6 +128,13 @@ cd libs\cua-driver\test-harness
.\build\windows.ps1 -Skip winui3 # skip a specific one
```
+Linux (requires Node.js + npm for the Electron app):
+
+```bash
+cd libs/cua-driver/test-harness/apps/cross-platform/electron
+./build.sh
+```
+
## Run the integration tests
```bash
diff --git a/libs/cua-driver/test-harness/apps/cross-platform/electron/build.sh b/libs/cua-driver/test-harness/apps/cross-platform/electron/build.sh
index 6e23eb1a0a..4c8037c20c 100755
--- a/libs/cua-driver/test-harness/apps/cross-platform/electron/build.sh
+++ b/libs/cua-driver/test-harness/apps/cross-platform/electron/build.sh
@@ -1,15 +1,14 @@
#!/usr/bin/env bash
-# build.sh — Linux analogue of build.ps1: stage the Electron test harness for
-# cua-driver tests / modality recordings.
+# build.sh — stage the Electron test harness for cua-driver tests / modality
+# recordings on Linux and macOS.
#
# On Linux we run the app straight from node_modules (electron's prebuilt
# linux-x64 binary) rather than packaging — the modality recorder launches it
# with `electron . --no-sandbox --disable-gpu --force-renderer-accessibility`
# under Xvfb + a dbus session so Chromium's web-AX tree registers on AT-SPI.
-# This script just makes sure web/ is staged and the electron runtime is
-# installed, then (optionally) stages a flat folder with the binary renamed to
-# CuaTestHarness.Electron for a deterministic process name — parity with
-# build.ps1's output under rust/test-apps/harness-electron/.
+#
+# On macOS we stage Electron.app as CuaTestHarness.Electron.app and place the
+# same app resources under Contents/Resources/app.
set -euo pipefail
elecDir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -18,9 +17,10 @@ appsDir="$(dirname "$crossDir")"
harnessDir="$(dirname "$appsDir")"
cuaDriverDir="$(dirname "$harnessDir")"
outDir="$cuaDriverDir/rust/test-apps/harness-electron"
+platform="$(uname -s)"
if ! command -v npm >/dev/null 2>&1; then
- echo "[ERROR] npm not on PATH. Install Node.js first (e.g. sudo apt-get install -y nodejs npm)." >&2
+ echo "[ERROR] npm not on PATH. Install Node.js first." >&2
exit 1
fi
@@ -30,31 +30,80 @@ cd "$elecDir"
mkdir -p "$elecDir/web"
cp -r "$harnessDir/shared/web/." "$elecDir/web/"
-# install the electron runtime (downloads the linux-x64 prebuilt binary)
-if [ ! -x "$elecDir/node_modules/electron/dist/electron" ]; then
+# install the Electron runtime for the current platform
+if [ "$platform" = "Darwin" ]; then
+ electronBin="$elecDir/node_modules/electron/dist/Electron.app/Contents/MacOS/Electron"
+else
+ electronBin="$elecDir/node_modules/electron/dist/electron"
+fi
+if [ ! -x "$electronBin" ]; then
echo "[INSTALL] npm install (first run)..."
npm install --silent
fi
-electronBin="$elecDir/node_modules/electron/dist/electron"
-[ -x "$electronBin" ] || { echo "[ERROR] electron binary missing after npm install" >&2; exit 1; }
-# optional flat stage with a deterministic exe name (parity with build.ps1)
-echo "[STAGE] Copying electron runtime + app to $outDir ..."
rm -rf "$outDir"
mkdir -p "$outDir"
-cp -r "$elecDir/node_modules/electron/dist/." "$outDir/"
-appDir="$outDir/resources/app"
-mkdir -p "$appDir"
-cp "$elecDir/main.js" "$appDir/"
-cp "$elecDir/package.json" "$appDir/"
-cp -r "$elecDir/web" "$appDir/web"
-mv "$outDir/electron" "$outDir/CuaTestHarness.Electron"
-chmod +x "$outDir/CuaTestHarness.Electron"
-
-cat <<EOF
+
+if [ "$platform" = "Darwin" ]; then
+ electronApp="$elecDir/node_modules/electron/dist/Electron.app"
+ electronBin="$electronApp/Contents/MacOS/Electron"
+ [ -x "$electronBin" ] || { echo "[ERROR] Electron.app missing after npm install" >&2; exit 1; }
+
+ bundle="$outDir/CuaTestHarness.Electron.app"
+ echo "[STAGE] Copying Electron.app + app resources to $bundle ..."
+ cp -R "$electronApp" "$bundle"
+ appDir="$bundle/Contents/Resources/app"
+ rm -rf "$appDir"
+ mkdir -p "$appDir"
+ cp "$elecDir/main.js" "$appDir/"
+ cp "$elecDir/package.json" "$appDir/"
+ cp -R "$elecDir/web" "$appDir/web"
+
+ cat > "$bundle/Contents/Info.plist" <<'PLIST'
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
+ "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleExecutable</key><string>Electron</string>
+ <key>CFBundleIdentifier</key><string>com.trycua.harness.electron</string>
+ <key>CFBundleName</key><string>CuaTestHarness.Electron</string>
+ <key>CFBundleDisplayName</key><string>CuaTestHarness.Electron</string>
+ <key>CFBundlePackageType</key><string>APPL</string>
+ <key>CFBundleShortVersionString</key><string>1.0.0</string>
+ <key>CFBundleVersion</key><string>1</string>
+ <key>LSMinimumSystemVersion</key><string>13.0</string>
+ <key>NSHighResolutionCapable</key><true/>
+</dict>
+</plist>
+PLIST
+ xattr -cr "$bundle" 2>/dev/null || true
+ chmod +x "$bundle/Contents/MacOS/Electron"
+ cat <<EOF
+[OK] Staged: $bundle
+[NOTE] Launch with:
+ "$bundle/Contents/MacOS/Electron" --force-renderer-accessibility
+EOF
+else
+ electronBin="$elecDir/node_modules/electron/dist/electron"
+ [ -x "$electronBin" ] || { echo "[ERROR] electron binary missing after npm install" >&2; exit 1; }
+
+ # flat stage with a deterministic exe name (parity with build.ps1)
+ echo "[STAGE] Copying electron runtime + app to $outDir ..."
+ cp -r "$elecDir/node_modules/electron/dist/." "$outDir/"
+ appDir="$outDir/resources/app"
+ mkdir -p "$appDir"
+ cp "$elecDir/main.js" "$appDir/"
+ cp "$elecDir/package.json" "$appDir/"
+ cp -r "$elecDir/web" "$appDir/web"
+ mv "$outDir/electron" "$outDir/CuaTestHarness.Electron"
+ chmod +x "$outDir/CuaTestHarness.Electron"
+
+ cat <<EOF
[OK] Staged: $outDir/CuaTestHarness.Electron
[NOTE] Launch under Xvfb + dbus with the Chromium flags Linux needs:
CuaTestHarness.Electron --no-sandbox --disable-gpu --force-renderer-accessibility
(--force-renderer-accessibility is what populates the web-AX tree on AT-SPI.)
Or run in place from this dir: npm run start:linux
EOF
+fi
diff --git a/libs/cua-driver/test-harness/build/macos.sh b/libs/cua-driver/test-harness/build/macos.sh
index 0caa9fb5d7..1bd8e0a756 100755
--- a/libs/cua-driver/test-harness/build/macos.sh
+++ b/libs/cua-driver/test-harness/build/macos.sh
@@ -1,13 +1,13 @@
#!/usr/bin/env bash
-# Build the macOS test-harness apps (AppKit + SwiftUI + WKWebView) into .app
-# bundles under ../../rust/test-apps/harness-{appkit,swiftui,wkwebview}/ —
+# Build the macOS test-harness apps (AppKit + SwiftUI + WKWebView + Electron)
+# into app bundles under ../../rust/test-apps/harness-* —
# matching the convention used by windows.ps1 for the Windows WPF + WinUI3 +
-# WebView2 apps. WKWebView is the macOS analogue of the Windows WebView2
-# harness: an Apple-WebKit (NOT Chromium) host loading the shared web DOM.
+# WebView2 apps. WKWebView is the Apple-WebKit host; Electron is the shared
+# Chromium harness used across Windows, Linux, and macOS.
#
# Usage:
-# ./macos.sh # build all three
-# ./macos.sh --skip swiftui # skip one target (appkit|swiftui|wkwebview)
+# ./macos.sh # build all macOS-runnable harnesses
+# ./macos.sh --skip swiftui # skip one target (appkit|swiftui|wkwebview|electron)
# ./macos.sh --clean # remove staged outputs first
set -euo pipefail
@@ -28,8 +28,8 @@ while [[ $# -gt 0 ]]; do
done
if [[ "$CLEAN" == "1" ]]; then
- rm -rf "$STAGE_DIR/harness-appkit" "$STAGE_DIR/harness-swiftui" "$STAGE_DIR/harness-wkwebview"
- mkdir -p "$STAGE_DIR/harness-appkit" "$STAGE_DIR/harness-swiftui" "$STAGE_DIR/harness-wkwebview"
+ rm -rf "$STAGE_DIR/harness-appkit" "$STAGE_DIR/harness-swiftui" "$STAGE_DIR/harness-wkwebview" "$STAGE_DIR/harness-electron"
+ mkdir -p "$STAGE_DIR/harness-appkit" "$STAGE_DIR/harness-swiftui" "$STAGE_DIR/harness-wkwebview" "$STAGE_DIR/harness-electron"
echo "==> Cleaned stage dirs"
fi
@@ -104,6 +104,10 @@ if [[ "$SKIP" != "wkwebview" ]]; then
echo " → bundled shared/web/index.html into Resources/web/"
fi
+if [[ "$SKIP" != "electron" ]]; then
+ "$HARNESS_DIR/apps/cross-platform/electron/build.sh"
+fi
+
echo ""
echo "Built apps:"
find "$STAGE_DIR" -maxdepth 3 -name "*.app" -type d