Fix post-registration navigation and add comprehensive registration UI tests

- Fix RegisterView to call AuthenticationManager.login() after email verification
  so user is properly transitioned to home screen instead of returning to login
- Fix ResidencesListView to load data when authentication state becomes true,
  ensuring residences load after registration/login
- Add accessibility identifier to verification code field for UI testing
- Add NSAppTransportSecurity exceptions for localhost/127.0.0.1 for local dev
- Add comprehensive XCUITest suite for registration flow including:
  - Form validation tests (empty fields, invalid email, mismatched passwords)
  - Full registration and verification flow test
  - Logout from verification screen test
  - Helper scripts for test user cleanup

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-11-25 19:56:30 -06:00
parent f433dca1bb
commit a0b038403c
7 changed files with 721 additions and 2 deletions

View File

@@ -17,6 +17,24 @@
</array>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsLocalNetworking</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
<key>127.0.0.1</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>

View File

@@ -135,8 +135,11 @@ struct RegisterView: View {
.fullScreenCover(isPresented: $viewModel.isRegistered) {
VerifyEmailView(
onVerifySuccess: {
dismiss()
// User has verified their email - mark as authenticated
// This will update RootView to show the main app
AuthenticationManager.shared.login()
showVerifyEmail = false
dismiss()
},
onLogout: {
// Logout and return to login screen

View File

@@ -106,7 +106,11 @@ struct ResidencesListView: View {
.interactiveDismissDisabled()
}
.onChange(of: authManager.isAuthenticated) { isAuth in
if !isAuth {
if isAuth {
// User just logged in or registered - load their residences
viewModel.loadMyResidences()
} else {
// User logged out - clear data
viewModel.myResidences = nil
}
}

View File

@@ -66,6 +66,7 @@ struct VerifyEmailView: View {
.frame(height: 60)
.padding(.horizontal)
.focused($isFocused)
.accessibilityIdentifier(AccessibilityIdentifiers.Authentication.verificationCodeField)
.onChange(of: viewModel.code) { _, newValue in
// Limit to 6 digits
if newValue.count > 6 {