Skip to content

test(cua-driver): desktop-scope modality harness test + test-suite docs#2038

Merged
f-trycua merged 2 commits into
mainfrom
test/desktop-scope-harness
Jun 26, 2026
Merged

test(cua-driver): desktop-scope modality harness test + test-suite docs#2038
f-trycua merged 2 commits into
mainfrom
test/desktop-scope-harness

Conversation

@f-trycua

@f-trycua f-trycua commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

What

Adds the first dedicated test for the desktop-scope / foreground modality (#1968 / #2019), plus two visual docs of the cua-driver test layer.

Test — harness_desktop_scope_test.rs (Windows, 3 #[ignore] integration tests)

Foreground/desktop-scope was previously only exercised incidentally by harness_lo_vcl_test (dispatch:"foreground" for VCL edge cases). This is the first test that targets the modality directly:

  1. desktop_scope_capture_returns_screen_dimsset_config capture_scope=desktopget_desktop_state returns a full-display capture with real screen_width/height.
  2. desktop_scope_windowless_click_and_scroll_land — screen-absolute click + scroll with no pid/window_id land via WindowFromPoint, reported as (desktop scope).
  3. window_scope_rejects_windowless_click — under capture_scope=window, a window-less click is rejected (desktop_scope_disabled), not silently retargeted.

Reuses the e2e_windows_bg_input_test harness pattern (kill-on-close Job Object, ChildBag Drop guard, JSON-RPC stdio helpers). One long-lived MCP server per test — required because set_config overrides are session-scoped.

Docs (libs/cua-driver/test-harness/)

  • TEST_HARNESS_STRUCTURE.md — harness-apps topology: scenarios.json single-source-of-truth, apps/build/tests wiring, coverage matrix.
  • TEST_SUITE.md — the Rust integration-test suite: inventory of ~135 test fns, the test→MCP-server→app loop, and the background vs. foreground/desktop-scope modality coverage breakdown.

Verification

  • Compiles + links on the Windows VM (cargo test --no-run -p cua-driver --test harness_desktop_scope_test, exit 0) against cua-driver v0.6.8.
  • ⏳ Live run pending — tests are #[ignore] (need a real interactive desktop; get_desktop_state fails in Session 0). Run with:
    cargo test -p cua-driver --test harness_desktop_scope_test -- --ignored --nocapture --test-threads=1

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests

    • Added a new Windows-only integration test that validates desktop-scope capture behavior end to end.
    • Verifies screen-based clicks, scrolling, desktop state reporting, and rejection of unsupported window-less clicks in window scope.
  • Documentation

    • Expanded test harness documentation with structure, execution flow, coverage mapping, and environment requirements.
    • Updated the test suite guide to include the new desktop-scope/foreground test and its expected behavior.

f-trycua and others added 2 commits June 25, 2026 22:27
…modality (#1968)

Adds harness_desktop_scope_test.rs covering the Phase-1 desktop-scope
(foreground, vision-only, screen-absolute) modality that the existing
background-modality tests don't exercise:
- set_config capture_scope=desktop → get_desktop_state returns a full-display
  capture with real screen_width/height
- window-less screen-absolute click + scroll land via WindowFromPoint
- negative gate: window-less click under capture_scope=window is rejected
  (desktop_scope_disabled)

Drives a single long-lived MCP server (capture_scope is a session override that
persists per-connection, not across stateless 'cua-driver call' processes).
#[ignore] (needs a real desktop session), same conventions as
e2e_windows_bg_input_test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMXCW4M5uK1HRGjjH4wueZ
Two visual docs for the cua-driver test layer:
- TEST_HARNESS_STRUCTURE.md — harness apps topology (scenarios.json
  single-source-of-truth, apps/build/tests wiring, coverage matrix).
- TEST_SUITE.md — the Rust integration-test suite: inventory of all
  ~135 test fns, the test→MCP-server→app loop, and modality coverage
  (background well-covered; foreground/desktop-scope now covered by the
  new harness_desktop_scope_test).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Jun 26, 2026 5:36am

Request Review

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a Windows-only integration test for desktop-scope capture, with driver cleanup, WPF harness window discovery, JSON-RPC helpers, assertions for desktop-state dimensions and screen-coordinate input routing, and documentation updates for harness structure and suite coverage.

Changes

Windows desktop-scope validation

Layer / File(s) Summary
Harness setup and RPC plumbing
libs/cua-driver/rust/crates/cua-driver/tests/harness_desktop_scope_test.rs
Adds Windows-only process/job cleanup, path helpers, JSON-RPC helpers, driver fixture startup, WPF harness launch-and-center logic, and a set_scope() helper.
Desktop-scope assertions
libs/cua-driver/rust/crates/cua-driver/tests/harness_desktop_scope_test.rs
Adds ignored tests for get_desktop_state, window-less click and scroll under capture_scope=desktop, and rejection of window-less click under capture_scope=window.
Harness documentation
libs/cua-driver/test-harness/TEST_HARNESS_STRUCTURE.md, libs/cua-driver/test-harness/TEST_SUITE.md
Documents the shared scenarios layout, harness coverage matrix, runtime requirements, and the new desktop-scope test entry and modality coverage notes.

Sequence Diagram(s)

sequenceDiagram
  participant Fixture
  participant cua_driver_exe as cua-driver.exe
  participant WPF_harness as WPF harness
  Fixture->>cua_driver_exe: initialize over stdio
  Fixture->>cua_driver_exe: set_config capture_scope
  Fixture->>WPF_harness: launch harness and find CuaTestHarness
  Fixture->>cua_driver_exe: click / scroll with x,y only
  Fixture->>cua_driver_exe: get_desktop_state
  Fixture->>cua_driver_exe: click with x,y only under capture_scope=window
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

  • Issue 1968: Adds end-to-end tests and docs for the same capture_scope=desktop behavior and screen-absolute click/scroll routing.

Possibly related PRs

  • trycua/cua#1883: This also targets Windows desktop capture correctness and coordinate routing, which the new test validates through get_desktop_state and screen-position input.
  • trycua/cua#2019: This is directly connected because the new test exercises the capture_scope behavior and the desktop_scope_disabled/desktop-scope response paths introduced there.

Poem

🐰 I hopped through windows, bright and new,
With clicks that land where screens are true.
The harness hummed, the driver sang,
And desktop scope went click-clack-bang!
Now docs and tests hop side by side.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 77.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the PR’s main changes: a new desktop-scope harness test plus accompanying test-suite documentation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/desktop-scope-harness

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@libs/cua-driver/rust/crates/cua-driver/tests/harness_desktop_scope_test.rs`:
- Around line 223-227: The desktop-scope test only checks that get_desktop_state
returns nonzero screen dimensions, but it does not verify the screenshot is in
true screen pixels. Update the assertions in harness_desktop_scope_test around
get_desktop_state to also read screenshot_width and screenshot_height from the
structured response and compare them against screen_width and screen_height.
Keep the existing checks, and add explicit equality assertions for the
screenshot dimensions to enforce the desktop-scope contract.
- Around line 176-195: The harness window selection in the desktop scope test is
matching only by title, which can pick an already-open CuaTestHarness instead of
the newly launched WPF process. Capture the spawned child PID from app.id() in
the spawn_in_job block before pushing it into fx._bag, then update the
list_windows scan in the same test to require w["pid"] to equal that PID before
calling assign_pid_to_job and returning the window center.
- Around line 257-264: Update window_scope_rejects_windowless_click to assert
the exact desktop_scope_disabled rejection from call/result_text instead of
accepting any is_error() outcome; keep the existing setup via spawn_driver,
set_scope, and call, but make the assertion verify the structured error
code/message for the click action rather than unrelated transport or startup
failures.

In `@libs/cua-driver/test-harness/TEST_HARNESS_STRUCTURE.md`:
- Line 7: The fenced code block in TEST_HARNESS_STRUCTURE.md is missing a
language declaration, which triggers markdownlint MD040. Update the opening
fence in this markdown snippet to specify an appropriate language such as text,
and keep the rest of the block unchanged.
- Around line 38-45: Add harness_desktop_scope_test.rs to the consumer tree in
TEST_HARNESS_STRUCTURE.md and update the WPF coverage row so the new
desktop-scope integration test is listed alongside the existing
harness_*_test.rs consumers. Keep the structure overview consistent with the
current test harness layout by editing the sections that enumerate
crates/cua-driver/tests and the coverage table entry for WPF.

In `@libs/cua-driver/test-harness/TEST_SUITE.md`:
- Line 47: The fenced ASCII diagram block in TEST_SUITE.md is missing a language
tag, which violates MD040. Update the Markdown fence for the modality diagram to
use an explicit text language identifier, and keep the diagram content unchanged
so the block is still rendered as plain text. Refer to the fenced block in
TEST_SUITE.md when making the change.
- Around line 77-78: The “Status of the new test” note in TEST_SUITE.md is a
pre-PR status update that will be stale once merged. Update this section to
remove references to the side branch, “Not yet PR’d,” and the pending PR
decision, and keep only stable guidance about how to compile-verify and run the
harness test using harness_desktop_scope_test.rs and the interactive-session
method.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 429c1d55-f82b-494f-ae4d-b417c3e90294

📥 Commits

Reviewing files that changed from the base of the PR and between fc27185 and ad092e8.

📒 Files selected for processing (3)
  • libs/cua-driver/rust/crates/cua-driver/tests/harness_desktop_scope_test.rs
  • libs/cua-driver/test-harness/TEST_HARNESS_STRUCTURE.md
  • libs/cua-driver/test-harness/TEST_SUITE.md

Comment on lines +176 to +195
let app = spawn_in_job(Command::new(&exe).stdout(Stdio::null()).stderr(Stdio::null())).ok()?;
fx._bag.push(app);
let deadline = Instant::now() + Duration::from_secs(15);
while Instant::now() < deadline {
let r = call(&mut fx.stdin, &fx.rx, 50, "list_windows", serde_json::json!({}));
if let Some(arr) = structured(&r)["windows"].as_array() {
for w in arr {
let title = w["title"].as_str().unwrap_or("");
if !title.contains("CuaTestHarness") { continue; }
let pid = w["pid"].as_u64().unwrap_or(0) as u32;
// #2018: bounds is nested {x,y,width,height} on Windows.
let b = &w["bounds"];
let (x, y, ww, h) = (
b["x"].as_i64().unwrap_or(0) as i32, b["y"].as_i64().unwrap_or(0) as i32,
b["width"].as_i64().unwrap_or(0) as i32, b["height"].as_i64().unwrap_or(0) as i32,
);
if pid != 0 && ww > 0 && h > 0 {
assign_pid_to_job(pid);
fx._bag.track_pid(pid);
return Some((pid, x + ww / 2, y + h / 2));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Match the launched WPF instance by PID.

This loop accepts the first CuaTestHarness title it sees, so an already-open harness window can satisfy the test and send input to the wrong process. Capture app.id() before pushing the child into the bag and require w["pid"] to match it.

Suggested fix
-    let app = spawn_in_job(Command::new(&exe).stdout(Stdio::null()).stderr(Stdio::null())).ok()?;
-    fx._bag.push(app);
+    let app = spawn_in_job(Command::new(&exe).stdout(Stdio::null()).stderr(Stdio::null())).ok()?;
+    let launched_pid = app.id();
+    fx._bag.push(app);
@@
-                let pid = w["pid"].as_u64().unwrap_or(0) as u32;
+                let pid = w["pid"].as_u64().unwrap_or(0) as u32;
+                if pid != launched_pid { continue; }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let app = spawn_in_job(Command::new(&exe).stdout(Stdio::null()).stderr(Stdio::null())).ok()?;
fx._bag.push(app);
let deadline = Instant::now() + Duration::from_secs(15);
while Instant::now() < deadline {
let r = call(&mut fx.stdin, &fx.rx, 50, "list_windows", serde_json::json!({}));
if let Some(arr) = structured(&r)["windows"].as_array() {
for w in arr {
let title = w["title"].as_str().unwrap_or("");
if !title.contains("CuaTestHarness") { continue; }
let pid = w["pid"].as_u64().unwrap_or(0) as u32;
// #2018: bounds is nested {x,y,width,height} on Windows.
let b = &w["bounds"];
let (x, y, ww, h) = (
b["x"].as_i64().unwrap_or(0) as i32, b["y"].as_i64().unwrap_or(0) as i32,
b["width"].as_i64().unwrap_or(0) as i32, b["height"].as_i64().unwrap_or(0) as i32,
);
if pid != 0 && ww > 0 && h > 0 {
assign_pid_to_job(pid);
fx._bag.track_pid(pid);
return Some((pid, x + ww / 2, y + h / 2));
let app = spawn_in_job(Command::new(&exe).stdout(Stdio::null()).stderr(Stdio::null())).ok()?;
let launched_pid = app.id();
fx._bag.push(app);
let deadline = Instant::now() + Duration::from_secs(15);
while Instant::now() < deadline {
let r = call(&mut fx.stdin, &fx.rx, 50, "list_windows", serde_json::json!({}));
if let Some(arr) = structured(&r)["windows"].as_array() {
for w in arr {
let title = w["title"].as_str().unwrap_or("");
if !title.contains("CuaTestHarness") { continue; }
let pid = w["pid"].as_u64().unwrap_or(0) as u32;
if pid != launched_pid { continue; }
// `#2018`: bounds is nested {x,y,width,height} on Windows.
let b = &w["bounds"];
let (x, y, ww, h) = (
b["x"].as_i64().unwrap_or(0) as i32, b["y"].as_i64().unwrap_or(0) as i32,
b["width"].as_i64().unwrap_or(0) as i32, b["height"].as_i64().unwrap_or(0) as i32,
);
if pid != 0 && ww > 0 && h > 0 {
assign_pid_to_job(pid);
fx._bag.track_pid(pid);
return Some((pid, x + ww / 2, y + h / 2));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/cua-driver/rust/crates/cua-driver/tests/harness_desktop_scope_test.rs`
around lines 176 - 195, The harness window selection in the desktop scope test
is matching only by title, which can pick an already-open CuaTestHarness instead
of the newly launched WPF process. Capture the spawned child PID from app.id()
in the spawn_in_job block before pushing it into fx._bag, then update the
list_windows scan in the same test to require w["pid"] to equal that PID before
calling assign_pid_to_job and returning the window center.

Comment on lines +223 to +227
let r = call(&mut fx.stdin, &fx.rx, 20, "get_desktop_state", serde_json::json!({}));
assert!(!is_error(&r), "get_desktop_state errored: {r}");
let sw = structured(&r)["screen_width"].as_u64().unwrap_or(0);
let sh = structured(&r)["screen_height"].as_u64().unwrap_or(0);
assert!(sw > 0 && sh > 0, "get_desktop_state returned no/zero screen size: {r}");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert the screenshot is not downscaled.

Right now this passes as long as screen_width/screen_height are nonzero. It does not verify the desktop-scope contract that the captured image is in true screen pixels. Compare screenshot_width/screenshot_height against the reported screen dimensions as well.

Suggested fix
     let sw = structured(&r)["screen_width"].as_u64().unwrap_or(0);
     let sh = structured(&r)["screen_height"].as_u64().unwrap_or(0);
+    let cw = structured(&r)["screenshot_width"].as_u64().unwrap_or(0);
+    let ch = structured(&r)["screenshot_height"].as_u64().unwrap_or(0);
     assert!(sw > 0 && sh > 0, "get_desktop_state returned no/zero screen size: {r}");
+    assert_eq!((cw, ch), (sw, sh), "get_desktop_state returned a downscaled capture: {r}");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let r = call(&mut fx.stdin, &fx.rx, 20, "get_desktop_state", serde_json::json!({}));
assert!(!is_error(&r), "get_desktop_state errored: {r}");
let sw = structured(&r)["screen_width"].as_u64().unwrap_or(0);
let sh = structured(&r)["screen_height"].as_u64().unwrap_or(0);
assert!(sw > 0 && sh > 0, "get_desktop_state returned no/zero screen size: {r}");
let r = call(&mut fx.stdin, &fx.rx, 20, "get_desktop_state", serde_json::json!({}));
assert!(!is_error(&r), "get_desktop_state errored: {r}");
let sw = structured(&r)["screen_width"].as_u64().unwrap_or(0);
let sh = structured(&r)["screen_height"].as_u64().unwrap_or(0);
let cw = structured(&r)["screenshot_width"].as_u64().unwrap_or(0);
let ch = structured(&r)["screenshot_height"].as_u64().unwrap_or(0);
assert!(sw > 0 && sh > 0, "get_desktop_state returned no/zero screen size: {r}");
assert_eq!((cw, ch), (sw, sh), "get_desktop_state returned a downscaled capture: {r}");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/cua-driver/rust/crates/cua-driver/tests/harness_desktop_scope_test.rs`
around lines 223 - 227, The desktop-scope test only checks that
get_desktop_state returns nonzero screen dimensions, but it does not verify the
screenshot is in true screen pixels. Update the assertions in
harness_desktop_scope_test around get_desktop_state to also read
screenshot_width and screenshot_height from the structured response and compare
them against screen_width and screen_height. Keep the existing checks, and add
explicit equality assertions for the screenshot dimensions to enforce the
desktop-scope contract.

Comment on lines +257 to +264
fn window_scope_rejects_windowless_click() {
let Some(mut fx) = spawn_driver() else { return };
set_scope(&mut fx, "window");
let r = call(&mut fx.stdin, &fx.rx, 30, "click", serde_json::json!({"x": 100, "y": 100}));
let txt = result_text(&r).to_lowercase();
assert!(
is_error(&r) || txt.contains("desktop scope") || txt.contains("desktop_scope_disabled"),
"window-scope window-less click was NOT rejected: {r}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Check the specific desktop_scope_disabled rejection.

This assertion currently passes on any error, including unrelated transport/startup failures. The implementation advertises a structured desktop_scope_disabled contract here, so the test should assert that exact code instead of treating all failures as success.

Suggested fix
     let r = call(&mut fx.stdin, &fx.rx, 30, "click", serde_json::json!({"x": 100, "y": 100}));
-    let txt = result_text(&r).to_lowercase();
-    assert!(
-        is_error(&r) || txt.contains("desktop scope") || txt.contains("desktop_scope_disabled"),
-        "window-scope window-less click was NOT rejected: {r}"
-    );
+    assert!(is_error(&r), "window-scope window-less click was NOT rejected: {r}");
+    assert_eq!(
+        structured(&r)["code"].as_str(),
+        Some("desktop_scope_disabled"),
+        "unexpected rejection payload: {r}"
+    );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fn window_scope_rejects_windowless_click() {
let Some(mut fx) = spawn_driver() else { return };
set_scope(&mut fx, "window");
let r = call(&mut fx.stdin, &fx.rx, 30, "click", serde_json::json!({"x": 100, "y": 100}));
let txt = result_text(&r).to_lowercase();
assert!(
is_error(&r) || txt.contains("desktop scope") || txt.contains("desktop_scope_disabled"),
"window-scope window-less click was NOT rejected: {r}"
fn window_scope_rejects_windowless_click() {
let Some(mut fx) = spawn_driver() else { return };
set_scope(&mut fx, "window");
let r = call(&mut fx.stdin, &fx.rx, 30, "click", serde_json::json!({"x": 100, "y": 100}));
assert!(is_error(&r), "window-scope window-less click was NOT rejected: {r}");
assert_eq!(
structured(&r)["code"].as_str(),
Some("desktop_scope_disabled"),
"unexpected rejection payload: {r}"
);
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/cua-driver/rust/crates/cua-driver/tests/harness_desktop_scope_test.rs`
around lines 257 - 264, Update window_scope_rejects_windowless_click to assert
the exact desktop_scope_disabled rejection from call/result_text instead of
accepting any is_error() outcome; keep the existing setup via spawn_driver,
set_scope, and call, but make the assertion verify the structured error
code/message for the click action rather than unrelated transport or startup
failures.


## Directory layout

```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add a language to this fenced block.

markdownlint is right here: the opening fence should declare a language (for example text) to satisfy MD040.

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 7-7: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/cua-driver/test-harness/TEST_HARNESS_STRUCTURE.md` at line 7, The fenced
code block in TEST_HARNESS_STRUCTURE.md is missing a language declaration, which
triggers markdownlint MD040. Update the opening fence in this markdown snippet
to specify an appropriate language such as text, and keep the rest of the block
unchanged.

Source: Linters/SAST tools

Comment on lines +38 to +45
libs/cua-driver/rust/crates/cua-driver/tests/ ◀── the CONSUMERS (Rust integration tests)
├── harness_wpf_test.rs (Windows)
├── harness_winui3_test.rs (Windows)
├── harness_web_windows_test.rs (Windows — WebView2 + Electron via CDP)
├── harness_bg_modality_test.rs (Windows — focus-steal sentinel + capture_mode)
├── harness_lo_vcl_test.rs (Windows — LibreOffice VCL/SAL via MSAA)
├── harness_appkit_test.rs (macOS)
└── harness_swiftui_test.rs (macOS)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add harness_desktop_scope_test.rs to the consumer lists.

This doc still omits the new desktop-scope test from the crates/cua-driver/tests/ tree and from the WPF coverage row, so the structure overview is already stale relative to this PR.

Suggested fix
 libs/cua-driver/rust/crates/cua-driver/tests/   ◀── the CONSUMERS (Rust integration tests)
 ├── harness_wpf_test.rs           (Windows)
 ├── harness_winui3_test.rs        (Windows)
 ├── harness_web_windows_test.rs   (Windows — WebView2 + Electron via CDP)
 ├── harness_bg_modality_test.rs   (Windows — focus-steal sentinel + capture_mode)
+├── harness_desktop_scope_test.rs (Windows — desktop-scope / foreground modality)
 ├── harness_lo_vcl_test.rs        (Windows — LibreOffice VCL/SAL via MSAA)
@@
-| `windows/wpf` | Windows | `wpf` | UIA Invoke, PostMessage type, right/double-click, scroll, modal MessageBox, owned + layered popups, native child HWNDs, accelerators | `harness_wpf_test`, `harness_bg_modality_test` |
+| `windows/wpf` | Windows | `wpf` | UIA Invoke, PostMessage type, right/double-click, scroll, modal MessageBox, owned + layered popups, native child HWNDs, accelerators | `harness_wpf_test`, `harness_bg_modality_test`, `harness_desktop_scope_test` |

Also applies to: 95-95

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/cua-driver/test-harness/TEST_HARNESS_STRUCTURE.md` around lines 38 - 45,
Add harness_desktop_scope_test.rs to the consumer tree in
TEST_HARNESS_STRUCTURE.md and update the WPF coverage row so the new
desktop-scope integration test is listed alongside the existing
harness_*_test.rs consumers. Keep the structure overview consistent with the
current test harness layout by editing the sections that enumerate
crates/cua-driver/tests and the coverage table entry for WPF.


## Modality coverage — the two halves

```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add a language to this fenced block.

The ASCII modality diagram should use a language tag such as text to satisfy MD040.

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 47-47: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/cua-driver/test-harness/TEST_SUITE.md` at line 47, The fenced ASCII
diagram block in TEST_SUITE.md is missing a language tag, which violates MD040.
Update the Markdown fence for the modality diagram to use an explicit text
language identifier, and keep the diagram content unchanged so the block is
still rendered as plain text. Refer to the fenced block in TEST_SUITE.md when
making the change.

Source: Linters/SAST tools

Comment on lines +77 to +78
## Status of the new test
`harness_desktop_scope_test.rs` is on branch **`test/desktop-scope-harness`** (off latest `main`, which already has #2019). Compile-verifying on the Windows VM; a live run uses the interactive-session method. Not yet PR'd — pending decision on its own PR vs. folding into the harness suite.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Drop the pre-PR status note before merging.

This file ships in the PR, so saying the test is “Not yet PR'd” and tied to a side branch will become false immediately. Replace this section with stable runtime guidance only.

Suggested fix
 ## Status of the new test
-`harness_desktop_scope_test.rs` is on branch **`test/desktop-scope-harness`** (off latest `main`, which already has `#2019`). Compile-verifying on the Windows VM; a live run uses the interactive-session method. Not yet PR'd — pending decision on its own PR vs. folding into the harness suite.
+`harness_desktop_scope_test.rs` is `#[ignore]` and requires a real interactive Windows desktop session for live execution. Compile checks can run on a Windows VM; the behavior checks require the interactive-session method described above.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## Status of the new test
`harness_desktop_scope_test.rs` is on branch **`test/desktop-scope-harness`** (off latest `main`, which already has #2019). Compile-verifying on the Windows VM; a live run uses the interactive-session method. Not yet PR'd — pending decision on its own PR vs. folding into the harness suite.
`harness_desktop_scope_test.rs` is `#[ignore]` and requires a real interactive Windows desktop session for live execution. Compile checks can run on a Windows VM; the behavior checks require the interactive-session method described above.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@libs/cua-driver/test-harness/TEST_SUITE.md` around lines 77 - 78, The “Status
of the new test” note in TEST_SUITE.md is a pre-PR status update that will be
stale once merged. Update this section to remove references to the side branch,
“Not yet PR’d,” and the pending PR decision, and keep only stable guidance about
how to compile-verify and run the harness test using
harness_desktop_scope_test.rs and the interactive-session method.

@github-actions

Copy link
Copy Markdown
Contributor

Linux visual regression artifacts

Matrix jobs now run independently. Download visual artifacts from this workflow run.
Each background-GUI job uploads a .gif of the interaction plus two annotated PNGs (<app>.png raw, <app>-atspi.png with AT-SPI element boxes); the cua-driver-linux-som-overlays artifact adds <app>-som.png cua Set-of-Marks overlays:

  • cua-driver-linux-cursor-click-gif
  • cua-driver-linux-background-terminal-gif
  • cua-driver-linux-parallel-drag-xserver
  • cua-driver-linux-background-gui-chromium
  • cua-driver-linux-background-gui-tk
  • cua-driver-linux-background-gui-gtk3-gedit
  • cua-driver-linux-background-gui-gtk3-mousepad
  • cua-driver-linux-background-gui-gtk3-scite
  • cua-driver-linux-background-gui-gtk4-characters
  • cua-driver-linux-background-gui-qt5-manuskript
  • cua-driver-linux-background-gui-qt5-klog
  • cua-driver-linux-background-gui-qt5-openambit
  • cua-driver-linux-background-gui-qt6-kate
  • cua-driver-linux-background-gui-qt6-kcalc
  • cua-driver-linux-background-gui-qt6-okular
  • cua-driver-linux-background-gui-qt6-qownnotes
  • cua-driver-linux-background-gui-electron-zettlr
  • cua-driver-linux-background-gui-electron-joplin
  • cua-driver-linux-background-gui-electron-logseq
  • cua-driver-linux-som-overlays

Open workflow run and download artifacts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant