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
test(cua-driver): expect the macOS background refusals in the invoke_menu and two-window gate cells (#5078)
Francesco Bonaccif6a8475e35c9
diff --git a/libs/cua-driver/rust/crates/cua-driver-e2e/tests/harness_appkit_test.rs b/libs/cua-driver/rust/crates/cua-driver-e2e/tests/harness_appkit_test.rsindex d883d38437..bf66c3751e 100644--- a/libs/cua-driver/rust/crates/cua-driver-e2e/tests/harness_appkit_test.rs+++ b/libs/cua-driver/rust/crates/cua-driver-e2e/tests/harness_appkit_test.rs@@ -949,6 +949,40 @@ fn harness_appkit_invoke_menu_live_path() {// both, so an AXFocused-only implementation cannot pass this cell.let _distractor = Harness::launch();+ // invoke_menu does not activate a background app (#4955): with+ // the distractor in front, the item stays disabled and the call+ // refuses without touching the fixture.+ let background = driver.call(+ "invoke_menu",+ serde_json::json!({+ "pid": pid,+ "window_id": wid,+ "path": ["Window", "Arrange", "Left"]+ }),+ );+ assert!(+ background.is_error(),+ "a disabled background menu item was invoked: {}",+ background.raw+ );+ assert_eq!(+ background.structured()["refusal"]["code"],+ "background_unavailable",+ "{}",+ background.raw+ );+ assert!(snapshot_elements(driver, pid, wid)+ .tree_text()+ .contains("menu_action=none"));++ // The foreground route the refusal names: bring the exact window+ // to front, then invoke the menu.+ let raised = driver.call(+ "bring_to_front",+ serde_json::json!({"pid": pid, "window_id": wid}),+ );+ assert!(!raised.is_error(), "bring_to_front failed: {}", raised.raw);+let invoked = driver.call("invoke_menu",serde_json::json!({diff --git a/libs/cua-driver/rust/crates/cua-driver-e2e/tests/standalone_browser_behavior_test.rs b/libs/cua-driver/rust/crates/cua-driver-e2e/tests/standalone_browser_behavior_test.rsindex 888d432462..f33d10d60b 100644--- a/libs/cua-driver/rust/crates/cua-driver-e2e/tests/standalone_browser_behavior_test.rs+++ b/libs/cua-driver/rust/crates/cua-driver-e2e/tests/standalone_browser_behavior_test.rs@@ -4931,12 +4931,15 @@ fn run_two_window_collision(spec: &BrowserSpec) {launch_additional_window(&mut fixture);assert_eq!(second_pid, fixture.pid);assert_ne!(second_window_id, fixture.window_id);+ let session = format!("standalone-two-window-{}", fixture.pid);+ let attached_before = prepare_same_space_attachment(&mut fixture, &session).is_some();run_with_background_oracles(&mut fixture, |fixture| {- let session = format!("standalone-two-window-{}", fixture.pid);- let started = fixture- .driver- .call("start_session", serde_json::json!({ "session": session }));- assert!(!started.is_error(), "start_session failed: {}", started.raw);+ if !attached_before {+ let started = fixture+ .driver+ .call("start_session", serde_json::json!({ "session": session }));+ assert!(!started.is_error(), "start_session failed: {}", started.raw);+ }let prepared = fixture.driver.call("browser_prepare",serde_json::json!({@@ -4946,13 +4949,17 @@ fn run_two_window_collision(spec: &BrowserSpec) {"strategy": {"kind": "existing_profile"},}),);- assert_eq!(prepared.structured()["status"], "ok", "{}", prepared.raw);- assert_eq!(- prepared.structured()["action"],- "attached_existing_profile",- "{}",- prepared.raw- );+ if attached_before {+ assert_same_space_background_refusal(&prepared);+ } else {+ assert_eq!(prepared.structured()["status"], "ok", "{}", prepared.raw);+ assert_eq!(+ prepared.structured()["action"],+ "attached_existing_profile",+ "{}",+ prepared.raw+ );+ }let refused = fixture.driver.call("get_browser_state",serde_json::json!({