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

@@ -2,12 +2,12 @@
// Tests_iOS.swift
// Tests iOS
//
// Created by Trey Tartt on 1/10/22.
// Unit tests for date utility logic.
//
import XCTest
// Local copy UI test target cannot @testable import Reflect
// Local copy -- UI test target cannot @testable import Reflect
private extension Date {
static func dates(from fromDate: Date, toDate: Date, includingToDate: Bool = false) -> [Date] {
var dates: [Date] = []
@@ -32,32 +32,26 @@ private extension Date {
}
}
class Tests_iOS: XCTestCase {
override func setUpWithError() throws {
continueAfterFailure = false
}
override func tearDownWithError() throws {
}
final class Tests_iOS: XCTestCase {
func testDatesBetween() {
let today = Calendar.current.date(bySettingHour: 0, minute: 0, second: 0, of: Date())!
let yesterday = Calendar.current.date(byAdding: .day, value: -1, to: today)!
let tenDaysAgo = Calendar.current.date(byAdding: .day, value: -10, to: today)!
let dates = Date.dates(from: Calendar.current.date(byAdding: .day, value: -10, to: Date())!, toDate: Date())
let dates = Date.dates(from: tenDaysAgo, toDate: today)
XCTAssertTrue(dates.last == yesterday)
XCTAssertTrue(dates.first == tenDaysAgo)
XCTAssertEqual(dates.last, yesterday, "Last date should be yesterday (exclusive end)")
XCTAssertEqual(dates.first, tenDaysAgo, "First date should be ten days ago")
}
func testDatesIncluding() {
let today = Calendar.current.date(bySettingHour: 0, minute: 0, second: 0, of: Date())!
let tenDaysAgo = Calendar.current.date(byAdding: .day, value: -10, to: today)!
let dates = Date.dates(from: Calendar.current.date(byAdding: .day, value: -10, to: Date())!, toDate: Date(), includingToDate: true)
let dates = Date.dates(from: tenDaysAgo, toDate: today, includingToDate: true)
XCTAssertTrue(dates.last == today)
XCTAssertTrue(dates.first == tenDaysAgo)
XCTAssertEqual(dates.last, today, "Last date should be today (inclusive end)")
XCTAssertEqual(dates.first, tenDaysAgo, "First date should be ten days ago")
}
}