Files
Reflect/Shared/AccessibilityIdentifiers.swift
Trey T e7648ddd8a Add missing accessibility identifiers to all interactive UI elements
Audit found ~50+ interactive elements (buttons, toggles, pickers, alerts,
links) missing accessibility identifiers across 13 view files. Added
centralized ID definitions and applied them to every entry detail button,
guided reflection control, settings toggle, paywall unlock button,
subscription/IAP button, lock screen control, and photo action dialog.
2026-03-26 07:59:52 -05:00

269 lines
11 KiB
Swift

//
// AccessibilityIdentifiers.swift
// Reflect (iOS)
//
// Centralized accessibility identifiers for XCUITest targeting.
//
import Foundation
enum AccessibilityID {
// MARK: - Tabs
enum Tab {
static let day = "tab_day"
static let month = "tab_month"
static let year = "tab_year"
static let insights = "tab_insights"
static let settings = "tab_settings"
}
// MARK: - Mood Buttons (voting header)
enum MoodButton {
static let great = "mood_button_great"
static let good = "mood_button_good"
static let average = "mood_button_average"
static let bad = "mood_button_bad"
static let horrible = "mood_button_horrible"
static func id(for moodStrValue: String) -> String {
"mood_button_\(moodStrValue.lowercased())"
}
}
// MARK: - Day View
enum DayView {
static let moodHeader = "mood_header"
static let entryList = "entry_list"
static let emptyState = "empty_state"
static let emptyStateNoData = "empty_state_no_data"
static func entryRow(dateString: String) -> String {
"entry_row_\(dateString)"
}
}
// MARK: - Entry Detail
enum EntryDetail {
static let sheet = "entry_detail_sheet"
static let doneButton = "entry_detail_done"
static let deleteButton = "entry_detail_delete"
static let noteButton = "entry_detail_note_button"
static let noteArea = "entry_detail_note_area"
static let moodGrid = "entry_detail_mood_grid"
static let reflectionBeginButton = "entry_detail_reflection_begin"
static let reflectionCard = "entry_detail_reflection_card"
static let photoButton = "entry_detail_photo_button"
static let photoPlaceholder = "entry_detail_photo_placeholder"
static let photoImage = "entry_detail_photo_image"
static let photoTakeButton = "entry_detail_photo_take"
static let photoChooseButton = "entry_detail_photo_choose"
static let photoRemoveButton = "entry_detail_photo_remove"
static let photoCancelButton = "entry_detail_photo_cancel"
static let deleteConfirmButton = "entry_detail_delete_confirm"
static let deleteCancelButton = "entry_detail_delete_cancel"
}
// MARK: - Note Editor
enum NoteEditor {
static let textEditor = "note_editor_text"
static let saveButton = "note_editor_save"
static let cancelButton = "note_editor_cancel"
static let keyboardDoneButton = "note_editor_keyboard_done"
}
// MARK: - Guided Reflection
enum GuidedReflection {
static let sheet = "guided_reflection_sheet"
static let progressDots = "guided_reflection_progress"
static let textEditor = "guided_reflection_text_editor"
static let nextButton = "guided_reflection_next"
static let backButton = "guided_reflection_back"
static let saveButton = "guided_reflection_save"
static let cancelButton = "guided_reflection_cancel"
static let infoButton = "guided_reflection_info"
static let discardButton = "guided_reflection_discard"
static let keepEditingButton = "guided_reflection_keep_editing"
static func questionLabel(step: Int) -> String {
"guided_reflection_question_\(step)"
}
static let chipGrid = "guided_reflection_chip_grid"
static let chipMoreButton = "guided_reflection_chip_more"
static func chip(label: String) -> String {
"guided_reflection_chip_\(label)"
}
// Info view
static let infoDoneButton = "guided_reflection_info_done"
static let cbtLearnMoreLink = "guided_reflection_cbt_learn_more"
static let actLearnMoreLink = "guided_reflection_act_learn_more"
static let baLearnMoreLink = "guided_reflection_ba_learn_more"
}
// MARK: - Settings
enum Settings {
static let header = "settings_header"
static let segmentedPicker = "settings_segmented_picker"
static let customizeTab = "settings_tab_customize"
static let settingsTab = "settings_tab_settings"
static let upgradeBanner = "upgrade_banner"
static let subscribeButton = "subscribe_button"
static let whyUpgradeButton = "why_upgrade_button"
static let clearDataButton = "settings_clear_data"
static let analyticsToggle = "settings_analytics_toggle"
static let showOnboardingButton = "settings_show_onboarding"
static let bypassSubscriptionToggle = "settings_bypass_subscription"
static let eulaButton = "settings_eula"
static let privacyPolicyButton = "settings_privacy_policy"
static let hapticFeedbackToggle = "settings_haptic_feedback_toggle"
static let deleteToggle = "settings_delete_toggle"
static let privacyLockToggle = "settings_privacy_lock_toggle"
static let healthSyncToggle = "settings_health_sync_toggle"
static let weatherToggle = "settings_weather_toggle"
static let reminderTimePicker = "settings_reminder_time_picker"
static let reminderSaveButton = "settings_reminder_save"
static let reminderCancelButton = "settings_reminder_cancel"
}
// MARK: - Customize
enum Customize {
static let themeSection = "customize_theme_section"
static let browseThemesButton = "browse_themes_button"
static let appThemePickerDoneButton = "apptheme_picker_done"
static let appThemePreviewCancelButton = "apptheme_preview_cancel"
static let appThemePreviewApplyButton = "apptheme_preview_apply"
static func themeButton(_ name: String) -> String {
"customize_theme_\(name.lowercased())"
}
static func votingLayoutButton(_ name: String) -> String {
"customize_voting_\(name.lowercased())"
}
static func dayViewStyleButton(_ name: String) -> String {
"customize_daystyle_\(name.lowercased())"
}
static func iconPackButton(_ name: String) -> String {
"customize_iconpack_\(name.lowercased())"
}
static func personalityPackButton(_ name: String) -> String {
"customize_personality_\(name.lowercased())"
}
static func appThemeCard(_ name: String) -> String {
"apptheme_card_\(name.lowercased())"
}
}
// MARK: - Paywall
enum Paywall {
static let monthOverlay = "paywall_month_overlay"
static let yearOverlay = "paywall_year_overlay"
static let insightsOverlay = "paywall_insights_overlay"
static let monthUnlockButton = "paywall_month_unlock"
static let yearUnlockButton = "paywall_year_unlock"
static let insightsUnlockButton = "paywall_insights_unlock"
static let reportsUnlockButton = "paywall_reports_unlock"
}
// MARK: - Day View Section Headers
enum DaySection {
static func header(month: Int, year: Int) -> String {
"day_section_\(month)_\(year)"
}
}
// MARK: - Insights
enum Insights {
static let header = "insights_header"
static let monthSection = "insights_month_section"
static let yearSection = "insights_year_section"
static let allTimeSection = "insights_all_time_section"
}
// MARK: - Month View
enum MonthView {
static let grid = "month_grid"
static let shareButton = "month_share_button"
}
// MARK: - Month Detail
enum MonthDetail {
static let shareButton = "month_detail_share"
static let deleteButton = "month_detail_delete"
static func moodButton(_ mood: String) -> String {
"month_detail_mood_\(mood.lowercased())"
}
}
// MARK: - Year View
enum YearView {
static let heatmap = "year_heatmap"
static let donutChart = "year_donut_chart"
static let barChart = "year_bar_chart"
static let statsSection = "year_stats_section"
static func cardHeader(year: Int) -> String { "year_card_header_\(year)" }
static let shareButton = "year_share_button"
}
// MARK: - Onboarding
enum Onboarding {
static let container = "onboarding_container"
static let welcomeScreen = "onboarding_welcome"
static let timeScreen = "onboarding_time"
static let dayScreen = "onboarding_day"
static let dayToday = "onboarding_day_today"
static let dayYesterday = "onboarding_day_yesterday"
static let styleScreen = "onboarding_style"
static let subscriptionScreen = "onboarding_subscription"
static let subscribeButton = "onboarding_subscribe_button"
static let skipButton = "onboarding_skip_button"
static let nextButton = "onboarding_next_button"
}
// MARK: - Reports
enum Reports {
static let segmentedPicker = "reports_segmented_picker"
static let dateRangePicker = "reports_date_range_picker"
static let quickSummaryButton = "reports_quick_summary_button"
static let detailedReportButton = "reports_detailed_report_button"
static let generateButton = "reports_generate_button"
static let progressView = "reports_progress_view"
static let cancelButton = "reports_cancel_button"
static let exportButton = "reports_export_button"
static let privacyConfirmation = "reports_privacy_confirmation"
static let minimumEntriesWarning = "reports_minimum_entries_warning"
static let exportDataButton = "reports_export_data_button"
static let retryButton = "reports_retry_button"
}
// MARK: - Purchase / Subscription
enum Purchase {
static let manageSubscriptionButton = "purchase_manage_subscription"
static let changePlanButton = "purchase_change_plan"
static let restorePurchasesButton = "purchase_restore"
static let subscribeButton = "purchase_subscribe"
}
// MARK: - IAP Warning
enum IAPWarning {
static let subscribeButton = "iap_warning_subscribe"
}
// MARK: - Lock Screen
enum LockScreen {
static let unlockButton = "lock_screen_unlock"
static let tryAgainButton = "lock_screen_try_again"
static let cancelButton = "lock_screen_cancel"
static func passcodeButton(_ digit: Int) -> String {
"lock_screen_passcode_\(digit)"
}
}
// MARK: - Full Screen Photo
enum FullScreenPhoto {
static let closeButton = "full_screen_photo_close"
static let dismissArea = "full_screen_photo_dismiss"
}
// MARK: - Common
enum Common {
static let lockScreen = "lock_screen"
static let onboarding = "onboarding_sheet"
}
}