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>
63 lines
1.7 KiB
Swift
63 lines
1.7 KiB
Swift
//
|
|
// EntryDetailScreen.swift
|
|
// Tests iOS
|
|
//
|
|
// Screen object for the Entry Detail sheet (edit mood, notes, delete).
|
|
//
|
|
|
|
import XCTest
|
|
|
|
struct EntryDetailScreen {
|
|
let app: XCUIApplication
|
|
|
|
// MARK: - Elements
|
|
|
|
var navigationTitle: XCUIElement { app.navigationBars["Entry Details"] }
|
|
var doneButton: XCUIElement { app.buttons["entry_detail_done"] }
|
|
var deleteButton: XCUIElement { app.buttons["entry_detail_delete"] }
|
|
var moodGrid: XCUIElement { app.otherElements["entry_detail_mood_grid"] }
|
|
|
|
/// Mood buttons inside the detail sheet's mood grid.
|
|
/// Match by the mood_button_ identifier prefix to avoid matching entry rows.
|
|
func moodButton(for mood: MoodChoice) -> XCUIElement {
|
|
app.buttons["mood_button_\(mood.rawValue)"]
|
|
}
|
|
|
|
// MARK: - Actions
|
|
|
|
func dismiss() {
|
|
doneButton.tapWhenReady()
|
|
}
|
|
|
|
func selectMood(_ mood: MoodChoice) {
|
|
let button = moodButton(for: mood)
|
|
button.tapWhenReady()
|
|
}
|
|
|
|
func deleteEntry() {
|
|
deleteButton.tapWhenReady()
|
|
// Confirm the delete alert
|
|
let deleteAlert = app.alerts["Delete Entry"]
|
|
let confirmButton = deleteAlert.buttons["Delete"]
|
|
confirmButton.tapWhenReady()
|
|
}
|
|
|
|
// MARK: - Assertions
|
|
|
|
func assertVisible(file: StaticString = #file, line: UInt = #line) {
|
|
XCTAssertTrue(
|
|
navigationTitle.waitForExistence(timeout: 5),
|
|
"Entry Detail sheet should be visible",
|
|
file: file, line: line
|
|
)
|
|
}
|
|
|
|
func assertDismissed(file: StaticString = #file, line: UInt = #line) {
|
|
XCTAssertTrue(
|
|
navigationTitle.waitForDisappearance(timeout: 5),
|
|
"Entry Detail sheet should be dismissed",
|
|
file: file, line: line
|
|
)
|
|
}
|
|
}
|