Files
Reflect/Tests iOS/AppLaunchTests.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

61 lines
2.0 KiB
Swift

//
// AppLaunchTests.swift
// Tests iOS
//
// App launch and tab bar navigation tests.
//
import XCTest
final class AppLaunchTests: BaseUITestCase {
override var seedFixture: String? { "empty" }
/// Verify the app launches to the Day tab and all 5 tabs are visible.
func testAppLaunches_TabBarVisible() {
let tabBar = TabBarScreen(app: app)
tabBar.assertTabBarVisible()
// All 5 tabs should exist
XCTAssertTrue(tabBar.dayTab.exists, "Day tab should exist")
XCTAssertTrue(tabBar.monthTab.exists, "Month tab should exist")
XCTAssertTrue(tabBar.yearTab.exists, "Year tab should exist")
XCTAssertTrue(tabBar.insightsTab.exists, "Insights tab should exist")
XCTAssertTrue(tabBar.settingsTab.exists, "Settings tab should exist")
captureScreenshot(name: "app_launched")
}
/// Navigate through every tab and verify each loads.
func testTabNavigation_AllTabsAccessible() {
let tabBar = TabBarScreen(app: app)
// Month tab
tabBar.tapMonth()
assertTabSelected(tabBar.monthTab, name: "Month")
// Year tab
tabBar.tapYear()
assertTabSelected(tabBar.yearTab, name: "Year")
// Insights tab
tabBar.tapInsights()
assertTabSelected(tabBar.insightsTab, name: "Insights")
// Settings tab
tabBar.tapSettings()
assertTabSelected(tabBar.settingsTab, name: "Settings")
// Back to Day
tabBar.tapDay()
assertTabSelected(tabBar.dayTab, name: "Day")
}
/// Wait for a tab to become selected (iOS 26 Liquid Glass may delay state updates).
private func assertTabSelected(_ tab: XCUIElement, name: String, timeout: TimeInterval = 3) {
let predicate = NSPredicate(format: "isSelected == true")
let expectation = XCTNSPredicateExpectation(predicate: predicate, object: tab)
let result = XCTWaiter.wait(for: [expectation], timeout: timeout)
XCTAssertEqual(result, .completed, "\(name) tab should be selected")
}
}