Skip to content

Commit 49821f4

Browse files
committed
Fix Windows e2e tests: xa11y 0.7 supports Windows input + screenshot
xa11y 0.7 uses SendInput (click/key/type/scroll) and GDI (screenshot) on Windows, so the five "fails gracefully on windows" tests that expected "not supported" errors are now wrong. Remove them and extend the existing platform-agnostic success tests to run on Windows too. type_text gets a Windows variant that types without a prior focus step (Notepad is running from CI setup and holds keyboard focus). https://claude.ai/code/session_01VtV1Fz3AhvrgTgoiz7ouFz
1 parent c06ff98 commit 49821f4

1 file changed

Lines changed: 3 additions & 48 deletions

File tree

tests/e2e_live.rs

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ fn notepad_pid() -> String {
3232
// =============================================================================
3333

3434
#[test]
35-
#[cfg(any(target_os = "linux", target_os = "macos"))]
3635
fn screenshot_captures_a_file() {
3736
let tmp = tempfile::TempDir::new().unwrap();
3837
let output = tmp.path().join("screen.png");
@@ -44,16 +43,6 @@ fn screenshot_captures_a_file() {
4443
assert!(meta.len() > 100, "screenshot should be a real image");
4544
}
4645

47-
#[test]
48-
#[cfg(target_os = "windows")]
49-
fn screenshot_fails_gracefully_on_windows() {
50-
agent_desktop()
51-
.args(["screenshot", "--output", "C:\\Temp\\screen.png"])
52-
.assert()
53-
.failure()
54-
.stderr(predicate::str::contains("not supported"));
55-
}
56-
5746
// =============================================================================
5847
// Observe
5948
// =============================================================================
@@ -298,24 +287,13 @@ fn read_clipboard_fails_gracefully_on_windows() {
298287
// =============================================================================
299288

300289
#[test]
301-
#[cfg(any(target_os = "linux", target_os = "macos"))]
302290
fn click_at_coordinates() {
303291
agent_desktop()
304292
.args(["click", "--x", "100", "--y", "100"])
305293
.assert()
306294
.success();
307295
}
308296

309-
#[test]
310-
#[cfg(target_os = "windows")]
311-
fn click_fails_gracefully_on_windows() {
312-
agent_desktop()
313-
.args(["click", "--x", "100", "--y", "100"])
314-
.assert()
315-
.failure()
316-
.stderr(predicate::str::contains("not supported"));
317-
}
318-
319297
#[test]
320298
fn click_without_args_fails() {
321299
agent_desktop()
@@ -367,47 +345,25 @@ fn click_element_by_query() {
367345
// =============================================================================
368346

369347
#[test]
370-
#[cfg(any(target_os = "linux", target_os = "macos"))]
371348
fn scroll_down() {
372349
agent_desktop()
373350
.args(["scroll", "--direction", "down"])
374351
.assert()
375352
.success();
376353
}
377354

378-
#[test]
379-
#[cfg(target_os = "windows")]
380-
fn scroll_fails_gracefully_on_windows() {
381-
agent_desktop()
382-
.args(["scroll", "--direction", "down"])
383-
.assert()
384-
.failure()
385-
.stderr(predicate::str::contains("not supported"));
386-
}
387-
388355
// =============================================================================
389356
// Key press
390357
// =============================================================================
391358

392359
#[test]
393-
#[cfg(any(target_os = "linux", target_os = "macos"))]
394360
fn key_press() {
395361
agent_desktop()
396362
.args(["key", "--name", "escape"])
397363
.assert()
398364
.success();
399365
}
400366

401-
#[test]
402-
#[cfg(target_os = "windows")]
403-
fn key_press_fails_gracefully_on_windows() {
404-
agent_desktop()
405-
.args(["key", "--name", "escape"])
406-
.assert()
407-
.failure()
408-
.stderr(predicate::str::contains("not supported"));
409-
}
410-
411367
// =============================================================================
412368
// Type text
413369
// =============================================================================
@@ -440,12 +396,11 @@ fn type_text() {
440396

441397
#[test]
442398
#[cfg(target_os = "windows")]
443-
fn type_text_fails_gracefully_on_windows() {
399+
fn type_text() {
444400
agent_desktop()
445-
.args(["type", "--text", "hello"])
401+
.args(["type", "--text", "hello from CI"])
446402
.assert()
447-
.failure()
448-
.stderr(predicate::str::contains("not supported"));
403+
.success();
449404
}
450405

451406
// =============================================================================

0 commit comments

Comments
 (0)