fix(macos): connect the runner process to the window server before XCTest events
Merged
TH
1mo ago+9+9+0123456789-0-0-0123456789
Summary
With Xcode 27.2 the macOS runner aborts in CGS_REQUIRE_INIT on the first synthesized event (click, tap, fill, scroll). The UI-test runner never touches NSApplication, so the process is not connected to the window server when XCTest reaches SLSGetDisplaysWithRect. RunnerTests now touches NSApplication.shared in a macOS-only class setUp, the fix the reporter ran locally.
1 file. No source-text test: no existing guard asserts runner Swift content, so a text pin would be a new pattern. Fixes #4142
Validation
- The crash itself is not reproduced here: the host has Xcode 27.1. The reporter verified the fix on Xcode 27.2 (click,
fill,scrollon Brave, no assert). - Compiles:
pnpm build:xcuitest:macos. - Live on the macOS host with this branch's runner, TextEdit via
--platform macos:click,fill("Filled 10 chars", text visible in the document) andscroll downall succeeded. A stray system "PosterBoard quit unexpectedly" dialog was on the desktop, so the 27.1 run does not prove the 27.2 fix. pnpm check:affected --run --head 6fc856b486: passed,exactCommit=true.- CI: the Apple macOS lane builds and runs the runner.
š¤ Generated with Claude Code