test(desktop-testbed): add a SwiftUI TaskBoard suite, and move the app process out of the surface (ENG-1533)
What
apps/desktop-testbedgets TaskBoard, a SwiftUI app, and an 18-test suite for the surfaces the AppKit form has none of.pnpm --filter @e2e-dev/desktop-testbed testruns it after the default suite.- Two driver fixes it turned up:
screenanddesktop.windows()leave out the "Window sharing" button macOS 27 puts in a recorded window's title bar;- a collapsed toolbar search field reads as the
buttonit is.
- The launched app process moves out of
surface.tsintoapp-process.ts. - The desktop reference says what the two fixes leave out and how the search field reads.
Why
- Testbed: every live bug on #2322-#2324 sat in a surface the testbed had no control for. The SwiftUI window was agreed on #2324 as the follow-up that proves the fixes.
- The two fixes:
- whenever video was on, the Window sharing button showed up in
screenas one of the app's controls, anddesktop.windows()listed it as a second window; - TaskBoard's search field collapses at the window's first size, and read as a read-only text box no fill could reach.
- whenever video was on, the Window sharing button showed up in
- The split:
surface.tswas 1,848 lines, and the launch-and-quit state machine was the part okwasniewski asked to move out on #2323.
How it works
app/macos-swiftui/TaskBoard.swiftis okwasniewski's sample from #2324 plus a Keypad window with no control that takes keyboard focus.scripts/build-macos.shbuilds it beside the sign-in form, ande2e.swiftui.config.tstargets it.tests-swiftui/taskboard.e2e.tscovers the cases #2324 listed, in the background only (the physical-input suite drives the sign-in form): Escape and Enter in a sheet, a check and a stepper as the first action in a fresh sheet, and a read four seconds after a press in a sheet with no pinned window.- It also covers a stepper value it cannot take (each refusal checked by its code and reason), the 200-row list past a sidebar that does not scroll, a popover read as visible, and an alert.
- And the toolbar menu (By Title and By Priority, each checked by the order it gives), a list's text, a tap on row text, tabs in a second window opened with
desktop.waitForWindowand left withdesktop.window({ title }).activate(), anddesktop.keyboard.presson the Keypad (the window API from main's #2403).
system_title_bar_control(crates/e2e-desktop-napi/src/snapshot/chrome.rs, tests insnapshot/tests.rs) treats a direct child of the window as chrome when it is a menu button whose middle lies in the band the window's own title-bar buttons sit in, under one of the windows macOS draws over the title bar as the app's own: an on-screen window at the normal level that accessibility does not list, as the Window sharing button's is (windows::drawn_over_title_bar); an app's own panel there is listed and never counts, and when the accessibility list is empty or names a window with no id, nothing counts. The walk lists those windows only the first time such a menu button turns up, so an ordinary snapshot lists no windows. The button has no identifier and a localized title, so the rule goes by that drawn window; an app's own menu button has none and stays, in the band too.read_treereads the window's chrome once for both the band and the chrome list.- macOS also draws that button as a 66 by 20 point window of the app's own, which no accessibility element stands for.
list(crates/e2e-desktop-napi/src/windows.rs) drops a window the accessibility tree does not list when it lies inside the top 60 points of a window it does list that is on screen, and above that window's bottom edge (drawn_in_title_bar). A helper window over the content, such as Calculator's mode picker, reaches lower and stays. roles.rsreads anAXButtonwith theAXSearchFieldsubrole asbutton. It used to read as a textbox by the subrole alone.AppProcess(packages/desktop/src/app-process.ts) holds the moved code unchanged in behavior. It was moved again after the rebase onto main, from main's own launch code: the token passed as one argument (#2365), the hand-off clause of an unclaimed launch, andwindowReadableinlaunch-wait.ts(#2368), which the surface still calls with therunning_beforelistlaunchnow returns:- the process id, start time, and token, and a launch whose outcome is unknown;
- the launch record and the state directory;
launch,quitNow,running, and the queue that runs one launch or quit at a time.- The surface keeps what reads the screen, and
onGonetells it when the process it read is gone.surface.tsgoes from 1,867 to 1,608 lines. Main's #2458 types the launch options from the crate, andAppProcess.launchkeeps that check (satisfies Partial<LaunchOptions>). initcallsclearLaunchbefore it loads the driver and sweeps old state directories, as before the move, andopencreates the state directory after them.
docs/reference/desktop.mdxsays the Window sharing button and window macOS 27 adds to a recorded window are not read, and that a toolbar search field with no room reads as a Search button. The commit that shortened this stack's rows in the guide is gone: main's #2448 moved those rows into the reference page, where #2356 and #2357 wrote them short.
Issue
The SwiftUI testbed agreed on #2324, and the surface.ts split asked for on #2323.
Verified
Ran it locally: yes (macOS 27.2.1, arm64, background mode), at this head (44da48d83), restacked on main 7c1b2b258 and on this round's fixes in #2356 and #2357. snapshot.rs is 990 lines here: #2356 moved its tests into snapshot/tests.rs, and the title-bar helpers are in snapshot/chrome.rs. Main added tests to the default suite since, hence 31.
pnpm --filter @e2e-dev/desktop-testbed test
Test Files 2 passed (2)
Tests 31 passed (31)
Test Files 1 passed (1)
Tests 18 passed (18)
-
Checks at this head:
pnpm run build,pnpm check,cargo fmt --check, clippy,cargo test(118 passed),native.tsregenerated with no change, and the desktop suite with the addon (340 passed). This PR changes noe2eor@e2e-dev/corecode; the e2e unit suite (5141 passed, 2 skipped) ran at #2357's head. -
Window sharing: at this head the SwiftUI suite passes 18 of 18 with
--video on. While a window is recorded, a probe test finds nobutton "Window sharing", keepsbutton "Sort", and lists one window. That probe passes only because the drawn window is found: without it, the button would be read. Before this round, each of the suite's 21 video files opened inffprobe. Before the window-list fix, the second-window test failed there on an extra "Window" indesktop.windows(). The tree has no "Window sharing" button and keeps the toolbar's "Sort" menu. -
Search field: the filter test passes by tapping
button "Search"first. -
CodeRabbit, after that: a window of the app's own that accessibility lists, such as a utility panel, does not count as drawn over the title bar (unit test); checked live while recording, the Window sharing button is still left out.
-
cubic's findings this round: a menu-level window or a minimized window's frame is not counted as drawn over the title bar (unit test); a drawn window over the toolbar's menu button makes the depth guard's test fail when it is widened; the SwiftUI run writes its report to
.e2e/swiftui; TaskBoard's Keypad keeps one key monitor, takes keypad digits, and lets Command, Control, and Option digits through; each row's priority has its own identifier; TaskBoard asks for macOS 13. -
CodeRabbit's findings, each with a test that fails on the code before it: an app's own menu button directly in the window, in the title-bar band, stays with its menu; a window below a 30-point window's bottom edge is not part of its title bar; By Title sorts the Work project by title (the old app kept "Write release notes" first).
-
Unit tests: a toolbar menu button at the close button's height stays, and the window filter ignores a minimized window and one accessibility does not list. Mutants that widen the title-bar rule to
level >= 2, or drop the on-screen check from the filter, each fail a test. -
An AppKit crash: in two of eight full SwiftUI runs this round, TaskBoard quit mid-test (
APP_NOT_OPEN). Its crash reports all show the sameEXC_GUARDin AppKit's accessibility notification path (_NSAccessibilityNotify,_XMIGPostNotification), with none of the app's own code on the stack. The sign-in form has crashed with the same signature 14 times on this Mac since Nov 26, before this round. The other runs passed 18 of 18. -
A flaky test: "opens a row context menu and chooses an item" failed 2 of 13 runs. Its
secondaryTapreported success, but no menu showed. The cause is not found yet; it reads as a SwiftUI context menu that sometimes does not open in the background. -
Not run:
pnpm test:physical, since it moves the pointer of the person at this Mac, so Escape and Enter in a sheet are checked in the background only. -
Videos from a run before the rebase: adding a task through the sheet, scrolling the 200-row list, the Preferences window's tabs, and keys sent to the Keypad window.
https://github.com/user-attachments/assets/7a8344eb-6d39-4a18-acd7-e2931d867a25
https://github.com/user-attachments/assets/afe17f1d-ba86-4a7a-87a9-2bd0b9217edd
https://github.com/user-attachments/assets/8fb3a547-46f8-4d0b-bb4e-8c0bbc58d5dc
https://github.com/user-attachments/assets/3c3fd1ab-fca6-4f76-988a-e0904bcc58a6
Checklist
- Changeset added (
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only. None: the testbed is private, and the pending.changeset/desktop-native-driver.mdcovers the driver fixes for the release that first ships it. - Breaking change: title carries
!, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md). - Docs updated in the same PR: the
docs/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it.docs/reference/desktop.mdxandAGENTS.md's testbed paragraph. - Contract change: emitted
.d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures. - Engine contract change (
e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.
馃 Generated with Claude Code
Summary by CodeRabbit
- New Features
- Added a macOS task board with task creation, duplication, completion, deletion, search, filtering, sorting, preferences, simulated syncing, and separate windows.
- Added a dedicated end-to-end test suite for the task board, included in the desktop test command.
- Bug Fixes
- Improved handling of app launches and shutdowns, including cases where an app starts late.
- Refined macOS window and accessibility reporting for title-bar controls and toolbar search fields.
- Documentation
- Clarified desktop test commands, including the separate physical-input suite, and documented toolbar search behavior and macOS 27 title-bar window reporting.