- IconPackTests: Use swipeUp instead of swipeLeft since icon packs are in a VStack (vertical layout), not horizontal scroll - AppThemeTests: Verify sheet dismissal, accept mood header as alternative to entry row after theme change - SettingsActionTests: Add wait for SwiftData propagation after clearing data, increase timeouts for view refresh Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
97 lines
3.0 KiB
Swift
97 lines
3.0 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 (VStack layout)
|
|
app.swipeUp()
|
|
|
|
for pack in allIconPacks {
|
|
let button = app.buttons["customize_iconpack_\(pack)"]
|
|
|
|
// Icon packs are in a vertical stack — scroll down to find buttons.
|
|
if !button.waitForExistence(timeout: 2) {
|
|
app.swipeUp()
|
|
}
|
|
if !button.waitForExistence(timeout: 1) {
|
|
app.swipeUp()
|
|
}
|
|
if !button.waitForExistence(timeout: 1) {
|
|
// Try scrolling back up in case we overshot
|
|
app.swipeDown()
|
|
}
|
|
|
|
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")
|
|
}
|
|
}
|