Skip to content

Commit 9ef4e03

Browse files
authored
Merge pull request #13 from tidepool-org/scott/QAE-456-SimpleBolusCalculator-MinandMaxGlucos
Formatting comments addressed using amend last commit. Conflict on HomeScreen addressed and other changes merged.
2 parents 1feba2b + 1de0d9e commit 9ef4e03

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

Sources/LoopUITestingKit/Screens/BaseScreen.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
import XCTest
99

10+
extension XCUIElementQuery {
11+
var lastMatch : XCUIElement { return self.element(boundBy: self.count - 1) }
12+
}
13+
1014
open class BaseScreen {
1115
let app: XCUIApplication
1216
let springBoard: XCUIApplication = XCUIApplication(bundleIdentifier:"com.apple.springboard")

Sources/LoopUITestingKit/Screens/BolusScreen.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ public final class BolusScreen: BaseScreen {
1212
// MARK: Elements
1313

1414
private var bolusTitleText: XCUIElement { app.navigationBars.staticTexts["Bolus"] }
15-
private var bolusEntryTextField: XCUIElement { app.textFields["dismissibleKeyboardTextField"] }
15+
private var currentGlucoseEntryTextField: XCUIElement { app.textFields["textField_CurrentGlucose"] }
16+
private var bolusEntryTextField: XCUIElement { app.textFields["textField_Bolus"] }
17+
private var carbohydratesTextField: XCUIElement { app.textFields["textField_Carbohydrates"] }
1618
private var bolusCancelButton: XCUIElement { app.navigationBars.buttons["Cancel"] }
1719
private var simpleBolusCalculatorTitle: XCUIElement { app.navigationBars.staticTexts["Simple Bolus Calculator"] }
1820
private var bolusActionButton: XCUIElement { app.buttons["button_bolusAction"] }
@@ -27,9 +29,18 @@ public final class BolusScreen: BaseScreen {
2729
public var getActiveCarbsText: String { activeCarbsText.getLableSafe() }
2830

2931
public func tapCancelBolusButton() { bolusCancelButton.safeTap() }
32+
public func tapCurrentGlucoseEntryTextField() { currentGlucoseEntryTextField.safeTap() }
3033
public func tapBolusEntryTextField() { bolusEntryTextField.safeTap() }
3134
public func tapBolusActionButton() { bolusActionButton.safeForceTap() }
35+
public func getBolusFieldValue() -> String { bolusEntryTextField.getValueSafe() }
36+
public func getCurrentGlucoseFieldValue() -> String { currentGlucoseEntryTextField.getValueSafe() }
3237

38+
public func clearCurrentGlucoseEntryTextField() {
39+
let currentTextLength = currentGlucoseEntryTextField.getValueSafe().count
40+
41+
currentGlucoseEntryTextField
42+
.typeText(String(repeating: XCUIKeyboardKey.delete.rawValue, count: currentTextLength))
43+
}
3344
public func clearBolusEntryTextField() {
3445
let currentTextLength = bolusEntryTextField.getValueSafe().count
3546

@@ -48,6 +59,7 @@ public final class BolusScreen: BaseScreen {
4859
}
4960

5061
public func setBolusEntryTextField(value: String) { bolusEntryTextField.typeText(value) }
62+
public func setCurrentGlucoseEntryTextField(value: String) { currentGlucoseEntryTextField.typeText(value) }
5163
public func tapKeyboardDoneButton() { keyboardDoneButton.safeTap() }
5264

5365
// MARK: Verifications

Sources/LoopUITestingKit/Screens/HomeScreen.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ public final class HomeScreen: BaseScreen {
6060
return navigateToActiveCarbsDetailsText.identifier.components(separatedBy: "_")[2]
6161
}
6262

63+
64+
65+
public func getPumpPillValue() -> String { hudPumpPill.getValueSafe() }
66+
public func getHudGlucosePill() -> String { hudGlucosePill.getValueSafe() }
67+
6368
public func tapBolusEntry() { bolusTabButton.safeTap() }
6469
public func tapSettingsButton() { settingsTabButton.safeTap() }
6570
public func tapSafetyNotificationAlertCloseButton() { safetyNotificationsAlertCloseButton.safeTap() }
@@ -71,7 +76,7 @@ public final class HomeScreen: BaseScreen {
7176
public func tapHudGlucosePill() { hudGlucosePill.safeTap() }
7277
public func tapPresetsTabButton() { presetsTabButton.safeTap() }
7378
public func tapNavigateToActiveCarbsDetails() { navigateToActiveCarbsDetailsText.safeTap() }
74-
public func getPumpPillValue() -> String { hudPumpPill.getValueSafe() }
79+
7580

7681
public func getHudGlucosePillValue() -> [String] {
7782
let outOfRangeValues = Set(["HIGH", "LOW"])

0 commit comments

Comments
 (0)