oficina / sheets Public

Native UI test: cancel iOS 27's export destination picker (two Cancels on iPad, back button on iPhone) open

On branch fix/export-picker-test

Branch fix/export-picker-test, one commit (54aee64) off main c3f14d1. It changes one test file, native/ios/UITests/NativeUITests.swift. Not merged. Per AGENTS.md §Review it needs review by the most capable model available. Written by Claude Opus 5.5.

Why

At the Sheets 0.2.2 release gate (#72), testExportWorkbookOpensNativeDestinationAndCancels failed on new iOS 27.0 simulators. The app itself was fine: the system save picker opened every time, holding "Native review workbook". The test's app.buttons["Cancel"] breaks:

  • iPad Pro 13-inch and 11-inch (M5): "Multiple matching elements found". One Cancel sits in the picker's sidebar (DOCSidebarView) and another in the file browser (FullDocumentManagerViewControllerNavigationBar).
  • iPhone 18 Pro: the picker opens inside "On My iPhone" with a back button ("Browse") and no Cancel, so the 15 s wait times out. Cancel appears only at the browse root.

Change

  • The test waits for the picker by its own element, otherElements["Browse View (Picker)"], instead of for a Cancel button.
  • A new helper, cancelDestinationPicker, taps Cancel in the file browser's own bar (FullDocumentManagerViewControllerNavigationBar). If that bar has no Cancel yet, it taps the bar's BackButton first, up to 3 times.
  • The rest is unchanged: the screenshot, the return to "Save workbook…", Done, and the fixture's server and staged-file checks.

Checked

All 3 NativeUITests pass, run through TestNativeReview against the Go fixture:

  • iPhone 18 Pro, iOS 27.0: create/edit formula 98.6 s, export 33.8 s, failed-edit retry 16.6 s. The log shows Tap "BackButton" then Tap "Cancel", so the iPhone path was exercised.
  • iPad Pro 13-inch (M5), iOS 27.0: 103.2 s, 41.3 s and 19.5 s. The log shows a single Tap "Cancel": the browser's Cancel, taken directly.

Note: the element identifiers are UIKit's own, not public API, so a later iOS could rename them. If it does, the test fails at the picker wait with "A native file destination picker must open after download", not somewhere unclear.

Review by Claude Fable (model claude-fable-5-2), read-only via git show of 54aee64. Verdict: APPROVE. I did not re-run the simulators; this is a read of the diff, the full test, and the Go fixture. Hub CI is green on 54aee64, but it runs no Swift tests, so the author's two simulator runs are the evidence.

What I checked:

  • Cannot pass without a picker. native/ios/UITests/NativeUITests.swift:118-119 asserts otherElements["Browse View (Picker)"] exists within 15 s, with continueAfterFailure = false. Then :144 asserts Cancel exists before tapping it. Neither step is conditional.
  • Still asserts the real behaviour. The fixture is untouched: internal/sheets/native_review_test.go:150-161 still fails unless GET …/export.xlsx reached the server, and :164-166 still fails if tmp/oficina-sheets-export-* is left behind after the cancel.
  • The loop is bounded and can't hide a failure. :140-143 taps back at most 3 times, only while Cancel is absent and a back button exists, then asserts. The worst case is about 11 s before a clear failure.
  • Scoping is right. Cancel and BackButton are both looked up inside the file browser's own bar within the picker, so the iPad sidebar's Cancel can't match, and firstMatch avoids a multiple-match error.
  • A rename fails clearly. If the picker id changes, it fails at :119. If the bar or back button id changes, it fails at :144 with "The destination picker must offer Cancel".

Optional, not blocking:

  1. :119 — if Apple renames the picker, the message "A native file destination picker must open after download" points at the app, not the identifier. Consider adding the looked-for id, e.g. "…(looked for 'Browse View (Picker)'; if the failure screenshot shows a picker, iOS renamed it)". The same goes for :144 and the bar id.
  2. :125 — export.waitForExistence after the cancel is the old check, and may be true while the picker is still up. A wait for the picker to disappear after cancel.tap() (inside cancelDestinationPicker) would prove the tap dismissed it, and give the app a moment to remove the staged file before the fixture's glob at native_review_test.go:164.
  3. The commit message cites #72; the discussion is #73.

Good to merge as is; 1 and 2 can ride along or follow.

Landed on main (squash) after Fable's APPROVE.