test(desktop-testbed): cover every desktop capability the sign-in form does not (ENG-1533)
What
The desktop testbed (apps/desktop-testbed) gets a Controls window, opened from the sign-in form, with one control for each engine capability the form does not reach. Its suites cover those controls on the native driver:
tests/controls.e2e.ts: scrolling a list until a row shows and selecting it, rows and cells found by their text and a row selected by tapping its cell, a two-column table selected by a row's whole text with a label two rows show refused, keys into a field of an app in the background, typing that stops when a key opens another window (directly, and after a Tab), typing text with two-unit characters, a context menu, a slider, a tap on a disabled button refused, a select and a check that wait for a list and a box the app enables half a second later, and a content button with the close-button subrole that stays while the window's own title-bar buttons are left out.tests/sign-in.e2e.tsalso types a username with a capital and a password through key events, checks a tap on the password field puts the keyboard there, selects from a Plan menu a tap already opened, both another option and the one shown, which must close the menu, chooses the enabled one of two options of one title, refuses a disabled option by name, and checks a key pressed into the password field arrives there.- The Controls window also has an
NSTabView: a test reads its tabs, the active one selected, switches them, and selects one through its tab list by label. tests-headed/physical.e2e.ts(pnpm test:headed, which moves your pointer): a double-click, a double-click on the disabled button refused, a key pressed into a field of a window another holds the keyboard from, a hover, and a tap at a point that must put focus in the field, followed by typing through the real keyboard.
Third of four PRs for ENG-1533 (#2322, #2323, #2324, #2325), based on the engine switch in #2323. #2322 is merged; this PR and #2325 merge after #2323.
Why
The sign-in form reaches fill, check, select, tap, and screenshots only. The engine switch also changed scrolling, menus, background keys, and physical input, and none of them had a test on a real app.
How it works
app/macos/main.swiftadds the Controls window: a table of 40 items, an Accounts table with two columns and two alike rows, a Note field that reports Enter, an Options button with a context menu, a Volume slider, a disabled button, an Enable later button that enables a Size list and an Agree box half a second after it is pressed, a button that reports a double-click, and a view that reports a hover. Each reports to one status label (controls-status), except the hover view, which has its own (hover-status): a pointer left over it by the headed suite enters it again when a menu closes, and must not overwrite what another test reads. The double-click button is anNSButtonsubclass that reads the click count from the mouse-down event. A double-click gesture recognizer on a plain button never fired, since the button takes the mouse-down itself.tests/controls.e2e.tsopens the window inbeforeEach, waits untildesktop.windows()lists both windows, and picks the Controls window withdesktop.useWindow. Every test checks the status label, which shows the app saw the input, or a control's value; the slider test checks both. The Note test clears the field before its second entry and checks the submitted text exactly. The suite uses no physical input, and the app no longer activates itself at launch, so it runs in the background (open -g) unless the run is headed. The keyboard test checks, before and after its keys, that the app in front is not the testbed app (tests/frontmost.ts, throughlsappinfo, which needs no Automation permission; fallow ignores it as an unlisted binary). The Opener field opens a Popup window and moves the keyboard there on its first character: one test types into it, one Tabs into it from the Note, and both check that the typing stops and the Popup field stays empty. The typing test types characters of two UTF-16 units each (š,šš½) and checks the field holds the text whole; AppKit would rejoin a split pair, so it does not test how the driver cuts text, which the driver's unit tests do.e2e.headed.config.tsrunstests-headed/withdesktop({ headed: true })and one worker.package.jsonaddstest:headed, which typechecks first, astestdoes, andtsconfig.jsonincludes the headed config and suite. The tap-at-a-point test checks the field took focus before it types, since typing alone would focus it.AGENTS.mddescribes the three suites and how to run them.
Not here yet: okwasniewski's list of SwiftUI cases (a sheet, a popover, a stepper, a dismissing alert, two scroll areas, a 200-row list, an app with no focusable control), each of which fails on an earlier head. The screen here is locked, so they could not be run, and a test that never ran is not added. They are a follow-up.
Issue
Refs ENG-1533
Verified
Ran it locally: yes, on this Mac with the screen unlocked, Accessibility and Screen Recording granted, and the driver built from this stack's head: pnpm test 23 of 23 (several runs) and pnpm test:headed 5 of 5. The row and cell test, the two-column test, and both open-menu tests fail against the driver without their fixes in #2322. The first runs after a rebuild of the app twice met a crash of the app inside AppKit's own accessibility notification code (a mach port guard, also seen once before this change); later runs had none. The two typing-into-a-new-window tests were also run against the driver without the per-key wait (#2322): the first fails 2 of 3 times there and the Tab one 2 of 3, and both pass 3 of 3 with it. The keyboard test's frontmost check was checked by opening the app in front, where lsappinfo names it. michal-e2e also ran the suites live at 63a08edf6 and fcb32fcd9. pnpm --filter @e2e-dev/desktop-testbed typecheck passes.
$ node node_modules/e2e/dist/cli/bin.js run
ā |macos| tests/controls.e2e.ts (13 tests)
ā |macos| tests/sign-in.e2e.ts (10 tests)
Tests 23 passed (23)
$ node node_modules/e2e/dist/cli/bin.js run --config e2e.headed.config.ts
ā |macos| tests-headed/physical.e2e.ts > physical input > double-clicks a control with the real pointer
ā |macos| tests-headed/physical.e2e.ts > physical input > refuses to double-click a disabled control
ā |macos| tests-headed/physical.e2e.ts > physical input > presses a key into a field of a window another holds the keyboard from
ā |macos| tests-headed/physical.e2e.ts > physical input > hovers a view with the real pointer
ā |macos| tests-headed/physical.e2e.ts > physical input > taps a point in the window and types through the real keyboard
Tests 5 passed (5)
The typing test also passes with a driver that cuts text at a fixed 16 units, since AppKit rejoins a split pair. It covers typing such text end to end. It does not prove the boundary rule, which matters for toolkits that decode each key event alone.
No CI job runs the testbed yet: it needs a Mac with both permissions granted.
š¤ Generated with Claude Code