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

@@ -66,17 +66,19 @@ enum UITestMode {
GroupUserDefaults.groupDefaults.set(false, forKey: UserDefaultsStore.Keys.needsOnboarding.rawValue)
}
#if DEBUG
IAPManager.shared.bypassSubscription = bypassSubscription
#endif
if expireTrial {
// Set firstLaunchDate to 31 days ago so the 30-day trial is expired
// Set firstLaunchDate to 31 days ago so the 30-day trial is expired.
// Must run BEFORE IAPManager.shared is accessed so the async status
// check sees the expired date.
let expiredDate = Calendar.current.date(byAdding: .day, value: -31, to: Date())!
GroupUserDefaults.groupDefaults.set(expiredDate, forKey: UserDefaultsStore.Keys.firstLaunchDate.rawValue)
GroupUserDefaults.groupDefaults.synchronize()
}
#if DEBUG
IAPManager.shared.bypassSubscription = bypassSubscription
#endif
// Seed fixture data if requested
if let fixture = seedFixture {
seedData(fixture: fixture)
@@ -86,11 +88,10 @@ enum UITestMode {
/// Reset all user defaults and persisted state for a clean test run
@MainActor
private static func resetAppState() {
// Clear group user defaults
// Clear group user defaults using the correct suite name
let defaults = GroupUserDefaults.groupDefaults
if let bundleId = Bundle.main.bundleIdentifier {
defaults.removePersistentDomain(forName: bundleId)
}
defaults.removePersistentDomain(forName: Constants.currentGroupShareId)
// Reset key defaults explicitly (true = fresh install state where onboarding is needed)
defaults.set(true, forKey: UserDefaultsStore.Keys.needsOnboarding.rawValue)
defaults.set(0, forKey: UserDefaultsStore.Keys.votingLayoutStyle.rawValue) // horizontal