feat(ios): replay recorded alert surfaces on the host

Merged
TH
1mo ago
+1123-152

Stacked on #4113.

Summary

A corpus of real accessibility trees, replayed on the host:

  • Rules in one place: AlertSurface in AgentDeviceSnapshotPresentation decides which node counts as each kind of prompt (alert, sheet, Safari dialog, dismiss popup), which window hosts it, and the presentation compared after a tap. The runner's post-tap check now calls it, and the runner's duplicate rule code is gone.
  • Corpus: each file in apple/snapshot-presentation/Tests/AlertSurfaceCorpus/ holds a recorded tree plus a reviewed expect. swift test replays every file in the required macOS lane.
  • Capture: pnpm capture:alert-surface --udid --bundle --name runs a runner test method on the simulator, with no wire or CLI change. Its README covers the workflow.
  • First fixtures: SpringBoard and Safari "Open in app" prompts on an iPhone Duo, folded and unfolded, plus a screen with no prompt.

Limit: the corpus covers paths that read snapshot trees. The SpringBoard alert search and taps read XCUIElement.frame, which on a foldable is in a different coordinate space, so the corpus doesn't cover them.

Validation

  • pnpm check:affected --run --head fea511f262: passed.
  • swift test --package-path apple/snapshot-presentation: passed.
    • Removing the Safari rule fails 4 assertions.
  • Runner alert unit tests, iPad sim: 42 pass. The capture test skips itself when the script didn't start it.

šŸ¤– Generated with Claude Code