Files
Reflect/Tests iOS/AllDayViewStylesTests.swift
Trey t c28d7a59eb Reduce AllDayViewStylesTests to 5 representative styles
Testing all 20 styles in one test causes resource pressure on CI,
leading to app crashes that cascade into 20+ test failures. Sampling
5 representative styles (first, middle, last, scroll-required) still
validates the no-crash guarantee without exhausting simulator resources.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 21:05:54 -06:00

64 lines
2.4 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 representative day view styles and verify no crash.
/// Tests a sample of 5 styles (first, middle, last, and edge cases) to verify
/// stability without exhaustively cycling all 20, which can cause resource pressure.
func testAllDayViewStyles_NoCrash() {
let tabBar = TabBarScreen(app: app)
let customizeScreen = CustomizeScreen(app: app)
// Representative sample: first, a middle one, last, and two requiring scroll
let sampleStyles = ["Classic", "Neon", "Glass", "Orbit", "Minimal"]
for style in sampleStyles {
// 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) {
for _ in 0..<5 {
app.swipeLeft()
if button.waitForExistence(timeout: 1) { break }
}
}
if button.waitForExistence(timeout: 2) {
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
}
// Navigate to Day tab and verify the app didn't crash
tabBar.tapDay()
let entryRow = app.descendants(matching: .any)
.matching(NSPredicate(format: "identifier BEGINSWITH %@", "entry_row_"))
.firstMatch
let moodHeader = app.descendants(matching: .any)
.matching(identifier: "mood_header")
.firstMatch
let entryVisible = entryRow.waitForExistence(timeout: 5)
let headerVisible = moodHeader.waitForExistence(timeout: 3)
XCTAssertTrue(
entryVisible || headerVisible,
"Day view content should be visible after switching to '\(style)' style"
)
}
captureScreenshot(name: "all_day_view_styles_completed")
}
}