Add Tests iOS/Screens/ page objects and fix gitignore

The screens/ gitignore rule was matching Tests iOS/Screens/ on
case-insensitive macOS. Anchored to /screens/ (repo root only) so
the 7 UI test page object files are no longer ignored.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-02-17 13:15:21 -06:00
parent 187c45598f
commit 10581cc8fb
8 changed files with 492 additions and 1 deletions

View File

@@ -0,0 +1,62 @@
//
// 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.
/// These use accessibilityLabel (the mood name text), not identifiers.
func moodButton(label: String) -> XCUIElement {
app.buttons.matching(NSPredicate(format: "label CONTAINS[cd] %@", label)).firstMatch
}
// MARK: - Actions
func dismiss() {
doneButton.tapWhenReady()
}
func selectMood(_ mood: MoodChoice) {
let button = moodButton(label: mood.rawValue.capitalized)
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
)
}
}