Fix UI test failures: registration dismiss cascade, onboarding reset, test stability
- Fix registration flow dismiss cascade: chain fullScreenCover → sheet onDismiss so auth state is set only after all UIKit presentations are removed, preventing RootView from swapping LoginView→MainTabView behind a stale sheet - Fix onboarding reset: set hasCompletedOnboarding directly instead of calling completeOnboarding() which has an auth guard that fails after DataManager.clear() - Stabilize Suite1 registration tests, Suite6 task tests, Suite7 contractor tests - Add clean-slate-per-suite via AuthenticatedUITestCase reset state - Improve test account seeding and screen object reliability Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -22,11 +22,13 @@ struct AccessibilityIdentifiers {
|
||||
static let registerConfirmPasswordField = "Register.ConfirmPasswordField"
|
||||
static let registerButton = "Register.RegisterButton"
|
||||
static let registerCancelButton = "Register.CancelButton"
|
||||
static let registerErrorMessage = "Register.ErrorMessage"
|
||||
|
||||
// Verification
|
||||
static let verificationCodeField = "Verification.CodeField"
|
||||
static let verifyButton = "Verification.VerifyButton"
|
||||
static let resendCodeButton = "Verification.ResendButton"
|
||||
static let verificationLogoutButton = "Verification.LogoutButton"
|
||||
}
|
||||
|
||||
// MARK: - Navigation
|
||||
|
||||
@@ -56,11 +56,13 @@ enum UITestRuntime {
|
||||
DataManager.shared.clear()
|
||||
OnboardingState.shared.reset()
|
||||
ThemeManager.shared.currentTheme = .bright
|
||||
UserDefaults.standard.removeObject(forKey: "ui_test_user_verified")
|
||||
|
||||
// Re-apply onboarding completion after reset so tests that need
|
||||
// both --reset-state and --complete-onboarding work correctly.
|
||||
// Re-apply onboarding completion after reset. Set the flag directly
|
||||
// because completeOnboarding() has an auth guard that fails here
|
||||
// (DataManager was just cleared, so isAuthenticated is false).
|
||||
if shouldCompleteOnboarding {
|
||||
OnboardingState.shared.completeOnboarding()
|
||||
OnboardingState.shared.hasCompletedOnboarding = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user