Rewrite all UI tests following fail-fast TEST_RULES patterns

Rewrote 60+ test files to follow honeydue-style test guidelines:
- defaultTimeout=2s, navigationTimeout=5s — fail fast, no long waits
- No coordinate taps (except onboarding paged TabView swipes)
- No sleep(), no retry loops
- No guard...else { return } silent passes — XCTFail everywhere
- All elements by accessibility ID via UITestID constants
- Screen objects for all navigation/actions/assertions
- One logical assertion per test method

Added missing accessibility identifiers to app views:
- MonthView.swift: added AccessibilityID.MonthView.grid to ScrollView
- YearView.swift: added AccessibilityID.YearView.heatmap to ScrollView

Framework rewrites:
- BaseUITestCase: added session ID, localeArguments, extraLaunchArguments
- WaitHelpers: waitForExistenceOrFail, waitUntilHittableOrFail,
  waitForNonExistence, scrollIntoView, forceTap
- All 7 screen objects rewritten with fail-fast semantics
- TEST_RULES.md added with non-negotiable rules

Known remaining issues:
- OnboardingTests: paged TabView swipes unreliable on iOS 26 simulator
- SettingsLegalLinksTests: EULA/Privacy buttons too deep in DEBUG scroll
- Customization horizontal picker scrolling needs further tuning

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Trey T
2026-03-24 17:00:30 -05:00
parent 2ef1c1ec51
commit d97db4910e
70 changed files with 1609 additions and 1874 deletions

View File

@@ -10,24 +10,30 @@ import XCTest
final class SecondaryTabTests: BaseUITestCase {
override var seedFixture: String? { "week_of_moods" }
/// Navigate to Month tab and verify content loads.
/// Navigate to Month tab and verify the month grid loads.
func testMonthTab_LoadsContent() {
let tabBar = TabBarScreen(app: app)
tabBar.tapMonth()
// Month view should have some content loaded look for the "Month" header text
// or the month grid area. The tab should at minimum be selected.
XCTAssertTrue(tabBar.monthTab.isSelected, "Month tab should be selected")
let monthGrid = app.element(UITestID.Month.grid)
monthGrid.waitForExistenceOrFail(
timeout: navigationTimeout,
message: "Month grid should be visible after tapping Month tab"
)
captureScreenshot(name: "month_tab")
}
/// Navigate to Year tab and verify content loads.
/// Navigate to Year tab and verify the stats section loads.
func testYearTab_LoadsContent() {
let tabBar = TabBarScreen(app: app)
tabBar.tapYear()
XCTAssertTrue(tabBar.yearTab.isSelected, "Year tab should be selected")
let statsSection = app.element(UITestID.Year.statsSection)
statsSection.waitForExistenceOrFail(
timeout: navigationTimeout,
message: "Year stats section should be visible after tapping Year tab"
)
captureScreenshot(name: "year_tab")
}
@@ -37,13 +43,10 @@ final class SecondaryTabTests: BaseUITestCase {
let tabBar = TabBarScreen(app: app)
tabBar.tapInsights()
XCTAssertTrue(tabBar.insightsTab.isSelected, "Insights tab should be selected")
// Verify the Insights header text is visible
let insightsHeader = app.element(UITestID.Insights.header)
XCTAssertTrue(
insightsHeader.waitForExistence(timeout: 5),
"Insights header should be visible"
insightsHeader.waitForExistenceOrFail(
timeout: navigationTimeout,
message: "Insights header should be visible"
)
captureScreenshot(name: "insights_tab")