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.

test(cua-driver): tighten and prune desktop E2E tests (#4120)

Francesco Bonaccicc53544aaf18
diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/README.md b/libs/cua-driver/rust/crates/cua-driver/tests/README.md
index eb6847ecd4..ee4d188ac5 100644
--- a/libs/cua-driver/rust/crates/cua-driver/tests/README.md
+++ b/libs/cua-driver/rust/crates/cua-driver/tests/README.md
@@ -130,9 +130,9 @@ These suites are Rust source-of-truth coverage for real installed apps, but they
are not part of the canonical run-all path because they depend on software or
desktop state outside the repo-local fixtures:
-- `harness_libreoffice_test.rs`: Windows LibreOffice Writer/Calc. Requires
- LibreOffice installed, or `LO_SWRITER_EXE` / `LO_SCALC_EXE` pointing at the
- executables.
+- `harness_libreoffice_test.rs`: Windows LibreOffice Writer, the only coverage
+ of the SAL/VCL MSAA fallback. Requires LibreOffice installed, or
+ `LO_SWRITER_EXE` pointing at `swriter.exe`; it fails when Writer is missing.
- `installed_app_launch_macos_test.rs`: macOS Calculator/TextEdit launch focus
checks. Requires a logged-in GUI session and usable System Events scripting.
- `installed_app_textedit_macos_test.rs`: real TextEdit background AX write and
diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/bring_to_front_macos_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/bring_to_front_macos_test.rs
index 48ede776b6..781ecf8403 100644
--- a/libs/cua-driver/rust/crates/cua-driver/tests/bring_to_front_macos_test.rs
+++ b/libs/cua-driver/rust/crates/cua-driver/tests/bring_to_front_macos_test.rs
@@ -324,7 +324,6 @@ fn exact_secondary_window_is_verified_and_prior_app_can_recover_focus() {
result.raw
);
assert_eq!(result.structured()["activated"], true);
- assert_eq!(result.structured()["request_accepted"], true);
assert_eq!(result.structured()["process_activated"], true);
assert_eq!(result.structured()["exact_window_effect"]["verified"], true);
assert_eq!(
@@ -365,6 +364,8 @@ fn modal_sheet_never_yields_false_parent_success() {
.expect("start installed macOS daemon proxy");
let target = launch(&mut driver, Some("sheet"));
let windows = wait_for_window_ids(&target, &["main", "secondary", "sheet"]);
+ // wait_for_window_ids has already seen the sheet in CoreGraphics, so the
+ // refusal cannot come from a fixture that never presented one.
let parent = windows["main"];
let result = driver.call(
"bring_to_front",
@@ -375,6 +376,12 @@ fn modal_sheet_never_yields_false_parent_success() {
"modal parent falsely reported success: {}",
result.raw
);
+ assert_eq!(
+ result.structured()["code"],
+ "bring_to_front_exact_window_unverified",
+ "{}",
+ result.raw
+ );
assert_eq!(result.structured()["activated"], false);
assert_ne!(focused_window_title(target.pid), MAIN_TITLE);
}
diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/cross_platform_behavior_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/cross_platform_behavior_test.rs
index 4da4c7f4fe..ee92106cc8 100644
--- a/libs/cua-driver/rust/crates/cua-driver/tests/cross_platform_behavior_test.rs
+++ b/libs/cua-driver/rust/crates/cua-driver/tests/cross_platform_behavior_test.rs
@@ -300,26 +300,6 @@ fn accessibility_readiness_timeout(host_name: &str) -> Duration {
}
}
-#[test]
-fn electron_and_tauri_receive_extended_accessibility_readiness_budget() {
- assert_eq!(
- accessibility_readiness_timeout("electron"),
- Duration::from_secs(30)
- );
- assert_eq!(
- accessibility_readiness_timeout("tauri"),
- Duration::from_secs(30)
- );
- assert_eq!(
- accessibility_readiness_timeout("webview2"),
- Duration::from_secs(10)
- );
- assert_eq!(
- accessibility_readiness_timeout("wkwebview"),
- Duration::from_secs(10)
- );
-}
-
fn launch_host_with_evidence(spec: &HostSpec, scenario: &str, evidence: &mut Evidence) -> Fixture {
if !spec.path.exists() {
panic!(
@@ -1780,59 +1760,6 @@ fn shared_case_with_native_hyprland(
}
}
-#[test]
-fn native_hyprland_semantic_expectations_are_limited_to_proven_cells() {
- for host in ["electron", "tauri", "wkwebview", "webview2"] {
- for action in [
- "left_click",
- "child_window",
- "right_click",
- "double_click",
- "scroll",
- "drag",
- "type_text",
- "type_submit",
- "press_key",
- "hotkey",
- "editor_save",
- ] {
- for targeting in [Targeting::Ax, Targeting::Px] {
- let expected = matches!(
- (host, action, targeting),
- ("electron" | "tauri", "left_click", Targeting::Px)
- | ("electron" | "tauri", "child_window", Targeting::Px)
- | ("electron", "scroll", Targeting::Ax)
- );
- assert_eq!(
- native_hyprland_semantic_case(
- true,
- host,
- action,
- targeting,
- Delivery::Background
- ),
- expected,
- "{host}/{action}/{targeting:?}",
- );
- assert!(!native_hyprland_semantic_case(
- false,
- host,
- action,
- targeting,
- Delivery::Background
- ));
- assert!(!native_hyprland_semantic_case(
- true,
- host,
- action,
- targeting,
- Delivery::Foreground
- ));
- }
- }
- }
-}
-
#[test]
fn native_hyprland_semantic_declarations_require_delivery_and_all_background_oracles() {
use cua_driver_testkit::e2e::{ContractExpectation, DriverRoute};
@@ -1861,6 +1788,32 @@ fn native_hyprland_semantic_declarations_require_delivery_and_all_background_ora
] {
assert!(case.oracles.contains(&oracle), "missing {oracle:?}");
}
+ let targeting = if addressing == "ax" {
+ Targeting::Ax
+ } else {
+ Targeting::Px
+ };
+ assert!(
+ !native_hyprland_semantic_case(false, host, action, targeting, Delivery::Background),
+ "{host}/{action}: semantic route without native Hyprland input"
+ );
+ assert!(
+ !native_hyprland_semantic_case(true, host, action, targeting, Delivery::Foreground),
+ "{host}/{action}: foreground delivery must not take the semantic route"
+ );
+ }
+ // Accepting a click is not proof of a focus-free AT-SPI action.
+ for (host, action, targeting) in [
+ ("electron", "right_click", Targeting::Px),
+ ("tauri", "scroll", Targeting::Ax),
+ ("electron", "left_click", Targeting::Ax),
+ ("wkwebview", "left_click", Targeting::Px),
+ ("webview2", "child_window", Targeting::Px),
+ ] {
+ assert!(
+ !native_hyprland_semantic_case(true, host, action, targeting, Delivery::Background),
+ "{host}/{action}/{targeting:?} is not a proven semantic cell"
+ );
}
}
diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/harness_appkit_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/harness_appkit_test.rs
index 67a9e3c11f..3eb011c729 100644
--- a/libs/cua-driver/rust/crates/cua-driver/tests/harness_appkit_test.rs
+++ b/libs/cua-driver/rust/crates/cua-driver/tests/harness_appkit_test.rs
@@ -708,6 +708,21 @@ fn harness_appkit_invoke_menu_live_path() {
}),
);
assert!(refused.is_error(), "missing menu path was accepted");
+ // Only the missing leaf may refuse; a pid, window, or activation
+ // failure would share the code but name a different cause.
+ assert_eq!(
+ refused.structured()["refusal"]["code"],
+ "menu_path_unavailable",
+ "{}",
+ refused.raw
+ );
+ assert!(
+ refused.structured()["refusal"]["message"]
+ .as_str()
+ .is_some_and(|message| message.contains("path segment 2 was not found")),
+ "{}",
+ refused.raw
+ );
assert!(snapshot_elements(driver, pid, wid)
.tree_text()
.contains("menu_action=none"));
diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/harness_gtk3_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/harness_gtk3_test.rs
index 25d7bc98f2..ead47679c5 100644
--- a/libs/cua-driver/rust/crates/cua-driver/tests/harness_gtk3_test.rs
+++ b/libs/cua-driver/rust/crates/cua-driver/tests/harness_gtk3_test.rs
@@ -531,6 +531,21 @@ fn harness_gtk3_invoke_menu_live_path() {
}),
);
assert!(refused.is_error(), "missing menu path was accepted");
+ // Only the missing leaf may refuse; a pid, window, or activation
+ // failure would share the code but name a different cause.
+ assert_eq!(
+ refused.structured()["refusal"]["code"],
+ "menu_path_unavailable",
+ "{}",
+ refused.raw
+ );
+ assert!(
+ refused.structured()["refusal"]["message"]
+ .as_str()
+ .is_some_and(|message| message.contains("path segment 2 was not found")),
+ "{}",
+ refused.raw
+ );
assert!(snapshot(driver, pid, window_id)
.tree_text()
.contains("menu_action=none"));
diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/harness_libreoffice_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/harness_libreoffice_test.rs
index d0481da70a..43d6f5dde0 100644
--- a/libs/cua-driver/rust/crates/cua-driver/tests/harness_libreoffice_test.rs
+++ b/libs/cua-driver/rust/crates/cua-driver/tests/harness_libreoffice_test.rs
@@ -1,52 +1,20 @@
-//! Optional integration tests against a live LibreOffice Writer instance.
+//! Optional Windows check against a live LibreOffice Writer instance.
//!
-//! This file is intentionally not part of the canonical Windows run-all path:
-//! it requires LibreOffice to be installed on the machine. Run it explicitly on
-//! images that include LibreOffice.
+//! This is the only coverage of the MSAA fallback that `platform-windows`
+//! applies to SAL/VCL windows (`uia/mod.rs` SAL class detection and
+//! `msaa.rs`). The repo-local WPF, WinUI3, and WebView2 harnesses all walk
+//! through UIA, so none of them reaches that path. The row proves that a VCL
+//! toolbar SplitButton exposes `expand` and that `click(action:"expand")`
+//! opens its dropdown as a new top-level window.
//!
-//! Regression-guards the VCL/SAL gaps the vision-only LO Writer flow
-//! surfaced (manually validated during the PR #1708 follow-up
-//! exploration). Each test asserts the *current* gap — it will fail
-//! loudly if cua-driver later closes the underlying gap, prompting
-//! a flip of the assertion.
+//! The canonical Windows image has no LibreOffice, so no runner selects this
+//! file; `libs/cua-driver/tests/manual-e2e-allowlist.txt` records it as manual.
+//! It fails, rather than passes, when Writer, the driver, or the Writer window
+//! is missing.
//!
-//! ## Tests in this file
-//!
-//! 1. **`harness_lo_vcl_font_color_split_button_exposes_expand`** —
-//! Font Color SplitButton reports `actions=[invoke,expand]`.
-//!
-//! 2. **`harness_lo_vcl_font_color_expand_opens_picker`** — click
-//! with `action:"expand"` opens a SALTMPSUBFRAME picker.
-//!
-//! 3. **`harness_lo_vcl_modal_input_roundtrip_works`** — SAL/VCL
-//! modal (Find & Replace) accepts SendInput, snapshot has actionable
-//! elements (no more skip stub).
-//!
-//! 4. **`harness_lo_vcl_all_toolbar_split_buttons_expose_expand`** —
-//! *every* toolbar SplitButton in Writer has `expand` (not just
-//! Font Color). Guards `msaa::actions_for` BUTTONDROPDOWN family.
-//!
-//! 5. **`harness_lo_vcl_color_pick_green_end_to_end`** — full
-//! workflow: type text → select → open Font Color → click Green →
-//! picker closes (proves color landed).
-//!
-//! 6. **`harness_lo_vcl_recovery_dialog_walks_via_msaa`** — Document
-//! Recovery dialog (SALFRAME class) still walks via MSAA, exposes
-//! "Discard All" + "Recover Selected" buttons. Guards the
-//! routing change for the pre-existing Recovery-dialog flow.
-//!
-//! 7. **`harness_lo_vcl_calc_msaa_smoke`** — LO Calc (different app
-//! surface on the same VCL base) also walks via MSAA with ≥15
-//! SplitButtons exposing `expand`. Confirms the path generalizes
-//! beyond Writer.
-//!
-//! ## How to run
-//!
-//! Local (requires LibreOffice installed):
+//! Run on an image with LibreOffice installed (override the path with
+//! `LO_SWRITER_EXE`):
//! cargo test -p cua-driver --test harness_libreoffice_test -- --ignored --nocapture
-//!
-//! Tests skip cleanly if `swriter.exe` isn't on disk at one of the
-//! standard install locations (override via `LO_SWRITER_EXE`).
#![cfg(target_os = "windows")]
@@ -80,26 +48,6 @@ fn swriter_exe() -> Option<PathBuf> {
None
}
-/// LO Calc executable, same probe shape as `swriter_exe()`.
-fn scalc_exe() -> Option<PathBuf> {
- if let Ok(p) = std::env::var("LO_SCALC_EXE") {
- let pb = PathBuf::from(p);
- if pb.exists() {
- return Some(pb);
- }
- }
- for candidate in [
- r"C:\Program Files\LibreOffice\program\scalc.exe",
- r"C:\Program Files (x86)\LibreOffice\program\scalc.exe",
- ] {
- let pb = PathBuf::from(candidate);
- if pb.exists() {
- return Some(pb);
- }
- }
- None
-}
-
// ── fixture ──────────────────────────────────────────────────────────────────
/// Live LO Writer session: the long-lived MCP driver plus the located
@@ -124,14 +72,9 @@ impl Drop for LoSession {
}
}
-fn setup() -> Option<LoSession> {
- let writer = match swriter_exe() {
- Some(p) => p,
- None => {
- eprintln!("LibreOffice swriter.exe not found — set LO_SWRITER_EXE or install LO");
- return None;
- }
- };
+fn setup() -> LoSession {
+ let writer = swriter_exe()
+ .expect("LibreOffice swriter.exe not found; install LibreOffice or set LO_SWRITER_EXE");
// Sweep any leftover soffice.bin from a prior run so this test gets
// a fresh writer pid + clean recovery state.
@@ -140,7 +83,7 @@ fn setup() -> Option<LoSession> {
.output();
std::thread::sleep(Duration::from_millis(800));
- let mut driver = McpDriver::spawn()?;
+ let mut driver = McpDriver::spawn().expect("start the source-built driver");
// `-norestore` skips the Document Recovery dialog (which would
// block the Writer top-level window from ever appearing if the
@@ -153,7 +96,7 @@ fn setup() -> Option<LoSession> {
.stdout(Stdio::null())
.stderr(Stdio::null()),
)
- .ok()?;
+ .expect("launch LibreOffice Writer");
// LO launches via soffice.bin background daemon, then forks the
// actual writer process. The pid we just spawned is the launcher;
// the real writer is a child. Poll list_apps via cua-driver to
@@ -174,81 +117,24 @@ fn setup() -> Option<LoSession> {
let pid = w["pid"].as_u64().unwrap_or(0) as u32;
let wid = w["window_id"].as_u64().unwrap_or(0);
if pid > 0 && wid > 0 {
- return Some(LoSession {
+ return LoSession {
driver,
writer_pid: pid,
writer_wid: wid,
- });
+ };
}
}
}
}
- if std::time::Instant::now() > deadline {
- eprintln!("Writer window did not appear within 30 s");
- return None;
- }
+ assert!(
+ std::time::Instant::now() <= deadline,
+ "Writer window did not appear within 30 s"
+ );
std::thread::sleep(Duration::from_millis(500));
}
}
-// ── Test 1: Font Color SplitButton exposes `expand` via MSAA fallback ───────
-
-/// Confirms the MSAA fallback (`platform-windows/src/msaa.rs`) lets
-/// cua-driver see VCL toolbar SplitButtons' dropdown halves.
-///
-/// Before the MSAA fallback landed: UIA's MSAA→UIA proxy collapsed
-/// `ROLE_SYSTEM_BUTTONDROPDOWN` (0x38) to a featureless `SplitButton`
-/// with `actions=[invoke]` — agents could re-fire the press half but
-/// not open the picker. After the MSAA fallback: SAL-class windows
-/// walk via oleacc's `AccessibleObjectFromWindow`, which preserves
-/// the BUTTONDROPDOWN role, and cua-driver maps it to
-/// `actions=[invoke,expand]`. The `click` tool's `action:"expand"`
-/// case clicks the right-edge of the cached rect (the dropdown arrow
-/// half) via SendInput.
-///
-/// If this fails: either the MSAA path stopped applying to SALFRAME
-/// (check `uia/mod.rs` SAL class detection), or LO changed its
-/// toolbar role (no longer ROLE_SYSTEM_BUTTONDROPDOWN).
-#[test]
-#[ignore]
-fn harness_lo_vcl_font_color_split_button_exposes_expand() {
- let mut fx = match setup() {
- Some(s) => s,
- None => return,
- };
- let (pid, wid) = (fx.writer_pid, fx.writer_wid);
- let driver = &mut fx.driver;
-
- let snap = driver.call(
- "get_window_state",
- serde_json::json!({
- "pid": pid as i64, "window_id": wid,
- "capture_mode": "ax", "query": "Font Color"
- }),
- );
- let text = snap.text();
- assert!(
- text.contains("SplitButton \"Font Color\""),
- "Font Color SplitButton not found in tree: {text:?}"
- );
- let line = text
- .lines()
- .find(|l| l.contains("\"Font Color\""))
- .unwrap_or("");
- assert!(
- line.contains("expand"),
- "Expected `expand` in actions on Font Color SplitButton — got {line:?}. \
- The MSAA fallback may not be running for SALFRAME (check uia/mod.rs \
- SAL class detection — should route ALL SAL* classes through msaa.rs)."
- );
- assert!(
- line.contains("invoke"),
- "Expected `invoke` to remain in actions alongside `expand` — got {line:?}. \
- MSAA walker should expose both press and dropdown halves."
- );
-}
-
-// ── Test 2: action:"expand" actually opens the color picker ─────────────────
+// ── action:"expand" on a VCL SplitButton opens its dropdown ─────────────────
/// End-to-end test that the `click(element_index, action:"expand")`
/// dispatch on a MSAA BUTTONDROPDOWN actually opens the dropdown.
@@ -271,10 +157,7 @@ fn harness_lo_vcl_font_color_split_button_exposes_expand() {
#[test]
#[ignore]
fn harness_lo_vcl_font_color_expand_opens_picker() {
- let mut fx = match setup() {
- Some(s) => s,
- None => return,
- };
+ let mut fx = setup();
let (pid, wid) = (fx.writer_pid, fx.writer_wid);
let driver = &mut fx.driver;
@@ -373,665 +256,3 @@ fn harness_lo_vcl_font_color_expand_opens_picker() {
as a child window instead of a top-level."
);
}
-
-// ── Working path: SALSUBFRAME modal dialogs accept SendInput input ─────────
-
-/// Confirms the MSAA fallback gives a walkable tree on SALSUBFRAME
-/// modal dialogs too (was the "SAL/VCL target, UIA walk skipped" stub
-/// before the MSAA path landed), AND that the dialog accepts
-/// SendInput-injected keyboard input.
-///
-/// Specifically:
-/// - `hotkey(ctrl+h, foreground)` against the main Writer SALFRAME
-/// opens the Find & Replace dialog (a SALSUBFRAME).
-/// - `get_window_state(capture_mode:"ax")` on the dialog returns a
-/// full element tree via the MSAA walker — includes the "Close"
-/// button and the Find/Replace edit fields as addressable
-/// element_indices (a recent capability — the pre-MSAA stub had
-/// zero actionable elements).
-/// - `press_key(escape, foreground)` against the SALSUBFRAME closes
-/// it cleanly.
-///
-/// If this test ever fails, one of three things regressed:
-/// (a) Ctrl+H accelerator on the main Writer window stopped firing
-/// under SendInput (foreground key dispatch broken on SALFRAME).
-/// (b) MSAA walker stopped finding actionable elements in
-/// SALSUBFRAME (check `msaa.rs` budget / depth).
-/// (c) Foreground Escape stopped reaching the SALSUBFRAME (SAL
-/// filter changed in a newer LO).
-#[test]
-#[ignore]
-fn harness_lo_vcl_modal_input_roundtrip_works() {
- let mut fx = match setup() {
- Some(s) => s,
- None => return,
- };
- let (pid, wid) = (fx.writer_pid, fx.writer_wid);
- let driver = &mut fx.driver;
-
- std::thread::sleep(Duration::from_millis(800));
-
- let open_resp = driver.call(
- "hotkey",
- serde_json::json!({
- "pid": pid as i64, "window_id": wid,
- "keys": ["ctrl", "h"], "delivery_mode": "foreground"
- }),
- );
- let open_text = open_resp.text();
- assert!(
- open_text.starts_with("✅"),
- "hotkey(ctrl+h, foreground) failed: {open_text:?}"
- );
-
- let dialog_wid = {
- let deadline = std::time::Instant::now() + Duration::from_secs(8);
- loop {
- let wins = driver.call(
- "list_windows",
- serde_json::json!({
- "pid": pid as i64
- }),
- );
- let found = wins.structured()["windows"].as_array().and_then(|a| {
- a.iter().find_map(|w| {
- let title = w["title"].as_str().unwrap_or("");
- let id = w["window_id"].as_u64();
- if id != Some(wid) && (title.contains("Find") || title.contains("Replace")) {
- id
- } else {
- None
- }
- })
- });
- if let Some(id) = found {
- break id;
- }
- if std::time::Instant::now() > deadline {
- panic!(
- "Find & Replace dialog did not appear after Ctrl+H — \
- Writer accelerator may have regressed under \
- foreground SendInput on SALFRAME."
- );
- }
- std::thread::sleep(Duration::from_millis(300));
- }
- };
-
- // Snapshot the dialog — MSAA walker should produce a real tree
- // with the dialog's buttons and edit fields, NOT the old skip
- // stub.
- let dialog_ax = driver.call(
- "get_window_state",
- serde_json::json!({
- "pid": pid as i64, "window_id": dialog_wid, "capture_mode": "ax"
- }),
- );
- let dialog_text = dialog_ax.text();
- assert!(
- !dialog_text.contains("SAL/VCL target, UIA walk skipped"),
- "Got the old skip-stub message — MSAA fallback did not engage on \
- this SALSUBFRAME. Snapshot was: {dialog_text:?}"
- );
- assert!(
- dialog_text.contains("Button \"Close\""),
- "Expected MSAA walker to expose a 'Close' Button in the Find & Replace \
- dialog tree (it's a documented child via accChild). Snapshot was: {dialog_text:?}"
- );
- // Sanity: should have several actionable element_indices, not zero.
- let actionable_count = dialog_text
- .lines()
- .filter(|l| l.contains("actions=[invoke"))
- .count();
- assert!(
- actionable_count >= 4,
- "Expected ≥4 actionable elements in Find & Replace via MSAA walker, \
- got {actionable_count}. Tree: {dialog_text:?}"
- );
-
- // Foreground Escape should close the dialog.
- let esc_resp = driver.call(
- "press_key",
- serde_json::json!({
- "pid": pid as i64, "window_id": dialog_wid,
- "key": "escape", "delivery_mode": "foreground"
- }),
- );
- let esc_text = esc_resp.text();
- assert!(
- esc_text.starts_with("✅"),
- "press_key(escape, foreground) returned an error: {esc_text:?}"
- );
- std::thread::sleep(Duration::from_millis(700));
-
- let wins_after = driver.call(
- "list_windows",
- serde_json::json!({
- "pid": pid as i64
- }),
- );
- let still_open = wins_after.structured()["windows"]
- .as_array()
- .map(|a| {
- a.iter()
- .any(|w| w["window_id"].as_u64() == Some(dialog_wid))
- })
- .unwrap_or(false);
- assert!(
- !still_open,
- "Find & Replace dialog stayed open after foreground Escape — \
- SAL modal input dispatch regressed. Check uia/mod.rs SAL-class \
- handling and the press_key SendInput path."
- );
-
- // Cleanup: kill the LO process — Drop impl sweeps soffice.bin.
- let _ = driver.call(
- "kill_app",
- serde_json::json!({
- "pid": pid as i64
- }),
- );
-}
-
-// ── Test 4: All toolbar SplitButtons expose `expand` ────────────────────────
-
-/// Confirms the MSAA fallback exposes `actions=[invoke,expand]` on EVERY
-/// toolbar SplitButton in LO Writer — not just Font Color.
-///
-/// Pre-MSAA, the UIA→MSAA proxy collapsed every BUTTONDROPDOWN to a
-/// featureless `SplitButton actions=[invoke]`. Post-MSAA, ALL of them
-/// (Save, Open, Undo, Redo, Paste, Table, Field, Symbol, Show Tracked
-/// Changes, Record, Basic Shapes, Underline, Font Color, Character
-/// Highlighting Color, Background Color, Unordered List, Ordered List,
-/// Outline Format, Line Spacing, Character Spacing — plus the "System"
-/// menu button) report `expand`. Guards against accidental regressions
-/// in `msaa::actions_for` (e.g. dropping one of the BUTTONDROPDOWN
-/// variants from the role match).
-///
-/// Asserts ≥15 SplitButtons report `expand` (current count is 20-21
-/// depending on toolbar config; floor at 15 to absorb minor LO updates).
-#[test]
-#[ignore]
-fn harness_lo_vcl_all_toolbar_split_buttons_expose_expand() {
- let mut fx = match setup() {
- Some(s) => s,
- None => return,
- };
- let (pid, wid) = (fx.writer_pid, fx.writer_wid);
- let driver = &mut fx.driver;
-
- let snap = driver.call(
- "get_window_state",
- serde_json::json!({
- "pid": pid as i64, "window_id": wid, "capture_mode": "ax"
- }),
- );
- let text = snap.text();
- let splitbutton_lines: Vec<&str> = text
- .lines()
- .filter(|l| l.contains("SplitButton") && l.contains("actions=["))
- .collect();
- let with_expand: Vec<&&str> = splitbutton_lines
- .iter()
- .filter(|l| l.contains("expand"))
- .collect();
- assert!(
- splitbutton_lines.len() >= 15,
- "Expected ≥15 SplitButtons in LO Writer toolbar tree, got {}. \
- Possible MSAA walker regression. Full snapshot first 1500 chars: {}",
- splitbutton_lines.len(),
- &text.chars().take(1500).collect::<String>()
- );
- assert_eq!(
- with_expand.len(),
- splitbutton_lines.len(),
- "{}/{} SplitButtons report `expand`. The MSAA role→actions \
- mapping may have dropped one of BUTTONDROPDOWN / BUTTONMENU / \
- BUTTONDROPDOWNGRID / SPLITBUTTON. Missing-expand lines:\n{}",
- with_expand.len(),
- splitbutton_lines.len(),
- splitbutton_lines
- .iter()
- .filter(|l| !l.contains("expand"))
- .map(|l| l.trim())
- .collect::<Vec<_>>()
- .join("\n")
- );
-}
-
-// ── Test 5: End-to-end color-pick ───────────────────────────────────────────
-
-/// End-to-end regression for the headline workflow: type text, select it,
-/// open the Font Color picker via `action:"expand"`, click a named color,
-/// verify the picker closes (the canonical signal that LO applied the
-/// color).
-///
-/// Failure points:
-/// - MSAA walker can't find Font Color → `msaa.rs` role match broken.
-/// - click(action:"expand") doesn't open picker → right-edge dispatch
-/// offset wrong for current LO version's toolbar scale.
-/// - Picker MSAA walk doesn't find "Green" → walker depth/budget
-/// truncating the color grid.
-/// - Picker doesn't close after picking → click on color cell isn't
-/// landing (offset / role mismatch on ListItem).
-#[test]
-#[ignore]
-fn harness_lo_vcl_color_pick_green_end_to_end() {
- let mut fx = match setup() {
- Some(s) => s,
- None => return,
- };
- let (pid, wid) = (fx.writer_pid, fx.writer_wid);
- let driver = &mut fx.driver;
-
- // Foreground first so type_text + Ctrl+A land on Writer.
- let _ = driver.call(
- "bring_to_front",
- serde_json::json!({
- "pid": pid as i64, "window_id": wid
- }),
- );
- std::thread::sleep(Duration::from_millis(400));
-
- let _ = driver.call(
- "type_text",
- serde_json::json!({
- "pid": pid as i64, "window_id": wid,
- "text": "color pick regression"
- }),
- );
- std::thread::sleep(Duration::from_millis(400));
-
- let _ = driver.call(
- "hotkey",
- serde_json::json!({
- "pid": pid as i64, "window_id": wid,
- "keys": ["ctrl", "a"], "delivery_mode": "foreground"
- }),
- );
- std::thread::sleep(Duration::from_millis(400));
-
- // Locate Font Color element_index in Writer's MSAA tree.
- let snap = driver.call(
- "get_window_state",
- serde_json::json!({
- "pid": pid as i64, "window_id": wid,
- "capture_mode": "ax", "query": "Font Color"
- }),
- );
- let snap_text = snap.text();
- let fc_line = snap_text
- .lines()
- .find(|l| l.contains("\"Font Color\"") && l.contains("expand"))
- .unwrap_or_else(|| panic!("Font Color with `expand` not found in tree: {snap_text:?}"));
- let s = fc_line.find('[').expect("[ in fc_line");
- let e = fc_line[s..].find(']').expect("] in fc_line") + s;
- let fc_idx: u64 = fc_line[s + 1..e].trim().parse().expect("fc element_index");
-
- // Snapshot which windows existed BEFORE opening the picker so
- // we can isolate the picker on appearance.
- let before = driver.call(
- "list_windows",
- serde_json::json!({
- "pid": pid as i64
- }),
- );
- let before_ids: std::collections::HashSet<u64> = before.structured()["windows"]
- .as_array()
- .map(|a| a.iter().filter_map(|w| w["window_id"].as_u64()).collect())
- .unwrap_or_default();
-
- // Open the dropdown.
- let open_resp = driver.call(
- "click",
- serde_json::json!({
- "pid": pid as i64, "window_id": wid,
- "element_index": fc_idx, "snapshot_id": snap.snapshot_id(),
- "action": "expand"
- }),
- );
- let open_text = open_resp.text();
- assert!(
- open_text.contains("dropdown half"),
- "click(action:expand) did not dispatch via MSAA dropdown path: {open_text:?}"
- );
- std::thread::sleep(Duration::from_millis(900));
-
- // Find the picker window.
- let after = driver.call(
- "list_windows",
- serde_json::json!({
- "pid": pid as i64
- }),
- );
- let picker_wid = after.structured()["windows"]
- .as_array()
- .and_then(|a| {
- a.iter().find_map(|w| {
- let id = w["window_id"].as_u64();
- let title = w["title"].as_str().unwrap_or("");
- if id.map(|i| !before_ids.contains(&i)).unwrap_or(false)
- && title.contains("Font Color")
- {
- id
- } else {
- None
- }
- })
- })
- .unwrap_or_else(|| panic!("No new 'Font Color' picker window appeared"));
-
- // Walk the picker tree to find a green color cell.
- let psnap = driver.call(
- "get_window_state",
- serde_json::json!({
- "pid": pid as i64, "window_id": picker_wid, "capture_mode": "ax"
- }),
- );
- let psnap_text = psnap.text();
- let green_line = psnap_text
- .lines()
- .find(|l| l.contains("\"Green\"") && l.contains("[") && l.contains("actions=[invoke"))
- .unwrap_or_else(|| {
- panic!(
- "No 'Green' ListItem in picker tree. The MSAA walker may have \
- truncated the color grid or LO's locale renamed the color. \
- First 1500 chars: {}",
- &psnap_text.chars().take(1500).collect::<String>()
- )
- });
- let s = green_line.find('[').expect("[ in green");
- let e = green_line[s..].find(']').expect("] in green") + s;
- let green_idx: u64 = green_line[s + 1..e]
- .trim()
- .parse()
- .expect("green element_index");
-
- // Pick it. Default action (invoke) clicks center via MSAA dispatch.
- let pick_resp = driver.call(
- "click",
- serde_json::json!({
- "pid": pid as i64, "window_id": picker_wid,
- "element_index": green_idx, "snapshot_id": psnap.snapshot_id()
- }),
- );
- let pick_text = pick_resp.text();
- assert!(
- pick_text.starts_with("✅"),
- "click on Green color cell failed: {pick_text:?}"
- );
- std::thread::sleep(Duration::from_millis(700));
-
- // Verify the picker closed (LO closes the popup after a color is
- // selected — the canonical "color applied" signal). If it
- // didn't, the click didn't actually land on the cell.
- let after2 = driver.call(
- "list_windows",
- serde_json::json!({
- "pid": pid as i64
- }),
- );
- let still_open = after2.structured()["windows"]
- .as_array()
- .map(|a| {
- a.iter()
- .any(|w| w["window_id"].as_u64() == Some(picker_wid))
- })
- .unwrap_or(false);
- assert!(
- !still_open,
- "Picker stayed open after click on Green — the cell click \
- didn't land. LO didn't apply the color."
- );
-}
-
-// ── Test 6: Recovery dialog walks via MSAA ──────────────────────────────────
-
-/// Confirms that the LibreOffice Document Recovery dialog (which used to
-/// be walked via UIA) is still walkable after the MSAA-routes-all-SAL
-/// change. Pre-MSAA: UIA path returned a walkable tree with "Discard
-/// All" / "Recover Selected" buttons addressable. Post-MSAA: same flow
-/// must continue to work through the MSAA walker.
-///
-/// Triggering Recovery requires a previous LO session that exited
-/// ungracefully — this test creates that condition by typing into a
-/// fresh writer and then `kill_app`-ing it, then re-launches. If the
-/// Recovery dialog doesn't appear (LO can't always be coaxed into
-/// recovery state, e.g. when the recovery feature is disabled in
-/// user config), the test logs and returns OK rather than panicking —
-/// it's a regression guard for the post-MSAA Recovery walk, not for
-/// LO's recovery-trigger behavior.
-#[test]
-#[ignore]
-fn harness_lo_vcl_recovery_dialog_walks_via_msaa() {
- // First: launch Writer WITHOUT -norestore (we WANT recovery
- // behavior), type something, then force-kill so LO marks the
- // session as crashed.
- let writer = match swriter_exe() {
- Some(p) => p,
- None => return,
- };
- let _ = Command::new("taskkill")
- .args(["/F", "/IM", "soffice.bin"])
- .output();
- std::thread::sleep(Duration::from_millis(800));
-
- // Launch (no -norestore, no -nologo flag → default behavior).
- let mut crash_proc = match Command::new(&writer)
- .stdout(Stdio::null())
- .stderr(Stdio::null())
- .spawn()
- {
- Ok(p) => p,
- Err(_) => return,
- };
- std::thread::sleep(Duration::from_secs(5));
- let _ = crash_proc.kill();
- let _ = crash_proc.wait();
- // Force-kill the actual soffice.bin worker too (the launcher is what
- // we just killed; the real LO process is a fork).
- let _ = Command::new("taskkill")
- .args(["/F", "/IM", "soffice.bin"])
- .output();
- std::thread::sleep(Duration::from_secs(2));
-
- // Re-launch Writer — Recovery dialog should appear.
- let Some(mut driver) = McpDriver::spawn() else {
- return;
- };
- if driver
- .reaper()
- .spawn(
- Command::new(&writer)
- .stdout(Stdio::null())
- .stderr(Stdio::null()),
- )
- .is_err()
- {
- return;
- }
- std::thread::sleep(Duration::from_secs(5));
-
- // Poll for the Recovery dialog.
- let recovery_wid_pid: Option<(u64, u32)> = {
- let deadline = std::time::Instant::now() + Duration::from_secs(20);
- let mut found = None;
- while std::time::Instant::now() < deadline {
- let resp = driver.call("list_windows", serde_json::json!({}));
- if let Some(wins) = resp.structured()["windows"].as_array() {
- if let Some(w) = wins.iter().find(|w| {
- w["title"]
- .as_str()
- .map(|t| t.contains("Recovery"))
- .unwrap_or(false)
- }) {
- let id = w["window_id"].as_u64();
- let pid = w["pid"].as_u64().map(|p| p as u32);
- if let (Some(i), Some(p)) = (id, pid) {
- found = Some((i, p));
- break;
- }
- }
- }
- std::thread::sleep(Duration::from_millis(500));
- }
- found
- };
-
- match recovery_wid_pid {
- None => {
- eprintln!(
- "Recovery dialog did not appear — LO didn't enter recovery \
- state (possibly disabled in user config, or our crash \
- trigger didn't take effect). Test cannot assert MSAA \
- walk on a dialog that doesn't exist; logging and \
- returning OK."
- );
- }
- Some((rwid, rpid)) => {
- let snap = driver.call(
- "get_window_state",
- serde_json::json!({
- "pid": rpid as i64, "window_id": rwid, "capture_mode": "ax"
- }),
- );
- let text = snap.text();
- assert!(
- !text.contains("SAL/VCL target, UIA walk skipped"),
- "Recovery dialog returned the old SAL-skip stub — MSAA fallback \
- isn't engaging on SALFRAME Recovery dialogs."
- );
- assert!(
- text.contains("Button \"Discard All\""),
- "Recovery dialog tree should expose `Discard All` Button via MSAA. \
- Got: {text:?}"
- );
- assert!(
- text.contains("Button \"Recover Selected\""),
- "Recovery dialog tree should expose `Recover Selected` Button via MSAA. \
- Got: {text:?}"
- );
- }
- }
-
- // Cleanup: reaper kills the MCP driver + the spawned writer on drop;
- // sweep the soffice.bin daemon that outlives the launcher.
- drop(driver);
- let _ = Command::new("taskkill")
- .args(["/F", "/IM", "soffice.bin"])
- .output();
- std::thread::sleep(Duration::from_millis(800));
-}
-
-// ── Test 7: LO Calc smoke ──────────────────────────────────────────────────
-
-/// Confirms the MSAA fallback generalizes beyond Writer. Launches LO
-/// Calc, walks the main SALFRAME, asserts ≥15 SplitButtons with `expand`
-/// — Calc has Calc-specific dropdowns (Select Function, Row, Column,
-/// Freeze Panes) on top of the standard ones (Save, Open, Undo, Redo,
-/// Paste, Font Color, etc.).
-///
-/// Skips cleanly if scalc.exe isn't installed (set LO_SCALC_EXE for
-/// non-default paths).
-#[test]
-#[ignore]
-fn harness_lo_vcl_calc_msaa_smoke() {
- let scalc = match scalc_exe() {
- Some(p) => p,
- None => return,
- };
-
- let _ = Command::new("taskkill")
- .args(["/F", "/IM", "soffice.bin"])
- .output();
- std::thread::sleep(Duration::from_millis(800));
-
- let Some(mut driver) = McpDriver::spawn() else {
- return;
- };
- if driver
- .reaper()
- .spawn(
- Command::new(&scalc)
- .args(["-norestore", "-nologo"])
- .stdout(Stdio::null())
- .stderr(Stdio::null()),
- )
- .is_err()
- {
- return;
- }
- std::thread::sleep(Duration::from_secs(5));
-
- // Poll for the Calc window.
- let calc_wid_pid: Option<(u64, u32)> = {
- let deadline = std::time::Instant::now() + Duration::from_secs(20);
- let mut found = None;
- while std::time::Instant::now() < deadline {
- let r = driver.call("list_windows", serde_json::json!({}));
- if let Some(wins) = r.structured()["windows"].as_array() {
- if let Some(w) = wins.iter().find(|w| {
- w["title"]
- .as_str()
- .map(|t| t.contains("LibreOffice Calc"))
- .unwrap_or(false)
- }) {
- let id = w["window_id"].as_u64();
- let pid = w["pid"].as_u64().map(|p| p as u32);
- if let (Some(i), Some(p)) = (id, pid) {
- found = Some((i, p));
- break;
- }
- }
- }
- std::thread::sleep(Duration::from_millis(500));
- }
- found
- };
-
- let (cwid, cpid) = match calc_wid_pid {
- Some(v) => v,
- None => {
- let _ = Command::new("taskkill")
- .args(["/F", "/IM", "soffice.bin"])
- .output();
- panic!("LO Calc window did not appear within 20 s");
- }
- };
-
- let snap = driver.call(
- "get_window_state",
- serde_json::json!({
- "pid": cpid as i64, "window_id": cwid, "capture_mode": "ax"
- }),
- );
- let text = snap.text();
- assert!(
- !text.contains("SAL/VCL target, UIA walk skipped"),
- "Calc returned the old SAL-skip stub — MSAA didn't engage."
- );
- let sb_with_expand = text
- .lines()
- .filter(|l| l.contains("SplitButton") && l.contains("expand"))
- .count();
- assert!(
- sb_with_expand >= 15,
- "Expected ≥15 SplitButtons with `expand` in Calc toolbar (proves MSAA \
- generalizes beyond Writer). Got {sb_with_expand}. The MSAA role \
- mapping may differ in Calc, or the toolbar config is unexpectedly slim."
- );
-
- // Cleanup: reaper kills the MCP driver + the spawned calc on drop;
- // sweep the soffice.bin daemon that outlives the launcher.
- let _ = driver.call(
- "kill_app",
- serde_json::json!({
- "pid": cpid as i64
- }),
- );
- drop(driver);
- let _ = Command::new("taskkill")
- .args(["/F", "/IM", "soffice.bin"])
- .output();
- std::thread::sleep(Duration::from_millis(800));
-}
diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/harness_wpf_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/harness_wpf_test.rs
index df945cd3ba..f0e791e881 100644
--- a/libs/cua-driver/rust/crates/cua-driver/tests/harness_wpf_test.rs
+++ b/libs/cua-driver/rust/crates/cua-driver/tests/harness_wpf_test.rs
@@ -1908,6 +1908,21 @@ fn harness_wpf_invoke_menu_live_path() {
}),
);
assert!(refused.is_error(), "missing menu path was accepted");
+ // Only the missing leaf may refuse; a pid, window, or activation
+ // failure would share the code but name a different cause.
+ assert_eq!(
+ refused.structured()["refusal"]["code"],
+ "menu_path_unavailable",
+ "{}",
+ refused.raw
+ );
+ assert!(
+ refused.structured()["refusal"]["message"]
+ .as_str()
+ .is_some_and(|message| message.contains("path segment 2 was not found")),
+ "{}",
+ refused.raw
+ );
assert!(snapshot(driver, pid, wid)
.tree_text()
.contains("menu_action=none"));
diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/hyprland_native_observation_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/hyprland_native_observation_test.rs
index a8756233d2..cc970e42de 100644
--- a/libs/cua-driver/rust/crates/cua-driver/tests/hyprland_native_observation_test.rs
+++ b/libs/cua-driver/rust/crates/cua-driver/tests/hyprland_native_observation_test.rs
@@ -123,7 +123,16 @@ fn native_window_capture_and_background_ax_keep_exact_identity() {
"pid": foreground.pid, "window_id": target.native_id,
}),
);
- assert!(wrong_owner.is_error());
+ // platform-linux get_window_state refuses a foreign-owned window with an
+ // untyped stale-target error; match its cause, not just any error.
+ assert!(
+ wrong_owner.is_error()
+ && wrong_owner
+ .text()
+ .contains("is stale or no longer running; refresh list_windows"),
+ "{}",
+ wrong_owner.raw
+ );
let fresh = snapshot(&mut driver, target);
let token = fresh.structured()["elements"]
.as_array()
@@ -138,8 +147,17 @@ fn native_window_capture_and_background_ax_keep_exact_identity() {
"pid": target.pid, "window_id": foreground.native_id, "element_token": token,
}),
);
- assert!(conflict.is_error());
+ assert!(conflict.is_error(), "{}", conflict.raw);
+ assert_eq!(
+ conflict.structured()["refusal"]["code"],
+ "conflicting_element_target",
+ "{}",
+ conflict.raw
+ );
assert!(snapshot(&mut driver, target)
.tree_text()
.contains("counter=1"));
+ assert!(snapshot(&mut driver, foreground)
+ .tree_text()
+ .contains("counter=0"));
}
diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/installed_app_textedit_macos_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/installed_app_textedit_macos_test.rs
index edf11916f6..244e90b7f6 100644
--- a/libs/cua-driver/rust/crates/cua-driver/tests/installed_app_textedit_macos_test.rs
+++ b/libs/cua-driver/rust/crates/cua-driver/tests/installed_app_textedit_macos_test.rs
@@ -1,6 +1,7 @@
//! TextEdit background-delivery integration check for macOS.
//!
-//! Covers the `{path, verified}` structured outcome on a real Cocoa app.
+//! Covers the accessibility route and confirmed value read-back on a real
+//! Cocoa app, then reads the editor back through a fresh snapshot.
//!
//! The schema contract lives in `protocol_schema_test.rs`. This installed-app
//! check runs in the canonical logged-in macOS desktop lane.
@@ -24,6 +25,15 @@ fn background_type_on_native_cocoa_is_ax_verified() {
use cua_driver_testkit::{Driver, McpDriver};
let cell_id = "macos-textedit-type-text-ax-background";
+ // TextEdit may restore an earlier unsaved document, so the read-back
+ // oracle needs text that no earlier run could have left behind.
+ let marker = format!(
+ "ladder{}",
+ std::time::SystemTime::now()
+ .duration_since(std::time::UNIX_EPOCH)
+ .expect("system clock after the Unix epoch")
+ .as_nanos()
+ );
let case = CaseSpec::delivered(
cell_id,
"textedit",
@@ -104,7 +114,7 @@ fn background_type_on_native_cocoa_is_ax_verified() {
serde_json::json!({
"pid": pid, "window_id": wid, "element_index": el,
"snapshot_id": snapshot_id,
- "text": "ladder", "delivery_mode": "background"
+ "text": marker, "delivery_mode": "background"
}),
)
},
@@ -129,6 +139,34 @@ fn background_type_on_native_cocoa_is_ax_verified() {
"confirmed actions must expose publishable evidence: {}",
typed.text()
);
+ // The driver's own read-back is not the oracle. Take a fresh snapshot
+ // and require the editor to hold the typed text.
+ let deadline = std::time::Instant::now() + std::time::Duration::from_secs(5);
+ loop {
+ let state = driver.call(
+ "get_window_state",
+ serde_json::json!({ "pid": pid, "window_id": wid, "capture_mode": "ax" }),
+ );
+ let landed = state.structured()["elements"]
+ .as_array()
+ .is_some_and(|elements| {
+ elements.iter().any(|element| {
+ element["role"] == "AXTextArea"
+ && element["value"]
+ .as_str()
+ .is_some_and(|value| value.contains(&marker))
+ })
+ });
+ if landed {
+ break;
+ }
+ assert!(
+ std::time::Instant::now() < deadline,
+ "TextEdit's AXTextArea never held {marker:?} after a confirmed write:\n{}",
+ state.text()
+ );
+ std::thread::sleep(std::time::Duration::from_millis(200));
+ }
passed.push(OracleKind::AxState);
Observation::delivered(passed, Default::default())
});
diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/standalone_browser_behavior_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/standalone_browser_behavior_test.rs
index 8c6e98ddee..8f467dfbde 100644
--- a/libs/cua-driver/rust/crates/cua-driver/tests/standalone_browser_behavior_test.rs
+++ b/libs/cua-driver/rust/crates/cua-driver/tests/standalone_browser_behavior_test.rs
@@ -24,10 +24,7 @@ use cua_driver_testkit::e2e::{
};
use cua_driver_testkit::observer::TargetWindow;
use cua_driver_testkit::sentinel::ForegroundSentinel;
-use cua_driver_testkit::{
- spawn_in_job, BrowserFixtureServer, Driver, McpDriver, RawDriver, ToolResponse,
- SHARE_HOST_STATE,
-};
+use cua_driver_testkit::{spawn_in_job, BrowserFixtureServer, Driver, McpDriver, ToolResponse};
use futures_util::{SinkExt, StreamExt};
use tokio_tungstenite::tungstenite::Message;
@@ -769,7 +766,7 @@ fn spawn_driver(label: &str) -> McpDriver {
label,
&[
("SWAYSOCK", "/dev/null/cua-e2e-withheld"),
- SHARE_HOST_STATE,
+ cua_driver_testkit::SHARE_HOST_STATE,
("CUA_DRIVER_PERMISSION_MODE", "unrestricted"),
("CUA_DRIVER_DANGEROUSLY_BYPASS_APPROVALS", "1"),
],
@@ -778,7 +775,7 @@ fn spawn_driver(label: &str) -> McpDriver {
McpDriver::spawn_named_with_env(
label,
&[
- SHARE_HOST_STATE,
+ cua_driver_testkit::SHARE_HOST_STATE,
("CUA_DRIVER_PERMISSION_MODE", "unrestricted"),
("CUA_DRIVER_DANGEROUSLY_BYPASS_APPROVALS", "1"),
],
@@ -788,7 +785,7 @@ fn spawn_driver(label: &str) -> McpDriver {
let driver = McpDriver::spawn_named_with_env(
label,
&[
- SHARE_HOST_STATE,
+ cua_driver_testkit::SHARE_HOST_STATE,
("CUA_DRIVER_PERMISSION_MODE", "unrestricted"),
("CUA_DRIVER_DANGEROUSLY_BYPASS_APPROVALS", "1"),
],
@@ -801,7 +798,7 @@ fn spawn_standard_driver(label: &str) -> McpDriver {
McpDriver::spawn_named_with_env(
label,
&[
- SHARE_HOST_STATE,
+ cua_driver_testkit::SHARE_HOST_STATE,
("CUA_DRIVER_PERMISSION_MODE", "standard"),
("CUA_DRIVER_DANGEROUSLY_BYPASS_APPROVALS", "0"),
],
@@ -2442,80 +2439,6 @@ fn run_prepare_isolated_launch(spec: &BrowserSpec) {
});
}
-#[test]
-#[ignore = "requires an installed standalone Chromium browser"]
-fn standalone_browser_prepare_isolated_source_smoke() {
- let _guard = STANDALONE_BROWSER_TEST_LOCK
- .lock()
- .unwrap_or_else(|poisoned| poisoned.into_inner());
- let driver_profiles = driver_profile_root();
- let profiles_before = profile_entries(&driver_profiles);
- let mut driver = RawDriver::spawn_with_env(&[
- SHARE_HOST_STATE,
- ("CUA_DRIVER_PERMISSION_MODE", "unrestricted"),
- ("CUA_DRIVER_DANGEROUSLY_BYPASS_APPROVALS", "1"),
- ])
- .expect("source-built driver daemon");
-
- driver.send(&serde_json::json!({
- "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {}
- }));
- driver.recv();
- driver.send(&serde_json::json!({
- "jsonrpc": "2.0", "id": 2, "method": "tools/call",
- "params": {"name": "start_session", "arguments": {"session": "pid-free-source-smoke"}}
- }));
- let started = driver.recv();
- assert_eq!(
- started["result"]["isError"],
- serde_json::Value::Null,
- "{started}"
- );
-
- driver.send(&serde_json::json!({
- "jsonrpc": "2.0", "id": 3, "method": "tools/call",
- "params": {
- "name": "browser_prepare",
- "arguments": {
- "session": "pid-free-source-smoke",
- "allow_launch": true,
- "profile": {"mode": "isolated_new"}
- }
- }
- }));
- let prepared = driver.recv();
- assert_eq!(
- prepared["result"]["structuredContent"]["action"], "launched_isolated_browser",
- "{prepared}"
- );
- assert!(
- prepared["result"]["structuredContent"]["prepared_pid"]
- .as_i64()
- .is_some_and(|pid| pid > 0),
- "{prepared}"
- );
-
- driver.send(&serde_json::json!({
- "jsonrpc": "2.0", "id": 4, "method": "tools/call",
- "params": {"name": "end_session", "arguments": {"session": "pid-free-source-smoke"}}
- }));
- let ended = driver.recv();
- assert_eq!(
- ended["result"]["isError"],
- serde_json::Value::Null,
- "{ended}"
- );
-
- let deadline = Instant::now() + Duration::from_secs(5);
- while profile_entries(&driver_profiles) != profiles_before {
- assert!(
- Instant::now() < deadline,
- "isolated_new profile remained after source-daemon end_session"
- );
- thread::sleep(Duration::from_millis(100));
- }
-}
-
#[cfg(not(target_os = "macos"))]
fn run_existing_profile_standard_refusal(spec: &BrowserSpec) {
let scenario = format!(
diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/wayland_overlay_idle_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/wayland_overlay_idle_test.rs
index eb36be0061..9a227338a2 100644
--- a/libs/cua-driver/rust/crates/cua-driver/tests/wayland_overlay_idle_test.rs
+++ b/libs/cua-driver/rust/crates/cua-driver/tests/wayland_overlay_idle_test.rs
@@ -90,6 +90,12 @@ fn assert_idle_tick_bound(pid: u32, tid: u32, window: Duration, bound: u64) {
#[test]
#[ignore]
fn no_overlay_flag_never_starts_wayland_overlay_thread() {
+ // Outside native Wayland the thread can never start, so its absence would
+ // pass for an unrelated reason. The Linux runner records an X11 limitation.
+ assert!(
+ std::env::var_os("WAYLAND_DISPLAY").is_some(),
+ "this negative control needs a native Wayland session"
+ );
let Some(mut driver) = RawDriver::spawn_with_env(&[
("CUA_DRIVER_PERMISSION_MODE", "unrestricted"),
("CUA_DRIVER_DANGEROUSLY_BYPASS_APPROVALS", "1"),
diff --git a/libs/cua-driver/tests/manual-e2e-allowlist.txt b/libs/cua-driver/tests/manual-e2e-allowlist.txt
index 000aaa6f34..1f6b043c4e 100644
--- a/libs/cua-driver/tests/manual-e2e-allowlist.txt
+++ b/libs/cua-driver/tests/manual-e2e-allowlist.txt
@@ -16,15 +16,8 @@ hyprland_foreground_test::foreground_drag_focus_loss_does_not_release_into_same_
hyprland_native_observation_test::native_window_capture_and_background_ax_keep_exact_identity | Manual native-Hyprland gate: needs a live Hyprland compositor; exact-identity capture and owner-mismatch refusals
# Optional external-app suite: the canonical Windows image has no LibreOffice.
-harness_libreoffice_test::harness_lo_vcl_all_toolbar_split_buttons_expose_expand | Optional Windows suite that needs LibreOffice Writer installed; under review in the lane-3 prune (#4094)
-harness_libreoffice_test::harness_lo_vcl_font_color_split_button_exposes_expand | Optional Windows suite that needs LibreOffice Writer installed; under review in the lane-3 prune (#4094)
harness_libreoffice_test::harness_lo_vcl_font_color_expand_opens_picker | Optional Windows suite that needs LibreOffice Writer installed; under review in the lane-3 prune (#4094)
-harness_libreoffice_test::harness_lo_vcl_modal_input_roundtrip_works | Optional Windows suite that needs LibreOffice Writer installed; under review in the lane-3 prune (#4094)
-harness_libreoffice_test::harness_lo_vcl_color_pick_green_end_to_end | Optional Windows suite that needs LibreOffice Writer installed; under review in the lane-3 prune (#4094)
-harness_libreoffice_test::harness_lo_vcl_recovery_dialog_walks_via_msaa | Optional Windows suite that needs LibreOffice Writer installed; under review in the lane-3 prune (#4094)
-harness_libreoffice_test::harness_lo_vcl_calc_msaa_smoke | Optional Windows suite that needs LibreOffice Calc installed; under review in the lane-3 prune (#4094)
-standalone_browser_behavior_test::standalone_browser_prepare_isolated_source_smoke | Strict subset of the routed standalone_browser_prepare_isolated row; retired in the lane-3 prune (#4094)
# macOS-only browser regressions that failed on their first routed run. Restore
# them to the Darwin list in scripts/ci/run-rust-standalone-browser-e2e.sh with
diff --git a/scripts/ci/linux/run-rust-e2e.sh b/scripts/ci/linux/run-rust-e2e.sh
index 1c8adb6c33..a5ed819c68 100755
--- a/scripts/ci/linux/run-rust-e2e.sh
+++ b/scripts/ci/linux/run-rust-e2e.sh
@@ -292,17 +292,34 @@ if [[ "${SUITE}" == shared || "${SUITE}" == all ]]; then
fi
if [[ "${SUITE}" == native || "${SUITE}" == all ]]; then
- run_test wayland-overlay-idle-no-overlay \
- cargo test -p cua-driver "${CARGO_DRIVER_FEATURE_ARGS[@]}" \
- --test wayland_overlay_idle_test -- \
- --ignored --exact no_overlay_flag_never_starts_wayland_overlay_thread \
- --nocapture --test-threads=1
if [[ -n "${WAYLAND_DISPLAY:-}" ]]; then
+ run_test wayland-overlay-idle-no-overlay \
+ cargo test -p cua-driver "${CARGO_DRIVER_FEATURE_ARGS[@]}" \
+ --test wayland_overlay_idle_test -- \
+ --ignored --exact no_overlay_flag_never_starts_wayland_overlay_thread \
+ --nocapture --test-threads=1
run_test wayland-overlay-idle-recovery \
cargo test -p cua-driver "${CARGO_DRIVER_FEATURE_ARGS[@]}" \
--test wayland_overlay_idle_test -- \
--ignored --exact wayland_overlay_quiesces_and_recovers_after_capture_and_cursor_activity \
--nocapture --test-threads=1
+ else
+ # X11 never starts the Wayland layer-shell overlay thread, so its absence
+ # there proves nothing about --no-overlay. Record the limitation instead
+ # of reporting a vacuous pass.
+ limitation="The Wayland overlay lifecycle cases need a native Wayland session; X11 cannot start the layer-shell overlay thread."
+ jq -n \
+ --arg reason "${limitation}" \
+ '{
+ schema: "cua-e2e-limitation-v1",
+ platform: "linux",
+ display_server: "x11",
+ harness: "wayland-overlay",
+ test: "wayland-overlay-idle",
+ status: "not_applicable",
+ reason: $reason
+ }' > "${ARTIFACT_DIR}/wayland-overlay-idle-limitation.json"
+ echo "[LIMITATION] wayland-overlay-idle: ${limitation}"
fi
run_test agent-cursor-showcase \
cargo test -p cua-driver "${CARGO_DRIVER_FEATURE_ARGS[@]}" \