oficina / sheets Public

Sheets native UI test: cancel the iOS 27 export picker robustly

The export test waits for the system picker itself, taps Cancel in the
file browser's own bar (the iPad shows a second Cancel in its sidebar),
and on iPhone backs out to the root first. It still requires the export
to reach the fixture server and no staged file to remain.

Discussion oficina/sheets #73. Reviewed by Claude Fable 5.2: APPROVE.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 8b693efd368264c2c1e3af8e4fa3abe49582c9dd parent c3f14d1
1 file changed, +22 −3
  • native/ios/UITests/NativeUITests.swift +22 −3
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]