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>
63 lines
1.8 KiB
Swift
63 lines
1.8 KiB
Swift
import SwiftUI
|
|
|
|
struct MainTabView: View {
|
|
@State private var selectedTab = 0
|
|
@StateObject private var authManager = AuthenticationManager.shared
|
|
|
|
var body: some View {
|
|
TabView(selection: $selectedTab) {
|
|
NavigationView {
|
|
ResidencesListView()
|
|
}
|
|
.tabItem {
|
|
Label("Residences", systemImage: "house.fill")
|
|
}
|
|
.tag(0)
|
|
.accessibilityIdentifier(AccessibilityIdentifiers.Navigation.residencesTab)
|
|
|
|
NavigationView {
|
|
AllTasksView()
|
|
}
|
|
.tabItem {
|
|
Label("Tasks", systemImage: "checkmark.circle.fill")
|
|
}
|
|
.tag(1)
|
|
.accessibilityIdentifier(AccessibilityIdentifiers.Navigation.tasksTab)
|
|
|
|
NavigationView {
|
|
ContractorsListView()
|
|
}
|
|
.tabItem {
|
|
Label("Contractors", systemImage: "wrench.and.screwdriver.fill")
|
|
}
|
|
.tag(2)
|
|
.accessibilityIdentifier(AccessibilityIdentifiers.Navigation.contractorsTab)
|
|
|
|
NavigationView {
|
|
DocumentsWarrantiesView(residenceId: nil)
|
|
}
|
|
.tabItem {
|
|
Label("Documents", systemImage: "doc.text.fill")
|
|
}
|
|
.tag(3)
|
|
.accessibilityIdentifier(AccessibilityIdentifiers.Navigation.documentsTab)
|
|
|
|
NavigationView {
|
|
ProfileTabView()
|
|
}
|
|
.tabItem {
|
|
Label("Profile", systemImage: "person.fill")
|
|
}
|
|
.tag(4)
|
|
.accessibilityIdentifier(AccessibilityIdentifiers.Navigation.profileTab)
|
|
}
|
|
.onChange(of: authManager.isAuthenticated) { _ in
|
|
selectedTab = 0
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
MainTabView()
|
|
}
|