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>
77 lines
2.8 KiB
Swift
77 lines
2.8 KiB
Swift
//
|
|
// AppThemeTests.swift
|
|
// Tests iOS
|
|
//
|
|
// App theme tests: browse themes sheet, verify all 12 theme cards exist,
|
|
// and apply a theme without crashing.
|
|
// TC-070
|
|
//
|
|
|
|
import XCTest
|
|
|
|
final class AppThemeTests: BaseUITestCase {
|
|
override var seedFixture: String? { "single_mood" }
|
|
override var bypassSubscription: Bool { true }
|
|
|
|
/// All 12 app theme names (must match the accessibility IDs: apptheme_card_{lowercased name}).
|
|
private let allThemes = [
|
|
"Zen Garden", "Synthwave", "Celestial", "Editorial",
|
|
"Mixtape", "Bloom", "Heartfelt", "Minimal",
|
|
"Luxe", "Forecast", "Playful", "Journal"
|
|
]
|
|
|
|
/// TC-070: Open Browse Themes sheet and verify all 12 theme cards exist.
|
|
func testBrowseThemes_AllCardsExist() {
|
|
let settingsScreen = TabBarScreen(app: app).tapSettings()
|
|
settingsScreen.assertVisible()
|
|
settingsScreen.tapCustomizeTab()
|
|
|
|
let customizeScreen = CustomizeScreen(app: app)
|
|
customizeScreen.openThemePicker()
|
|
|
|
// Verify all 12 theme cards are accessible (some may require scrolling)
|
|
for theme in allThemes {
|
|
let card = customizeScreen.appThemeCard(named: theme)
|
|
card.scrollIntoView(in: app, direction: .up)
|
|
card.waitForExistenceOrFail(
|
|
timeout: defaultTimeout,
|
|
message: "Theme card '\(theme)' should exist in the Browse Themes sheet"
|
|
)
|
|
}
|
|
|
|
captureScreenshot(name: "browse_themes_all_cards")
|
|
}
|
|
|
|
/// TC-070: Apply a theme and verify no crash.
|
|
func testApplyThemes_NoCrash() {
|
|
let tabBar = TabBarScreen(app: app)
|
|
let settingsScreen = tabBar.tapSettings()
|
|
settingsScreen.assertVisible()
|
|
settingsScreen.tapCustomizeTab()
|
|
|
|
let customizeScreen = CustomizeScreen(app: app)
|
|
customizeScreen.openThemePicker()
|
|
|
|
// Tap a theme card, apply it
|
|
let card = customizeScreen.appThemeCard(named: "Zen Garden")
|
|
card.scrollIntoView(in: app, direction: .up)
|
|
card.forceTap()
|
|
|
|
// Apply via the preview apply button
|
|
let applyButton = app.element(UITestID.Customize.previewApplyButton)
|
|
applyButton.waitForExistenceOrFail(timeout: navigationTimeout, message: "Apply button should appear after tapping theme card")
|
|
applyButton.forceTap()
|
|
|
|
// Dismiss the themes sheet
|
|
let doneButton = app.element(UITestID.Customize.pickerDoneButton)
|
|
doneButton.waitForExistenceOrFail(timeout: navigationTimeout, message: "Done button should be visible to dismiss theme picker")
|
|
doneButton.forceTap()
|
|
|
|
// Navigate to Day tab and verify no crash
|
|
tabBar.tapDay()
|
|
DayScreen(app: app).assertAnyEntryExists()
|
|
|
|
captureScreenshot(name: "day_view_after_theme_change")
|
|
}
|
|
}
|