Make contractor phone optional and add UI test accessibility identifiers
Updated contractor models and forms to make phone field optional. Added accessibility identifiers for add buttons to enable UI testing. Contractor changes: - Kotlin: Made phone nullable in Contractor, ContractorCreateRequest, ContractorSummary models - Android: Updated AddContractorDialog validation to only require name - Android: Removed asterisk from phone field label - Android: Updated ContractorDetailScreen to handle nullable phone - iOS: Updated ContractorFormSheet validation to only check name field - iOS: Updated form footer text to show only name as required - iOS: Updated ContractorDetailView to use optional binding for phone display Accessibility improvements: - iOS: Added accessibility identifier to contractor add button in ContractorsListView - iOS: Added accessibility identifier to task add button in ResidenceDetailView These identifiers enable reliable UI testing by allowing tests to access buttons by their accessibility identifiers instead of searching by label. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -56,9 +56,11 @@ struct ResidenceDetailView: View {
|
||||
|
||||
.alert("Delete Residence", isPresented: $showDeleteConfirmation) {
|
||||
Button("Cancel", role: .cancel) { }
|
||||
.accessibilityIdentifier(AccessibilityIdentifiers.Alert.cancelButton)
|
||||
Button("Delete", role: .destructive) {
|
||||
deleteResidence()
|
||||
}
|
||||
.accessibilityIdentifier(AccessibilityIdentifiers.Alert.deleteButton)
|
||||
} message: {
|
||||
if let residence = viewModel.selectedResidence {
|
||||
Text("Are you sure you want to delete \(residence.name)? This action cannot be undone and will delete all associated tasks, documents, and data.")
|
||||
@@ -223,6 +225,7 @@ private extension ResidenceDetailView {
|
||||
Button("Edit") {
|
||||
showEditResidence = true
|
||||
}
|
||||
.accessibilityIdentifier(AccessibilityIdentifiers.Residence.editButton)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -256,6 +259,7 @@ private extension ResidenceDetailView {
|
||||
} label: {
|
||||
Image(systemName: "plus")
|
||||
}
|
||||
.accessibilityIdentifier(AccessibilityIdentifiers.Task.addButton)
|
||||
|
||||
if let residence = viewModel.selectedResidence, residence.isPrimaryOwner {
|
||||
Button {
|
||||
@@ -264,6 +268,7 @@ private extension ResidenceDetailView {
|
||||
Image(systemName: "trash")
|
||||
.foregroundStyle(.red)
|
||||
}
|
||||
.accessibilityIdentifier(AccessibilityIdentifiers.Residence.deleteButton)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user