Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
ci: run unrouted Cua Driver script and perception tests (#4105)
Francesco Bonaccif8ea757dd097
diff --git a/.github/workflows/ci-cua-driver-contract-clients.yml b/.github/workflows/ci-cua-driver-contract-clients.ymlindex f69b5f1704..89845b72c3 100644--- a/.github/workflows/ci-cua-driver-contract-clients.yml+++ b/.github/workflows/ci-cua-driver-contract-clients.yml@@ -261,13 +261,14 @@ jobs:working-directory: libs/cua-driver/rustrun: cargo test --locked -p cua-driver-core --test contract_parity- - name: Test Python release packaging helpers+ - name: Test Python release packaging helpers and binary wrapperworking-directory: libs/cua-driver/pythonrun: |python -m pip install pytestpython -m pytest \tests/test_build_wheel.py \tests/test_compatibility_contract.py \+ tests/test_wrapper.py \-q- name: Build and stage host-native UniFFI librarydiff --git a/.github/workflows/ci-cua-perception-release.yml b/.github/workflows/ci-cua-perception-release.ymlindex 5ac31a1b99..0c70c388a2 100644--- a/.github/workflows/ci-cua-perception-release.yml+++ b/.github/workflows/ci-cua-perception-release.yml@@ -82,6 +82,7 @@ jobs:.github/scripts/tests/test_release_channels.py \.github/scripts/tests/test_resolve_release_please_request.py \.github/scripts/tests/test_merge_release_please_manifests.py \+ libs/cua-driver/rust/crates/cua-perception/scripts/tests/test_artifact_tooling.py \libs/cua-driver/rust/crates/cua-perception/scripts/tests/test_measure_quality.py \libs/cua-driver/rust/crates/cua-perception/scripts/tests/test_quality_runner.py- name: Prove Driver dependency graph excludes Perceptiondiff --git a/.github/workflows/ci-test-scripts.yml b/.github/workflows/ci-test-scripts.ymlindex c65a584a26..b3cd2f1ab9 100644--- a/.github/workflows/ci-test-scripts.yml+++ b/.github/workflows/ci-test-scripts.yml@@ -52,6 +52,28 @@ on:- "libs/cua-driver/tests/runners/macos-lume/**"- "scripts/ci/macos/**"- "libs/cua-driver/tests/perception-demo/**"+ # Release-wiring, channel, and installer tests read these inputs.+ - ".github/release-notes/**"+ - ".github/release-state/**"+ - "AGENTS.md"+ - "CONTRIBUTING.md"+ - "docs/content/docs/reference/cua-driver/**"+ - "libs/cua-driver/examples/agent-sdks/**"+ - "libs/cua-driver/rust/Cargo.lock"+ - "libs/cua-driver/rust/VERSION"+ - "libs/cua-driver/rust/Skills/cua-driver/**"+ - "libs/cua-driver/rust/crates/cua-driver/src/cli.rs"+ - "libs/cua-driver/rust/crates/cua-driver/src/main.rs"+ - "libs/cua-driver/rust/crates/cua-driver/src/skills.rs"+ - "libs/cua-driver/rust/crates/cua-driver/src/telemetry.rs"+ - "libs/cua-driver/rust/crates/cua-perception/VERSION"+ - "libs/cua-driver/rust/scripts/CuaDriverBundle/**"+ - "libs/cua-driver/typescript/package.json"+ - "libs/cua-driver/typescript/package-lock.json"+ - "libs/lume/VERSION"+ - "libs/lume/scripts/**"+ - "libs/lume/src/Main.swift"+ - "scripts/docs-generators/config.json"jobs:windows-uninstall:@@ -89,14 +111,14 @@ jobs:cd .github/scriptspytest tests/ -v- - name: Test Cua Driver uninstall scripts+ - name: Test Cua Driver install and uninstall scriptsrun: python -m pytest libs/cua-driver/scripts/tests/ -v- - name: Test private evidence cache and envelope contracts- run: |- python -m pytest \- libs/cua-driver/tests/perception-demo/test_cache_evidence.py \- libs/cua-driver/tests/perception-demo/test_evidence_envelope.py -v+ - name: Test Computer History purge during uninstall+ run: bash libs/cua-driver/scripts/tests/uninstall-history-purge-test.sh++ - name: Test private evidence cache, envelope, and sanitizer contracts+ run: python -m pytest libs/cua-driver/tests/perception-demo/ -v- uses: actions/setup-node@v4with:diff --git a/libs/cua-driver/python/tests/test_wrapper.py b/libs/cua-driver/python/tests/test_wrapper.pyindex 27ccc324d5..a7a60bdc7c 100644--- a/libs/cua-driver/python/tests/test_wrapper.py+++ b/libs/cua-driver/python/tests/test_wrapper.py@@ -3,11 +3,10 @@import importlib.utilimport ioimport os-import subprocessimport sysfrom pathlib import Pathfrom typing import Any-from unittest.mock import Mock, patch+from unittest.mock import Mockimport pytest@@ -24,7 +23,7 @@ def load_wrapper_module() -> Any:def test_get_binary_path():"""Test that get_binary_path returns a valid path."""- from cua_driver.wrapper import get_binary_path+ get_binary_path = load_wrapper_module().get_binary_path# This will raise FileNotFoundError if binary doesn't exist# In CI, we need to build the package first for this to pass@@ -39,7 +38,8 @@ def test_get_binary_path():def test_run_cua_driver_version(monkeypatch):"""Test running cua-driver --version through the wrapper."""- from cua_driver.wrapper import get_binary_path, run_cua_driver+ wrapper = load_wrapper_module()+ get_binary_path, run_cua_driver = wrapper.get_binary_path, wrapper.run_cua_drivertry:binary_path = get_binary_path()@@ -53,7 +53,8 @@ def test_run_cua_driver_version(monkeypatch):def test_wrapper_preserves_exit_code():"""Test that the wrapper preserves the binary's exit code."""- from cua_driver.wrapper import get_binary_path, run_cua_driver+ wrapper = load_wrapper_module()+ get_binary_path, run_cua_driver = wrapper.get_binary_path, wrapper.run_cua_drivertry:binary_path = get_binary_path()@@ -143,32 +144,34 @@ def test_subprocess_preserves_exact_exit_code(assert wrapper.run_cua_driver(["--version"]) == 42-@patch("cua_driver.wrapper.subprocess.run")-@patch("cua_driver.wrapper.get_binary_path")-def test_subprocess_preserves_explicit_install_channel(mock_get_binary, mock_run, monkeypatch):+def test_subprocess_preserves_explicit_install_channel(+ monkeypatch: pytest.MonkeyPatch,+) -> None:"""An update/install caller's bounded channel takes precedence."""- from cua_driver.wrapper import run_cua_driver-- mock_get_binary.return_value = Path("/fake/path/cua-driver")- mock_run.return_value = Mock(returncode=0)+ wrapper = load_wrapper_module()+ mock_run = Mock(return_value=Mock(returncode=0))+ monkeypatch.setattr(+ wrapper, "get_binary_path", Mock(return_value=Path("/fake/path/cua-driver"))+ )+ monkeypatch.setattr(wrapper.subprocess, "run", mock_run)monkeypatch.setenv("CUA_DRIVER_INSTALL_CHANNEL", "update_apply")- run_cua_driver(["--version"])+ wrapper.run_cua_driver(["--version"])child_env = mock_run.call_args.kwargs["env"]assert child_env["CUA_DRIVER_INSTALL_CHANNEL"] == "update_apply"assert os.environ["CUA_DRIVER_INSTALL_CHANNEL"] == "update_apply"-@patch("cua_driver.wrapper.subprocess.run")-@patch("cua_driver.wrapper.get_binary_path")-def test_keyboard_interrupt_handling(mock_get_binary, mock_run):+def test_keyboard_interrupt_handling(monkeypatch: pytest.MonkeyPatch) -> None:"""Test that KeyboardInterrupt returns exit code 130."""- from cua_driver.wrapper import run_cua_driver-- mock_binary = Path("/fake/path/cua-driver")- mock_get_binary.return_value = mock_binary- mock_run.side_effect = KeyboardInterrupt()+ wrapper = load_wrapper_module()+ monkeypatch.setattr(+ wrapper, "get_binary_path", Mock(return_value=Path("/fake/path/cua-driver"))+ )+ monkeypatch.setattr(+ wrapper.subprocess, "run", Mock(side_effect=KeyboardInterrupt())+ )- exit_code = run_cua_driver(["mcp"])+ exit_code = wrapper.run_cua_driver(["mcp"])assert exit_code == 130diff --git a/libs/cua-driver/python/tests/test_install_local_signing.py b/libs/cua-driver/scripts/tests/test_install_local_signing.pysimilarity index 91%rename from libs/cua-driver/python/tests/test_install_local_signing.pyrename to libs/cua-driver/scripts/tests/test_install_local_signing.pyindex b044866f5d..08c7b0aa2c 100644--- a/libs/cua-driver/python/tests/test_install_local_signing.py+++ b/libs/cua-driver/scripts/tests/test_install_local_signing.py@@ -3,7 +3,7 @@ import osimport subprocess-SCRIPTS_DIR = Path(__file__).resolve().parents[2] / "scripts"+SCRIPTS_DIR = Path(__file__).resolve().parents[1]SIGNING_HELPER = SCRIPTS_DIR / "_local-signing.sh"@@ -163,9 +163,7 @@ def test_installer_verifies_the_copied_designated_requirement() -> None:def test_local_installer_uses_a_separate_macos_identity() -> None:"""Local rebuilds never replace or reset the release app identity (#2230)."""- script = (- Path(__file__).resolve().parents[2] / "scripts" / "_install-local-rust.sh"- ).read_text()+ script = (SCRIPTS_DIR / "_install-local-rust.sh").read_text()assert 'APP_DEST="/Applications/CuaDriverLocal.app"' in scriptassert 'CFBundleIdentifier -string "com.trycua.driver.local"' in script@@ -175,9 +173,7 @@ def test_local_installer_uses_a_separate_macos_identity() -> None:def test_unix_local_installer_uses_separate_paths_and_autostart() -> None:"""Local install state, command, and service names coexist with release."""- script = (- Path(__file__).resolve().parents[2] / "scripts" / "_install-local-rust.sh"- ).read_text()+ script = (SCRIPTS_DIR / "_install-local-rust.sh").read_text()assert 'HOME_DIR="${CUA_DRIVER_LOCAL_HOME:-$HOME/.cua-driver-local}"' in scriptassert "BIN_DIR/cua-driver-local" in script@@ -188,9 +184,7 @@ def test_unix_local_installer_uses_separate_paths_and_autostart() -> None:def test_unix_local_installer_always_embeds_source_provenance() -> None:"""Local builds derive Git provenance but preserve VM snapshot overrides."""- script = (- Path(__file__).resolve().parents[2] / "scripts" / "_install-local-rust.sh"- ).read_text()+ script = (SCRIPTS_DIR / "_install-local-rust.sh").read_text()assert 'if [ -z "${CUA_DRIVER_SOURCE_SHA:-}" ]; then' in scriptassert "rev-parse --verify 'HEAD^{commit}'" in script@@ -201,7 +195,7 @@ def test_unix_local_installer_always_embeds_source_provenance() -> None:def test_windows_local_installer_always_embeds_source_provenance() -> None:"""The Windows developer installer follows the same provenance contract."""- script = (Path(__file__).resolve().parents[2] / "scripts" / "install-local.ps1").read_text()+ script = (SCRIPTS_DIR / "install-local.ps1").read_text()assert "IsNullOrWhiteSpace($env:CUA_DRIVER_SOURCE_SHA)" in scriptassert "rev-parse --verify 'HEAD^{commit}'" in script@@ -210,7 +204,7 @@ def test_windows_local_installer_always_embeds_source_provenance() -> None:def test_windows_local_installer_uses_separate_paths_and_autostart() -> None:- script = (Path(__file__).resolve().parents[2] / "scripts" / "install-local.ps1").read_text()+ script = (SCRIPTS_DIR / "install-local.ps1").read_text()assert '$BinaryName = "cua-driver-local.exe"' in scriptassert '"Programs\\Cua\\cua-driver-local\\bin"' in script@@ -220,9 +214,8 @@ def test_windows_local_installer_uses_separate_paths_and_autostart() -> None:def test_release_installers_do_not_target_local_product_artifacts() -> None:- scripts_dir = Path(__file__).resolve().parents[2] / "scripts"for name in ("_install-rust.sh", "install.ps1"):- script = (scripts_dir / name).read_text()+ script = (SCRIPTS_DIR / name).read_text()assert "CuaDriverLocal" not in scriptassert ".cua-driver-local" not in scriptassert "cua-driver-local-serve" not in script