Skip to content

Commit

Permalink
Added basic level of accessibility identifiers to support UI testing
Browse files Browse the repository at this point in the history
  • Loading branch information
lawmaestro committed Jan 25, 2024
1 parent 30d1cb7 commit e5b36c8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Sources/FeedbacksKit/FeedbackForm/FeedbackForm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public struct FeedbackForm: View {
}
}
.navigationViewStyle(.stack)
.accessibilityIdentifier("LeaveFeedbackScreen")
}

// MARK: Views
Expand All @@ -58,12 +59,14 @@ public struct FeedbackForm: View {
.keyboardType(.emailAddress)
.autocapitalization(.none)
.autocorrectionDisabled()
.accessibilityIdentifier("EmailTextField")
} header: {
Text("_email_title".localized)
}

Section {
TextEditor(text: $viewModel.message)
.accessibilityIdentifier("MessageTextEditor")
} header: {
Text("_message_title".localized)
}
Expand All @@ -86,6 +89,7 @@ public struct FeedbackForm: View {
.frame(maxWidth: .infinity)
}
}
.accessibilityIdentifier("SendFeedbackButton")
.disabled(viewModel.isSubmitDisabled)
} footer: {
footer
Expand All @@ -112,6 +116,7 @@ public struct FeedbackForm: View {
.bold()
.frame(maxWidth: .infinity)
.foregroundColor(.green)
.accessibilityIdentifier("SendFeedbackSuccessText")
.onAppear {
Task {
try? await Task.sleep(nanoseconds: 2_000_000_000)
Expand All @@ -128,6 +133,7 @@ public struct FeedbackForm: View {
.bold()
.frame(maxWidth: .infinity)
.foregroundColor(.red)
.accessibilityIdentifier("SendFeedbackFailureText")
.onAppear {
Task {
try? await Task.sleep(nanoseconds: 3_000_000_000)
Expand Down

0 comments on commit e5b36c8

Please sign in to comment.