Fix cascading crash and remaining UI test failures

- Revert key-by-key UserDefaults iteration that removed system keys
  causing kAXErrorServerNotFound crashes; restore removePersistentDomain
  with explicit subscription key clearing
- Add .accessibilityElement(children: .contain) to UpgradeBannerView
  so subscribe button is discoverable by XCUITest
- Fix AllDayViewStylesTests to use coordinate-based tapping instead of
  button.isHittable/button.tap() for iOS 26 Liquid Glass compatibility
- Improve OnboardingTests with multiple swipe retries and label-based
  fallback for skip button

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-02-17 19:57:03 -06:00
parent 9157fd2577
commit 8845ccfd1b
4 changed files with 36 additions and 17 deletions

View File

@@ -92,12 +92,15 @@ enum UITestMode {
/// Reset all user defaults and persisted state for a clean test run
@MainActor
private static func resetAppState() {
// Clear group user defaults by iterating all keys.
// removePersistentDomain(forName:) is unreliable on app group suites.
let defaults = GroupUserDefaults.groupDefaults
for key in defaults.dictionaryRepresentation().keys {
defaults.removeObject(forKey: key)
}
// Clear group user defaults using the suite domain name
defaults.removePersistentDomain(forName: Constants.currentGroupShareId)
// Explicitly clear subscription cache keys that may survive removePersistentDomain
// on app group suites (known reliability issue).
defaults.removeObject(forKey: UserDefaultsStore.Keys.cachedSubscriptionExpiration.rawValue)
defaults.removeObject(forKey: UserDefaultsStore.Keys.hasActiveSubscription.rawValue)
defaults.removeObject(forKey: UserDefaultsStore.Keys.firstLaunchDate.rawValue)
// Reset key defaults explicitly (true = fresh install state where onboarding is needed)
defaults.set(true, forKey: UserDefaultsStore.Keys.needsOnboarding.rawValue)

View File

@@ -148,6 +148,7 @@ struct UpgradeBannerView: View {
RoundedRectangle(cornerRadius: 14)
.fill(colorScheme == .dark ? Color(.systemGray6) : Color(.systemGray6).opacity(0.5))
)
.accessibilityElement(children: .contain)
.accessibilityIdentifier(AccessibilityID.Settings.upgradeBanner)
}
}