Skip to content

test(cua-driver/windows): robustify slider_drag coords + web CDP-port isolation - #2049

Merged
f-trycua merged 1 commit into
mainfrom
test/harness-windows-robustness
Jun 26, 2026
Merged

test(cua-driver/windows): robustify slider_drag coords + web CDP-port isolation#2049
f-trycua merged 1 commit into
mainfrom
test/harness-windows-robustness

Conversation

@f-trycua

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

Copy link
Copy Markdown
Collaborator

Two Windows harness tests flagged in the overnight harness sweep. Both are test-side — the driver paths are correct (VM-confirmed); no driver bug.

harness_wpf_slider_drag

The hardcoded drag y=275 landed ~29px above the slider track (which sits at window-local y≈304, on empty GroupBox space), so the thumb never moved — but the SendInput/foreground-drag path itself is fine: the UIA-Invoke companion (harness_wpf_slider_increase_large) passes, and corrected coords advance the value. Moved the drag to the track row (44,304)→(330,304).

  • ✅ Verified on the VM (Session 2): ✅ Sent drag via SendInput … (358,306)→(644,306)thumb tracked1 passed.
  • TODO (noted in-code): derive the coords from the sld-value element frame for DPI/placement independence.

harness_web_test (CDP-port isolation)

The 5 web tests use fixed CDP ports (9222/9223) + a process-global CUA_DRIVER_CDP_PORT, so they must run serially (--test-threads=1). A prior host still releasing its port let the daemon discover the stale host's pages[0] (the click then lands on the wrong window, counter check fails). Added wait_port_free() before launch to close the teardown-overlap window.

  • ✅ Verified on the VM (serial): 5 passed (incl. harness_electron_click_element: … counter=1).

No driver code touched. (Latent driver hardening noted for later: cdp_list_pages picks pages[0] on a fixed env port with no correlation to the requested window — could hit the wrong Chromium app in production if two expose CDP.)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of automated runs when reusing the same local port, reducing failures caused by stale processes.
    • Made drag interactions in the Windows UI more consistent by using fixed window-relative coordinates, helping avoid misaligned drags on different displays or DPI settings.

… isolation

Both surfaced in the overnight harness sweep; both are TEST-side (the driver
paths are correct, VM-confirmed).

- harness_wpf_slider_drag: the hardcoded drag y=275 landed ~29px ABOVE the
  slider track (which sits at window-local y≈304, on empty GroupBox space), so
  the thumb never moved — the SendInput/foreground-drag path itself is fine (the
  UIA-Invoke companion passes; corrected coords advance the value on the VM).
  Move the drag to the track row (44,304)→(330,304). (TODO: derive from the
  sld-value element frame for DPI independence.)
- harness_web_test: these fixed-CDP-port (9222/9223) tests must run serially;
  a prior host still releasing its port made the daemon discover the stale
  host's page[0] (counter check then fails). Add wait_port_free() before launch
  to close the teardown-overlap window. Run with --test-threads=1.

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 Jun 26, 2026 6:41pm

Request Review

@f-trycua
f-trycua merged commit ab087a8 into main Jun 26, 2026
62 of 63 checks passed
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 792f36d3-1a71-419b-b35b-278f71d8270f

📥 Commits

Reviewing files that changed from the base of the PR and between 6b2b262 and 8e9e9c7.

📒 Files selected for processing (2)
  • libs/cua-driver/rust/crates/cua-driver/tests/harness_web_test.rs
  • libs/cua-driver/rust/crates/cua-driver/tests/harness_wpf_test.rs

📝 Walkthrough

Walkthrough

The web test harness now waits for the fixed CDP port to be free before starting a new session, and the WPF slider drag test now uses explicit window-local coordinates with updated comments.

Changes

Web harness port readiness

Layer / File(s) Summary
Port-free wait before session
libs/cua-driver/rust/crates/cua-driver/tests/harness_web_test.rs
A polling helper checks localhost TCP availability for the CDP port and is called before spawning the harness host.

WPF slider drag coordinates

Layer / File(s) Summary
Window-local drag inputs
libs/cua-driver/rust/crates/cua-driver/tests/harness_wpf_test.rs
The slider drag command replaces screen-derived coordinates with documented window-local values for the track and thumb.

Sequence Diagram(s)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • trycua/cua#1705: Changes in this PR update the same WPF slider drag test and coordinate inputs.
  • trycua/cua#1708: This PR also adjusts drag coordinate handling to resolve a coordinate-space mismatch.

Poem

A bunny hopped by CDP’s door,
Waited till the port bound no more.
🐇 Then slid with care,
Through window-space air,
And landed the drag right on the floor.

✨ 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/harness-windows-robustness

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.

@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