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>
64 lines
1.6 KiB
Swift
64 lines
1.6 KiB
Swift
//
|
|
// NoteEditorScreen.swift
|
|
// Tests iOS
|
|
//
|
|
// Screen object for the Journal Note editor sheet.
|
|
//
|
|
|
|
import XCTest
|
|
|
|
struct NoteEditorScreen {
|
|
let app: XCUIApplication
|
|
|
|
// MARK: - Elements
|
|
|
|
var navigationTitle: XCUIElement { app.navigationBars["Journal Note"] }
|
|
var textEditor: XCUIElement { app.textViews["note_editor_text"] }
|
|
var saveButton: XCUIElement { app.buttons["note_editor_save"] }
|
|
var cancelButton: XCUIElement { app.buttons["note_editor_cancel"] }
|
|
|
|
// MARK: - Actions
|
|
|
|
func typeNote(_ text: String) {
|
|
textEditor.tapWhenReady()
|
|
textEditor.typeText(text)
|
|
}
|
|
|
|
func clearAndTypeNote(_ text: String) {
|
|
textEditor.tapWhenReady()
|
|
// Select all and replace
|
|
textEditor.press(forDuration: 1.0)
|
|
let selectAll = app.menuItems["Select All"]
|
|
if selectAll.waitForExistence(timeout: 2) {
|
|
selectAll.tap()
|
|
}
|
|
textEditor.typeText(text)
|
|
}
|
|
|
|
func save() {
|
|
saveButton.tapWhenReady()
|
|
}
|
|
|
|
func cancel() {
|
|
cancelButton.tapWhenReady()
|
|
}
|
|
|
|
// MARK: - Assertions
|
|
|
|
func assertVisible(file: StaticString = #file, line: UInt = #line) {
|
|
XCTAssertTrue(
|
|
navigationTitle.waitForExistence(timeout: 5),
|
|
"Note editor should be visible",
|
|
file: file, line: line
|
|
)
|
|
}
|
|
|
|
func assertDismissed(file: StaticString = #file, line: UInt = #line) {
|
|
XCTAssertTrue(
|
|
navigationTitle.waitForDisappearance(timeout: 5),
|
|
"Note editor should be dismissed",
|
|
file: file, line: line
|
|
)
|
|
}
|
|
}
|