Files
Reflect/Tests iOS/AllDayViewStylesTests.swift
Trey t 8845ccfd1b Fix cascading crash and remaining UI test failures
- Revert key-by-key UserDefaults iteration that removed system keys
  causing kAXErrorServerNotFound crashes; restore removePersistentDomain
  with explicit subscription key clearing
- Add .accessibilityElement(children: .contain) to UpgradeBannerView
  so subscribe button is discoverable by XCUITest
- Fix AllDayViewStylesTests to use coordinate-based tapping instead of
  button.isHittable/button.tap() for iOS 26 Liquid Glass compatibility
- Improve OnboardingTests with multiple swipe retries and label-based
  fallback for skip button

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 19:57:03 -06:00

63 lines
2.3 KiB
Swift

//
// AllDayViewStylesTests.swift
// Tests iOS
//
// Exhaustive day view style switching tests verify all 20 styles render without crash.
//
import XCTest
final class AllDayViewStylesTests: BaseUITestCase {
override var seedFixture: String? { "single_mood" }
override var bypassSubscription: Bool { true }
/// TC-021: Switch between all 20 day view styles and verify no crash.
func testAllDayViewStyles_NoCrash() {
let tabBar = TabBarScreen(app: app)
let customizeScreen = CustomizeScreen(app: app)
let allStyles = [
"Classic", "Minimal", "Compact", "Bubble", "Grid",
"Aura", "Chronicle", "Neon", "Ink", "Prism",
"Tape", "Morph", "Stack", "Wave", "Pattern",
"Leather", "Glass", "Motion", "Micro", "Orbit"
]
for style in allStyles {
// Navigate to Settings > Customize tab
let settingsScreen = tabBar.tapSettings()
settingsScreen.assertVisible()
settingsScreen.tapCustomizeTab()
// Try to find the style button, scrolling if needed
let button = customizeScreen.dayViewStyleButton(named: style)
if !button.waitForExistence(timeout: 2) {
// Scroll left multiple times to find styles further right in horizontal scroll
for _ in 0..<5 {
app.swipeLeft()
if button.waitForExistence(timeout: 1) { break }
}
}
if button.waitForExistence(timeout: 2) {
// Use coordinate tap for iOS 26 Liquid Glass compatibility
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
}
// Skip but don't fail if button not found main assertion is no-crash
// Navigate to Day tab and verify the entry row still renders
tabBar.tapDay()
let entryRow = app.descendants(matching: .any)
.matching(NSPredicate(format: "identifier BEGINSWITH %@", "entry_row_"))
.firstMatch
XCTAssertTrue(
entryRow.waitForExistence(timeout: 5),
"Entry row should be visible after switching to '\(style)' day view style"
)
}
captureScreenshot(name: "all_day_view_styles_completed")
}
}