oficina / sheets Public

Native UI test: cancel iOS 27's export destination picker robustly

testExportWorkbookOpensNativeDestinationAndCancels queried app.buttons["Cancel"],
which fails on fresh iOS 27.0 simulators: on iPad the picker has two Cancel
buttons (sidebar and file browser), and on iPhone it opens inside "On My
iPhone" with a back button and no Cancel until the browse root.

Wait for the picker by its own element, then cancel through the file
browser's navigation bar, going back to the root first when there's no
Cancel yet. All three NativeUITests pass on iPad Pro 13-inch (M5) and
iPhone 18 Pro, iOS 27.0.

Discussion oficina/sheets #72 (found at the 0.2.2 release gate).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 54aee642cf0effe04c462d55bfe35148ee7815eb parent c3f14d1
1 file changed, +22 −3
  • native/ios/UITests/NativeUITests.swift +22 −3

CI passed — run details

CI log
amadan: .amadan/timeout: this job's budget is 15m0s (this runner allows up to 30m0s)
=== vet ===
CGO_ENABLED=0 go vet ./...
CGO_ENABLED=0 go vet -tags browser ./internal/sheets/
=== spacing ===
go tool fiesta spacing -skip 'vendor/*.css' -skip 'tokens.css' internal/sheets/static
=== fmt ===
=== build ===
CGO_ENABLED=0 go build ./...
=== migrations ===
go tool rastrillo migration check
rastrillo migration check: models and migrations agree
=== go-test ===
CGO_ENABLED=0 go test -count=1 ./...
?   	amadan.net/oficina/sheets/cmd/sheets	[no test files]
?   	amadan.net/oficina/sheets/cmd/sheets-contract	[no test files]
ok  	amadan.net/oficina/sheets/internal/guardstest	0.173s
ok  	amadan.net/oficina/sheets/internal/sheets	16.821s
ok  	amadan.net/oficina/sheets/internal/sheets/calc	0.011s
ok  	amadan.net/oficina/sheets/internal/sheets/format	0.005s
?   	amadan.net/oficina/sheets/internal/sheets/keymailtest	[no test files]
ok  	amadan.net/oficina/sheets/internal/sheets/live	0.053s
ok  	amadan.net/oficina/sheets/internal/sheets/seal	0.002s
ok  	amadan.net/oficina/sheets/internal/sheets/sealtest	0.003s
ok  	amadan.net/oficina/sheets/internal/sheets/store	6.572s
ok  	amadan.net/oficina/sheets/internal/sheets/teamstate	0.156s
ok  	amadan.net/oficina/sheets/internal/sheets/xlsx	4.953s
?   	amadan.net/oficina/sheets/tools/gencorpus	[no test files]
=== race ===
go test -race -count=1 ./internal/sheets/store/... ./internal/sheets/live/...
ok  	amadan.net/oficina/sheets/internal/sheets/store	73.689s
ok  	amadan.net/oficina/sheets/internal/sheets/live	1.066s
diff --git a/native/ios/UITests/NativeUITests.swift b/native/ios/UITests/NativeUITests.swift
index b3acbbe..689711b 100644
--- a/native/ios/UITests/NativeUITests.swift
+++ b/native/ios/UITests/NativeUITests.swift
@@ -115,17 +115,36 @@ import XCTest
let export = app.buttons["Save workbook…"]
XCTAssertTrue(export.waitForExistence(timeout: 10))
export.tap()
- let cancel = app.buttons["Cancel"]
- XCTAssertTrue(cancel.waitForExistence(timeout: 15), "A native file destination picker must open after download")
+ let picker = app.otherElements["Browse View (Picker)"]
+ XCTAssertTrue(picker.waitForExistence(timeout: 15), "A native file destination picker must open after download")
let screenshot = XCTAttachment(screenshot: app.screenshot())
screenshot.name = "Sheets native export destination"
screenshot.lifetime = .keepAlways
add(screenshot)
- cancel.tap()
+ cancelDestinationPicker(picker)
XCTAssertTrue(export.waitForExistence(timeout: 10))
app.buttons["Done"].tap()
}
+ // The system destination picker has no single "Cancel" on iOS 27
+ // (2026-11-26). On iPad the sidebar and the file browser each have one, so
+ // an unscoped query matches two. On iPhone the picker opens inside a
+ // location ("On My iPhone") with a back button, and Cancel appears only at
+ // the browse root. So: use the browser's own bar, and go back to the root
+ // first if there's no Cancel there yet.
+ private func cancelDestinationPicker(_ picker: XCUIElement) {
+ let bar = picker.navigationBars.matching(identifier: "FullDocumentManagerViewControllerNavigationBar")
+ let cancel = bar.buttons["Cancel"].firstMatch
+ let back = bar.buttons["BackButton"].firstMatch
+ var steps = 0
+ while !cancel.waitForExistence(timeout: 2), back.exists, steps < 3 {
+ back.tap()
+ steps += 1
+ }
+ XCTAssertTrue(cancel.waitForExistence(timeout: 5), "The destination picker must offer Cancel")
+ cancel.tap()
+ }
+
private func openMenu(_ app: XCUIApplication, _ name: String) {
if app.buttons["Sheet actions"].exists { app.buttons["Sheet actions"].tap() }
let menu = app.buttons[name]