App fixes: - Remove empty_state identifier from EmptyHomeView VStack (was overriding mood_header) - Fix resetAppState to set needsOnboarding=true (fresh state) instead of false - Set bypassSubscription explicitly based on launch arg presence (was defaulting to true in DEBUG) Test fixes: - TabBarScreen: use coordinate tap to avoid iOS 26 Liquid Glass hittability issues - SettingsScreen: use coordinate tap for segments, handle Settings label ambiguity with tab bar - EntryDetailScreen: use mood_button_ identifiers instead of label matching (was matching entry rows) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
72 lines
1.7 KiB
Swift
72 lines
1.7 KiB
Swift
//
|
|
// TabBarScreen.swift
|
|
// Tests iOS
|
|
//
|
|
// Screen object for the main tab bar navigation.
|
|
//
|
|
|
|
import XCTest
|
|
|
|
struct TabBarScreen {
|
|
let app: XCUIApplication
|
|
|
|
// MARK: - Tab Buttons (using localized labels)
|
|
|
|
var dayTab: XCUIElement { app.tabBars.buttons["Day"] }
|
|
var monthTab: XCUIElement { app.tabBars.buttons["Month"] }
|
|
var yearTab: XCUIElement { app.tabBars.buttons["Year"] }
|
|
var insightsTab: XCUIElement { app.tabBars.buttons["Insights"] }
|
|
var settingsTab: XCUIElement { app.tabBars.buttons["Settings"] }
|
|
|
|
// MARK: - Actions
|
|
|
|
@discardableResult
|
|
func tapDay() -> DayScreen {
|
|
tapTab(dayTab)
|
|
return DayScreen(app: app)
|
|
}
|
|
|
|
@discardableResult
|
|
func tapMonth() -> TabBarScreen {
|
|
tapTab(monthTab)
|
|
return self
|
|
}
|
|
|
|
@discardableResult
|
|
func tapYear() -> TabBarScreen {
|
|
tapTab(yearTab)
|
|
return self
|
|
}
|
|
|
|
@discardableResult
|
|
func tapInsights() -> TabBarScreen {
|
|
tapTab(insightsTab)
|
|
return self
|
|
}
|
|
|
|
@discardableResult
|
|
func tapSettings() -> SettingsScreen {
|
|
tapTab(settingsTab)
|
|
return SettingsScreen(app: app)
|
|
}
|
|
|
|
// MARK: - Assertions
|
|
|
|
func assertDayTabSelected() {
|
|
XCTAssertTrue(dayTab.isSelected, "Day tab should be selected")
|
|
}
|
|
|
|
func assertTabBarVisible() {
|
|
XCTAssertTrue(dayTab.waitForExistence(timeout: 5), "Tab bar should be visible")
|
|
}
|
|
|
|
// MARK: - Private
|
|
|
|
/// Tap a tab bar button. Uses coordinate tap to avoid iOS 26 Liquid Glass
|
|
/// overlay elements reporting buttons as not hittable.
|
|
private func tapTab(_ tab: XCUIElement) {
|
|
_ = tab.waitForExistence(timeout: 5)
|
|
tab.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
|
}
|
|
}
|