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:
@@ -11,40 +11,39 @@ final class PersonalityPackTests: BaseUITestCase {
|
||||
override var seedFixture: String? { "single_mood" }
|
||||
override var bypassSubscription: Bool { true }
|
||||
|
||||
/// TC-052: Selecting a different personality pack updates the checkmark.
|
||||
/// TC-052: Selecting Coach personality pack renders without crash.
|
||||
func testPersonalityPack_SelectCoach() {
|
||||
let tabBar = TabBarScreen(app: app)
|
||||
let settingsScreen = tabBar.tapSettings()
|
||||
let settingsScreen = TabBarScreen(app: app).tapSettings()
|
||||
settingsScreen.assertVisible()
|
||||
settingsScreen.tapCustomizeTab()
|
||||
|
||||
let customizeScreen = CustomizeScreen(app: app)
|
||||
|
||||
// Scroll down to personality pack section and select "Coach"
|
||||
customizeScreen.selectPersonalityPack("Coach")
|
||||
|
||||
// Verify the Coach button is now selected — checkmark image should appear
|
||||
let checkmark = app.images.matching(
|
||||
NSPredicate(format: "label CONTAINS 'checkmark'")
|
||||
).firstMatch
|
||||
|
||||
// The Coach pack button should exist and the checkmark should be near it
|
||||
let coachButton = customizeScreen.personalityPackButton(named: "Coach")
|
||||
XCTAssertTrue(
|
||||
coachButton.exists,
|
||||
"Coach personality pack button should still be visible after selection"
|
||||
)
|
||||
// Verify the Coach button still exists after selection
|
||||
customizeScreen.personalityPackButton(named: "Coach")
|
||||
.waitForExistenceOrFail(
|
||||
timeout: defaultTimeout,
|
||||
message: "Coach personality pack button should be visible after selection"
|
||||
)
|
||||
|
||||
captureScreenshot(name: "personality_pack_coach_selected")
|
||||
}
|
||||
|
||||
// Switch to a different pack to verify we can cycle
|
||||
/// TC-052: Switching between personality packs works without crash.
|
||||
func testPersonalityPack_SwitchToZen() {
|
||||
let settingsScreen = TabBarScreen(app: app).tapSettings()
|
||||
settingsScreen.assertVisible()
|
||||
settingsScreen.tapCustomizeTab()
|
||||
|
||||
let customizeScreen = CustomizeScreen(app: app)
|
||||
customizeScreen.selectPersonalityPack("Zen")
|
||||
|
||||
let zenButton = customizeScreen.personalityPackButton(named: "Zen")
|
||||
XCTAssertTrue(
|
||||
zenButton.exists,
|
||||
"Zen personality pack button should be visible after selection"
|
||||
)
|
||||
customizeScreen.personalityPackButton(named: "Zen")
|
||||
.waitForExistenceOrFail(
|
||||
timeout: defaultTimeout,
|
||||
message: "Zen personality pack button should be visible after selection"
|
||||
)
|
||||
|
||||
captureScreenshot(name: "personality_pack_zen_selected")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user