Fix remaining 9 UI test failures: subscription state, scroll, timing

- Replace removePersistentDomain with key-by-key removal in resetAppState
  (removePersistentDomain is unreliable on app group UserDefaults suites)
- Add explicit cache clearing in IAPManager.resetForTesting() to prevent
  stale cachedSubscriptionExpiration from restoring .subscribed state
- Use descendants(matching: .any) for upgrade_banner and subscribe_button
  queries (VStack may not match otherElements in SwiftUI)
- Add multiple swipe attempts for icon pack horizontal scroll
- Use coordinate-based drag for onboarding paged TabView advancement
- Add longer wait for Day view refresh after theme change
- Add multiple scroll attempts to find clear data button in Settings

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-02-17 19:13:18 -06:00
parent c286294cd3
commit 9157fd2577
7 changed files with 67 additions and 19 deletions

View File

@@ -355,6 +355,15 @@ class IAPManager: ObservableObject {
func resetForTesting() {
state = .unknown
lastStatusCheckTime = nil
currentProduct = nil
availableProducts = []
// Explicitly clear cached subscription state to prevent async
// checkSubscriptionStatus from restoring stale .subscribed state.
GroupUserDefaults.groupDefaults.removeObject(forKey: UserDefaultsStore.Keys.cachedSubscriptionExpiration.rawValue)
GroupUserDefaults.groupDefaults.set(false, forKey: UserDefaultsStore.Keys.hasActiveSubscription.rawValue)
GroupUserDefaults.groupDefaults.synchronize()
updateTrialState()
}
#endif