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

@@ -16,16 +16,15 @@ final class CustomizationTests: BaseUITestCase {
let tabBar = TabBarScreen(app: app)
let settingsScreen = tabBar.tapSettings()
settingsScreen.assertVisible()
settingsScreen.tapCustomizeTab()
let customizeScreen = CustomizeScreen(app: app)
// Should already be on Customize sub-tab
// Theme buttons are: System, iFeel, Dark, Light
let themeNames = ["System", "iFeel", "Dark", "Light"]
for themeName in themeNames {
let button = app.buttons["customize_theme_\(themeName.lowercased())"]
if button.waitForExistence(timeout: 3) {
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
}
customizeScreen.selectTheme(themeName)
}
captureScreenshot(name: "theme_modes_cycled")
@@ -36,31 +35,21 @@ final class CustomizationTests: BaseUITestCase {
let tabBar = TabBarScreen(app: app)
let settingsScreen = tabBar.tapSettings()
settingsScreen.assertVisible()
settingsScreen.tapCustomizeTab()
let customizeScreen = CustomizeScreen(app: app)
// Voting layout names (from VotingLayoutStyle enum)
let layouts = ["Horizontal", "Cards", "Stacked", "Aura", "Orbit", "Neon"]
for layout in layouts {
let button = app.buttons["customize_voting_\(layout.lowercased())"]
if button.waitForExistence(timeout: 2) {
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
} else {
// Scroll right to find it
app.swipeLeft()
if button.waitForExistence(timeout: 2) {
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
}
}
customizeScreen.selectVotingLayout(layout)
}
captureScreenshot(name: "voting_layouts_cycled")
// Navigate to Day tab to verify the voting layout renders
tabBar.tapDay()
let moodHeader = app.otherElements["mood_header"]
// Header may or may not be visible depending on whether today has been voted
// Either way, no crash is the main assertion
assertDayContentVisible()
captureScreenshot(name: "day_view_after_layout_change")
}
@@ -69,35 +58,21 @@ final class CustomizationTests: BaseUITestCase {
let tabBar = TabBarScreen(app: app)
let settingsScreen = tabBar.tapSettings()
settingsScreen.assertVisible()
settingsScreen.tapCustomizeTab()
let customizeScreen = CustomizeScreen(app: app)
// Test a representative sample of day view styles (testing all 20+ would be slow)
let styles = ["Classic", "Minimal", "Compact", "Bubble", "Grid", "Neon"]
for style in styles {
let button = app.buttons["customize_daystyle_\(style.lowercased())"]
if button.waitForExistence(timeout: 2) {
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
} else {
// Scroll to find it
app.swipeLeft()
if button.waitForExistence(timeout: 2) {
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
}
}
customizeScreen.selectDayViewStyle(style)
}
captureScreenshot(name: "day_styles_cycled")
// Navigate to Day tab to verify the style renders with data
tabBar.tapDay()
let entryRow = app.descendants(matching: .any)
.matching(NSPredicate(format: "identifier BEGINSWITH %@", "entry_row_"))
.firstMatch
XCTAssertTrue(
entryRow.waitForExistence(timeout: 5),
"Entry row should be visible with the new style"
)
assertDayContentVisible()
captureScreenshot(name: "day_view_after_style_change")
}