Add comprehensive accessibility identifiers for UI testing
Added AccessibilityIdentifiers helper struct with identifiers for all major UI elements across the app. Applied identifiers throughout authentication, navigation, forms, and feature screens to enable reliable UI testing. Changes: - Added Helpers/AccessibilityIdentifiers.swift with centralized ID definitions - LoginView: Added identifiers for username, password, login button fields - RegisterView: Added identifiers for registration form fields - MainTabView: Added identifiers for all tab bar items - ProfileTabView: Added identifiers for logout and settings buttons - ResidencesListView: Added identifier for add button - Task views: Added identifiers for add, save, and form fields - Document forms: Added identifiers for form fields and buttons Identifiers follow naming pattern: [Feature].[Element] Example: AccessibilityIdentifiers.Authentication.loginButton This enables UI tests to reliably locate elements using: app.buttons[AccessibilityIdentifiers.Authentication.loginButton] 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import SwiftUI
|
||||
|
||||
struct MainTabView: View {
|
||||
@EnvironmentObject var loginViewModel: LoginViewModel
|
||||
@State private var selectedTab = 0
|
||||
|
||||
@StateObject private var authManager = AuthenticationManager.shared
|
||||
|
||||
var body: some View {
|
||||
TabView(selection: $selectedTab) {
|
||||
NavigationView {
|
||||
@@ -13,6 +13,7 @@ struct MainTabView: View {
|
||||
Label("Residences", systemImage: "house.fill")
|
||||
}
|
||||
.tag(0)
|
||||
.accessibilityIdentifier(AccessibilityIdentifiers.Navigation.residencesTab)
|
||||
|
||||
NavigationView {
|
||||
AllTasksView()
|
||||
@@ -21,6 +22,7 @@ struct MainTabView: View {
|
||||
Label("Tasks", systemImage: "checkmark.circle.fill")
|
||||
}
|
||||
.tag(1)
|
||||
.accessibilityIdentifier(AccessibilityIdentifiers.Navigation.tasksTab)
|
||||
|
||||
NavigationView {
|
||||
ContractorsListView()
|
||||
@@ -29,6 +31,7 @@ struct MainTabView: View {
|
||||
Label("Contractors", systemImage: "wrench.and.screwdriver.fill")
|
||||
}
|
||||
.tag(2)
|
||||
.accessibilityIdentifier(AccessibilityIdentifiers.Navigation.contractorsTab)
|
||||
|
||||
NavigationView {
|
||||
DocumentsWarrantiesView(residenceId: nil)
|
||||
@@ -37,6 +40,7 @@ struct MainTabView: View {
|
||||
Label("Documents", systemImage: "doc.text.fill")
|
||||
}
|
||||
.tag(3)
|
||||
.accessibilityIdentifier(AccessibilityIdentifiers.Navigation.documentsTab)
|
||||
|
||||
NavigationView {
|
||||
ProfileTabView()
|
||||
@@ -45,6 +49,10 @@ struct MainTabView: View {
|
||||
Label("Profile", systemImage: "person.fill")
|
||||
}
|
||||
.tag(4)
|
||||
.accessibilityIdentifier(AccessibilityIdentifiers.Navigation.profileTab)
|
||||
}
|
||||
.onChange(of: authManager.isAuthenticated) { _ in
|
||||
selectedTab = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user