From e3c02a0544d5d6b025c3df7d19970df16440c100 Mon Sep 17 00:00:00 2001 From: osy Date: Mon, 16 Nov 2026 01:44:00 -0800 Subject: [PATCH] tests: find the back button outside the navigation bar on an open iPhone Duo On the iPhone Duo, the details of a VM have their toolbar, back button included, in a column beside them instead of a navigation bar. backToLibrary() only looked in the navigation bars, so the two library flow tests that go back to the list after creating a VM failed there ("utm.library.card.UI Test VM did not appear") although the VM was created. Look for the back button anywhere in the app. Assisted-by: Claude:claude-opus-5-5 --- Tests/UITests/iOS/UTMUITestCase.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Tests/UITests/iOS/UTMUITestCase.swift b/Tests/UITests/iOS/UTMUITestCase.swift index f5240678f2..894a38b741 100644 --- a/Tests/UITests/iOS/UTMUITestCase.swift +++ b/Tests/UITests/iOS/UTMUITestCase.swift @@ -58,10 +58,12 @@ class UTMUITestCase: XCTestCase { } /// Returns from the details of a VM to the library; an iPhone pushes the details, an - /// iPad shows them next to the list. + /// iPad shows them next to the list. The back button is in the navigation bar, except + /// where the details' toolbar is a column beside them (an open iPhone Duo). func backToLibrary() { - let back = app.navigationBars.buttons["BackButton"].firstMatch - if back.waitForExistence(timeout: 2) { + let backButtons = app.buttons.matching(identifier: "BackButton") + if backButtons.firstMatch.waitForExistence(timeout: 2), + let back = backButtons.allElementsBoundByIndex.first(where: \.isHittable) { back.tap() } }