Fix remaining 17 UI test failures: group defaults, identifiers, hittability, date format

- 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>
This commit is contained in:
Trey t
2026-02-17 16:46:18 -06:00
parent 44b46f88e2
commit 224341fd98
13 changed files with 89 additions and 60 deletions

View File

@@ -24,43 +24,43 @@ final class OnboardingTests: BaseUITestCase {
captureScreenshot(name: "onboarding_welcome")
// Swipe to Time screen
app.swipeLeft()
// Swipe through screens with waits to ensure page transitions complete
swipeAndWait() // Welcome Time
captureScreenshot(name: "onboarding_time")
// Swipe to Day screen
app.swipeLeft()
swipeAndWait() // Time Day
// Select "Today" if the button exists
let todayButton = app.descendants(matching: .any)
.matching(identifier: "onboarding_day_today")
.firstMatch
if todayButton.waitForExistence(timeout: 3) {
todayButton.tap()
todayButton.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
}
captureScreenshot(name: "onboarding_day")
// Swipe to Style screen
app.swipeLeft()
swipeAndWait() // Day Style
captureScreenshot(name: "onboarding_style")
// Swipe to Subscription screen
app.swipeLeft()
swipeAndWait() // Style Subscription
captureScreenshot(name: "onboarding_subscription")
// Tap "Maybe Later" to complete onboarding
let skipButton = app.descendants(matching: .any)
.matching(identifier: "onboarding_skip_button")
.firstMatch
// If skip button isn't visible, try one more swipe (in case a page was added)
if !skipButton.waitForExistence(timeout: 5) {
swipeAndWait()
}
XCTAssertTrue(
skipButton.waitForExistence(timeout: 5),
"Skip/Maybe Later button should exist on subscription screen"
)
skipButton.tap()
skipButton.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
// After onboarding, the tab bar should appear
let tabBar = app.tabBars.firstMatch
@@ -81,16 +81,19 @@ final class OnboardingTests: BaseUITestCase {
if welcomeText.waitForExistence(timeout: 5) {
// Swipe through all screens
app.swipeLeft() // -> Time
app.swipeLeft() // -> Day
app.swipeLeft() // -> Style
app.swipeLeft() // -> Subscription
swipeAndWait() // Time
swipeAndWait() // Day
swipeAndWait() // Style
swipeAndWait() // Subscription
let skipButton = app.descendants(matching: .any)
.matching(identifier: "onboarding_skip_button")
.firstMatch
if !skipButton.waitForExistence(timeout: 5) {
swipeAndWait()
}
if skipButton.waitForExistence(timeout: 5) {
skipButton.tap()
skipButton.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
}
}
@@ -127,4 +130,11 @@ final class OnboardingTests: BaseUITestCase {
captureScreenshot(name: "no_onboarding_on_relaunch")
}
/// Swipe left with a brief wait for the page transition to settle.
private func swipeAndWait() {
app.swipeLeft()
// Allow the paged TabView animation to settle
_ = app.waitForExistence(timeout: 0.5)
}
}