- 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>
67 lines
1.9 KiB
Swift
67 lines
1.9 KiB
Swift
//
|
|
// CustomizeScreen.swift
|
|
// Tests iOS
|
|
//
|
|
// Screen object for the Customize sub-tab — theme, voting layout, and day view style pickers.
|
|
//
|
|
|
|
import XCTest
|
|
|
|
struct CustomizeScreen {
|
|
let app: XCUIApplication
|
|
|
|
// MARK: - Theme Mode Buttons
|
|
|
|
func themeButton(named name: String) -> XCUIElement {
|
|
app.buttons["customize_theme_\(name.lowercased())"]
|
|
}
|
|
|
|
// MARK: - Voting Layout Buttons
|
|
|
|
func votingLayoutButton(named name: String) -> XCUIElement {
|
|
app.buttons["customize_voting_\(name.lowercased())"]
|
|
}
|
|
|
|
// MARK: - Day View Style Buttons
|
|
|
|
func dayViewStyleButton(named name: String) -> XCUIElement {
|
|
app.buttons["customize_daystyle_\(name.lowercased())"]
|
|
}
|
|
|
|
// MARK: - Actions
|
|
|
|
func selectTheme(_ name: String) {
|
|
let button = themeButton(named: name)
|
|
_ = button.waitForExistence(timeout: 5)
|
|
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
|
}
|
|
|
|
func selectVotingLayout(_ name: String) {
|
|
let button = votingLayoutButton(named: name)
|
|
if button.exists && !button.isHittable {
|
|
app.swipeLeft()
|
|
}
|
|
_ = button.waitForExistence(timeout: 5)
|
|
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
|
}
|
|
|
|
func selectDayViewStyle(_ name: String) {
|
|
let button = dayViewStyleButton(named: name)
|
|
if button.exists && !button.isHittable {
|
|
app.swipeLeft()
|
|
}
|
|
_ = button.waitForExistence(timeout: 5)
|
|
button.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
|
|
}
|
|
|
|
// MARK: - Assertions
|
|
|
|
func assertThemeButtonExists(_ name: String, file: StaticString = #file, line: UInt = #line) {
|
|
XCTAssertTrue(
|
|
themeButton(named: name).waitForExistence(timeout: 5),
|
|
"Theme button '\(name)' should exist",
|
|
file: file, line: line
|
|
)
|
|
}
|
|
}
|