Skip to content

Commit

Permalink
Merge pull request #756 from tidepool-org/petr/QAE-451-Add-identifier…
Browse files Browse the repository at this point in the history
…s-for-UI-tests

[QAE-451] Add identifier for Presets button
  • Loading branch information
Petr-Zywczok authored Feb 11, 2025
2 parents e53d236 + a333777 commit 2848945
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 19 additions & 1 deletion Loop/Views/Presets/Components/PresetStatsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,24 @@ struct PresetStatsView: View {
let lowerClassification = guardrail?.classification(for: target.lowerBound) ?? .withinRecommendedRange
let upperClassification = guardrail?.classification(for: target.upperBound) ?? .withinRecommendedRange

var accessibilityId = "text_PresetCorrectionRange_"

switch (lowerClassification, upperClassification) {
case (.withinRecommendedRange, .withinRecommendedRange):
accessibilityId += "WithinRange"
case (.withinRecommendedRange, .outsideRecommendedRange):
accessibilityId += "UpperWarning"
accessibilityId += upperColor == .red ? "Red" : "Orange"
case (.outsideRecommendedRange, .outsideRecommendedRange):
accessibilityId += "LowerWarning"
accessibilityId += lowerColor == .red ? "Red" : "Orange"
accessibilityId += "UpperWarning"
accessibilityId += upperColor == .red ? "Red" : "Orange"
case (.outsideRecommendedRange, .withinRecommendedRange):
accessibilityId += "LowerWarning"
accessibilityId += lowerColor == .red ? "Red" : "Orange"
}

return Group {
switch (lowerClassification, upperClassification) {
case (.withinRecommendedRange, .withinRecommendedRange):
Expand All @@ -84,7 +102,7 @@ struct PresetStatsView: View {
case (.outsideRecommendedRange, .withinRecommendedRange):
warningSymbol.foregroundStyle(lowerColor) + lower + Text("-") + upper + units
}
}
}.accessibilityIdentifier(accessibilityId)
}

var correctionRangeView: some View {
Expand Down
2 changes: 1 addition & 1 deletion Loop/Views/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ extension SettingsView {
imageView: Image("Presets Icon"),
label: NSLocalizedString("Presets", comment: "Title text for button to Preset Settings"),
descriptiveText: NSLocalizedString("Temporary Settings Adjustments", comment: "Descriptive text for Preset Settings")
)
).accessibilityIdentifier("button_Presets")
}
}

Expand Down

0 comments on commit 2848945

Please sign in to comment.