Stabilize iOS UI test foundation and fix flaky suites

This commit is contained in:
Trey t
2026-02-17 22:24:08 -06:00
parent c28d7a59eb
commit 56ac783219
38 changed files with 543 additions and 585 deletions

View File

@@ -28,31 +28,12 @@ final class IconPackTests: BaseUITestCase {
let tabBar = TabBarScreen(app: app)
let settingsScreen = tabBar.tapSettings()
settingsScreen.assertVisible()
// Should already be on Customize sub-tab
// Scroll down to find the icon pack section (VStack layout)
app.swipeUp()
settingsScreen.tapCustomizeTab()
let customizeScreen = CustomizeScreen(app: app)
for pack in allIconPacks {
let button = app.buttons["customize_iconpack_\(pack)"]
// Icon packs are in a vertical stack scroll down to find buttons.
if !button.waitForExistence(timeout: 2) {
app.swipeUp()
}
if !button.waitForExistence(timeout: 1) {
app.swipeUp()
}
if !button.waitForExistence(timeout: 1) {
// Try scrolling back up in case we overshot
app.swipeDown()
}
if button.waitForExistence(timeout: 3) {
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
} else {
XCTFail("Icon pack button '\(pack)' should exist in the customize view")
}
customizeScreen.selectIconPack(pack)
XCTAssertTrue(customizeScreen.iconPackButton(named: pack).exists, "Icon pack button '\(pack)' should exist in the customize view")
}
captureScreenshot(name: "icon_packs_cycled")
@@ -60,13 +41,7 @@ final class IconPackTests: BaseUITestCase {
// Navigate to Day tab and verify no crash entry row should still exist
tabBar.tapDay()
let entryRow = app.descendants(matching: .any)
.matching(NSPredicate(format: "identifier BEGINSWITH %@", "entry_row_"))
.firstMatch
XCTAssertTrue(
entryRow.waitForExistence(timeout: 5),
"Entry row should still be visible after cycling icon packs (no crash)"
)
assertDayContentVisible()
captureScreenshot(name: "day_view_after_icon_pack_change")
}
@@ -76,15 +51,12 @@ final class IconPackTests: BaseUITestCase {
let tabBar = TabBarScreen(app: app)
let settingsScreen = tabBar.tapSettings()
settingsScreen.assertVisible()
// Scroll down to the icon pack section
app.swipeUp()
settingsScreen.tapCustomizeTab()
let customizeScreen = CustomizeScreen(app: app)
for pack in allIconPacks {
let button = app.buttons["customize_iconpack_\(pack)"]
if !button.exists {
app.swipeUp()
}
let button = customizeScreen.iconPackButton(named: pack)
if !button.exists { _ = app.swipeUntilExists(button, direction: .up, maxSwipes: 6) }
XCTAssertTrue(
button.waitForExistence(timeout: 3),
"Icon pack button '\(pack)' should exist"