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:
@@ -16,43 +16,41 @@ final class YearViewCollapseTests: BaseUITestCase {
|
||||
let tabBar = TabBarScreen(app: app)
|
||||
tabBar.tapYear()
|
||||
|
||||
XCTAssertTrue(tabBar.yearTab.isSelected, "Year tab should be selected")
|
||||
|
||||
// Stats section is visible by default (showStats = true)
|
||||
// Stats section is visible by default
|
||||
let statsSection = app.element(UITestID.Year.statsSection)
|
||||
XCTAssertTrue(
|
||||
statsSection.waitForExistence(timeout: 8),
|
||||
"Year stats section should be visible initially"
|
||||
statsSection.waitForExistenceOrFail(
|
||||
timeout: navigationTimeout,
|
||||
message: "Year stats section should be visible initially"
|
||||
)
|
||||
|
||||
// Find the current year's card header button
|
||||
let currentYear = Calendar.current.component(.year, from: Date())
|
||||
let headerButton = app.element(UITestID.Year.cardHeader(year: currentYear))
|
||||
XCTAssertTrue(
|
||||
headerButton.waitForExistence(timeout: 5),
|
||||
"Year card header for \(currentYear) should be visible"
|
||||
headerButton.waitUntilHittableOrFail(
|
||||
timeout: navigationTimeout,
|
||||
message: "Year card header for \(currentYear) should be hittable"
|
||||
)
|
||||
|
||||
captureScreenshot(name: "year_stats_expanded")
|
||||
|
||||
// Tap header to collapse stats
|
||||
headerButton.tap()
|
||||
headerButton.forceTap()
|
||||
|
||||
// Stats section should disappear
|
||||
XCTAssertTrue(
|
||||
statsSection.waitForDisappearance(timeout: 3),
|
||||
"Stats section should collapse after tapping header"
|
||||
statsSection.waitForNonExistence(
|
||||
timeout: defaultTimeout,
|
||||
message: "Stats section should collapse after tapping header"
|
||||
)
|
||||
|
||||
captureScreenshot(name: "year_stats_collapsed")
|
||||
|
||||
// Tap header again to expand stats
|
||||
headerButton.tap()
|
||||
headerButton.forceTap()
|
||||
|
||||
// Stats section should reappear
|
||||
XCTAssertTrue(
|
||||
statsSection.waitForExistence(timeout: 3),
|
||||
"Stats section should expand after tapping header again"
|
||||
statsSection.waitForExistenceOrFail(
|
||||
timeout: defaultTimeout,
|
||||
message: "Stats section should expand after tapping header again"
|
||||
)
|
||||
|
||||
captureScreenshot(name: "year_stats_re_expanded")
|
||||
|
||||
Reference in New Issue
Block a user