Files
Reflect/Tests iOS/IconPackTests.swift
Trey t 224341fd98 Fix remaining 17 UI test failures: group defaults, identifiers, hittability, date format
- resetAppState: use correct suite name to clear group defaults (fixes stale subscription state)
- Reorder configureIfNeeded: set expireTrial before IAPManager init
- Add browse_themes_button identifier to CustomizeView Browse Themes button
- Add mood_button_* identifiers to Entry Detail mood grid in NoteEditorView
- Use coordinate-based tap throughout all test screens (iOS 26 Liquid Glass hittability)
- Fix HeaderMoodLogging date format: M/d/yyyy → yyyy/MM/dd to match entry_row identifiers
- AppLaunchTests: wait for isSelected state with NSPredicate instead of immediate check
- OnboardingTests: add waits between swipes and retry logic for skip button

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 16:46:18 -06:00

88 lines
2.7 KiB
Swift

//
// IconPackTests.swift
// Tests iOS
//
// Icon pack tests: select each of the 7 icon packs and verify no crash.
// TC-072
//
import XCTest
final class IconPackTests: BaseUITestCase {
override var seedFixture: String? { "single_mood" }
override var bypassSubscription: Bool { true }
/// All 7 icon pack accessibility identifiers (lowercased enum case names).
private let allIconPacks = [
"fontawesome",
"emoji",
"handemjoi",
"weather",
"garden",
"hearts",
"cosmic"
]
/// TC-072: Select each of 7 icon packs without crashing.
func testIconPacks_AllSelectable() {
let tabBar = TabBarScreen(app: app)
let settingsScreen = tabBar.tapSettings()
settingsScreen.assertVisible()
// Should already be on Customize sub-tab
// Scroll down to find the icon pack section
app.swipeUp()
for pack in allIconPacks {
let button = app.buttons["customize_iconpack_\(pack)"]
if !button.exists {
// Scroll more to reveal buttons off-screen
app.swipeUp()
}
if button.waitForExistence(timeout: 3) {
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
} else {
XCTFail("Icon pack button '\(pack)' should exist in the customize view")
}
}
captureScreenshot(name: "icon_packs_cycled")
// Navigate to Day tab and verify no crash entry row should still exist
tabBar.tapDay()
let entryRow = app.descendants(matching: .any)
.matching(NSPredicate(format: "identifier BEGINSWITH %@", "entry_row_"))
.firstMatch
XCTAssertTrue(
entryRow.waitForExistence(timeout: 5),
"Entry row should still be visible after cycling icon packs (no crash)"
)
captureScreenshot(name: "day_view_after_icon_pack_change")
}
/// TC-072: Verify each icon pack button exists in the customize view.
func testIconPacks_AllButtonsExist() {
let tabBar = TabBarScreen(app: app)
let settingsScreen = tabBar.tapSettings()
settingsScreen.assertVisible()
// Scroll down to the icon pack section
app.swipeUp()
for pack in allIconPacks {
let button = app.buttons["customize_iconpack_\(pack)"]
if !button.exists {
app.swipeUp()
}
XCTAssertTrue(
button.waitForExistence(timeout: 3),
"Icon pack button '\(pack)' should exist"
)
}
captureScreenshot(name: "icon_packs_all_buttons")
}
}