Skip to content

Commit c37f38c

Browse files
Add back blood pressure tests (#49)
# *Add back blood pressure tests* ## ♻️ Current situation & Problem *Link any open issues or pull requests (PRs) related to this PR. Please ensure that all non-trivial PRs are first tracked and discussed in an existing GitHub issue or discussion.* ## ⚙️ Release Notes *Add a bullet point list summary of the feature and possible migration guides if this is a breaking change so this section can be added to the release notes.* *Include code snippets that provide examples of the feature implemented or links to the documentation if it appends or changes the public interface.* ## 📚 Documentation *Please ensure that you properly document any additions in conformance to [Spezi Documentation Guide](https://github.com/StanfordSpezi/.github/blob/main/DOCUMENTATIONGUIDE.md).* *You can use this section to describe your solution, but we encourage contributors to document your reasoning and changes using in-line documentation.* ## ✅ Testing *Please ensure that the PR meets the testing requirements set by CodeCov and that new functionality is appropriately tested.* *This section describes important information about the tests and why some elements might not be testable.* ## 📝 Code of Conduct & Contributing Guidelines By submitting creating this pull request, you agree to follow our [Code of Conduct](https://github.com/CS342/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/CS342/.github/blob/main/CONTRIBUTING.md): - [ ] I agree to follow the [Code of Conduct](https://github.com/CS342/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/CS342/.github/blob/main/CONTRIBUTING.md). --------- Co-authored-by: Merve Cerit <[email protected]>
1 parent 1b8d9ac commit c37f38c

File tree

4 files changed

+91
-65
lines changed

4 files changed

+91
-65
lines changed

NeutroFeverGuard.xcodeproj/project.pbxproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
C4C8A35F2D6F950600F313AE /* AddDataViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4C8A35E2D6F950600F313AE /* AddDataViewTests.swift */; };
100100
C4C8A3682D6F9E2100F313AE /* LabViewUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4C8A3672D6F9E1A00F313AE /* LabViewUITests.swift */; };
101101
C4C8A3B32D71204200F313AE /* HelperFuncTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4C8A3B22D71204200F313AE /* HelperFuncTests.swift */; };
102+
C4DEE85E2D82C09900BFBC26 /* BloodPressureTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4DEE85D2D82C09900BFBC26 /* BloodPressureTests.swift */; };
102103
EB0065572D813AC900F6DA00 /* HKVisualizationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB0065562D813AC900F6DA00 /* HKVisualizationTests.swift */; };
103104
EB02C6612D5D52E90035AA89 /* NeutroFeverGuardTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653A256128338800005D4D48 /* NeutroFeverGuardTests.swift */; };
104105
EB2AED6F2D81A00900861EE2 /* MasccIndexManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB2AED6E2D81A00300861EE2 /* MasccIndexManager.swift */; };
@@ -196,8 +197,9 @@
196197
C4C8A35E2D6F950600F313AE /* AddDataViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddDataViewTests.swift; sourceTree = "<group>"; };
197198
C4C8A3672D6F9E1A00F313AE /* LabViewUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabViewUITests.swift; sourceTree = "<group>"; };
198199
C4C8A3B22D71204200F313AE /* HelperFuncTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HelperFuncTests.swift; sourceTree = "<group>"; };
199-
EB2AED6E2D81A00300861EE2 /* MasccIndexManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasccIndexManager.swift; sourceTree = "<group>"; };
200+
C4DEE85D2D82C09900BFBC26 /* BloodPressureTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BloodPressureTests.swift; sourceTree = "<group>"; };
200201
EB0065562D813AC900F6DA00 /* HKVisualizationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HKVisualizationTests.swift; sourceTree = "<group>"; };
202+
EB2AED6E2D81A00300861EE2 /* MasccIndexManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasccIndexManager.swift; sourceTree = "<group>"; };
201203
EB6FDBCB2D80133A008E9F90 /* HKVisualization.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HKVisualization.swift; sourceTree = "<group>"; };
202204
EB6FDBCC2D80133A008E9F90 /* HKVisualizationItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HKVisualizationItem.swift; sourceTree = "<group>"; };
203205
F22393792D5D4092006C8EB4 /* DataError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataError.swift; sourceTree = "<group>"; };
@@ -407,6 +409,7 @@
407409
C42C1C702D7AB84300EA417F /* MedicationViewUITests.swift */,
408410
653A256B28338800005D4D48 /* SchedulerTests.swift */,
409411
C4C8A35E2D6F950600F313AE /* AddDataViewTests.swift */,
412+
C4DEE85D2D82C09900BFBC26 /* BloodPressureTests.swift */,
410413
2F4E23862989DB360013F3D9 /* ContactsTests.swift */,
411414
5680DD3D2AB8CD84004E6D4A /* ContributionsTest.swift */,
412415
EB0065562D813AC900F6DA00 /* HKVisualizationTests.swift */,
@@ -736,6 +739,7 @@
736739
EB0065572D813AC900F6DA00 /* HKVisualizationTests.swift in Sources */,
737740
2F4E23872989DB360013F3D9 /* ContactsTests.swift in Sources */,
738741
653A256C28338800005D4D48 /* SchedulerTests.swift in Sources */,
742+
C4DEE85E2D82C09900BFBC26 /* BloodPressureTests.swift in Sources */,
739743
);
740744
runOnlyForDeploymentPostprocessing = 0;
741745
};

NeutroFeverGuard/Resources/Localizable.xcstrings

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@
600600
}
601601
}
602602
},
603-
"Max Value: " : {
603+
"Max value: " : {
604604

605605
},
606606
"Medication List" : {
@@ -615,7 +615,7 @@
615615
"Mild symptoms (+5)" : {
616616

617617
},
618-
"Min Value: " : {
618+
"Min value: " : {
619619

620620
},
621621
"Moderate symptoms (+3)" : {

NeutroFeverGuardUITests/AddDataViewTests.swift

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -114,68 +114,6 @@ class AddDataViewTests: XCTestCase {
114114
XCTAssertTrue(app.staticTexts["Error"].waitForExistence(timeout: 5))
115115
}
116116

117-
@MainActor
118-
func testBloodPressureDataInput() throws {
119-
let app = XCUIApplication()
120-
121-
XCTAssertTrue(app.wait(for: .runningForeground, timeout: 2.0))
122-
123-
XCTAssertTrue(app.tabBars["Tab Bar"].buttons["Add Data"].waitForExistence(timeout: 5))
124-
app.tabBars["Tab Bar"].buttons["Add Data"].tap()
125-
126-
// XCTAssertTrue(app.staticTexts["Blood Pressure"].waitForExistence(timeout: 5))
127-
// app.staticTexts["Blood Pressure"].tap()
128-
//
129-
// XCTAssertTrue(app.navigationBars["Blood Pressure"].waitForExistence(timeout: 5))
130-
// XCTAssertTrue(app.staticTexts["Systolic (mmHg)"].waitForExistence(timeout: 5))
131-
// XCTAssertTrue(app.staticTexts["Diastolic (mmHg)"].waitForExistence(timeout: 5))
132-
//
133-
// let textFields = app.textFields.allElementsBoundByIndex
134-
// XCTAssertEqual(textFields.count, 2)
135-
//
136-
// let systolicField = textFields[0].coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5))
137-
// systolicField.tap()
138-
// textFields[0].typeText("120")
139-
//
140-
// let diastolicField = textFields[1].coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5))
141-
// diastolicField.tap()
142-
// textFields[1].typeText("80")
143-
//
144-
// XCTAssertTrue(app.buttons["Add"].waitForExistence(timeout: 5))
145-
// XCTAssertTrue(app.buttons["Add"].isEnabled)
146-
// app.buttons["Add"].tap()
147-
// try app.handleHealthKitAuthorization()
148-
// if app.buttons["Add"].waitForExistence(timeout: 20) {
149-
// app.buttons["Add"].tap()
150-
// try app.handleHealthKitAuthorization()
151-
// }
152-
// XCTAssertTrue(app.staticTexts["What data would you like to add?"].waitForExistence(timeout: 5))
153-
//
154-
// // invalid input
155-
// XCTAssertTrue(app.staticTexts["Blood Pressure"].waitForExistence(timeout: 5))
156-
// app.staticTexts["Blood Pressure"].tap()
157-
//
158-
// XCTAssertTrue(app.buttons["Add"].waitForExistence(timeout: 5))
159-
// XCTAssertFalse(app.buttons["Add"].isEnabled)
160-
//
161-
// let textFields2 = app.textFields.allElementsBoundByIndex
162-
//
163-
// let systolicField2 = textFields2[0].coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5))
164-
// systolicField2.tap()
165-
// textFields2[0].typeText("120")
166-
//
167-
// let diastolicField2 = textFields2[1].coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5))
168-
// diastolicField2.tap()
169-
// textFields2[1].typeText("invalid")
170-
//
171-
// app.buttons["Add"].tap()
172-
// if app.buttons["Add"].waitForExistence(timeout: 20) {
173-
// app.buttons["Add"].tap()
174-
// try app.handleHealthKitAuthorization()
175-
// }
176-
// XCTAssertTrue(app.staticTexts["Error"].waitForExistence(timeout: 5))
177-
}
178-
179117
@MainActor
180118
func testOxygenSaturationDataInput() throws {
181119
let app = XCUIApplication()
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
//
2+
// This source file is part of the NeutroFeverGuard based on the Stanford Spezi Template Application project
3+
//
4+
// SPDX-FileCopyrightText: 2025 Stanford University
5+
//
6+
// SPDX-License-Identifier: MIT
7+
//
8+
9+
import XCTest
10+
import XCTestExtensions
11+
import XCTHealthKit
12+
13+
class BloodPressureTests: XCTestCase {
14+
@MainActor
15+
override func setUp() async throws {
16+
continueAfterFailure = false
17+
18+
let app = XCUIApplication()
19+
app.launchArguments = ["--skipOnboarding"]
20+
app.deleteAndLaunch(withSpringboardAppName: "NeutroFeverGuard")
21+
}
22+
23+
@MainActor
24+
func testBloodPressureDataInput() throws {
25+
let app = XCUIApplication()
26+
27+
XCTAssertTrue(app.wait(for: .runningForeground, timeout: 2.0))
28+
29+
XCTAssertTrue(app.tabBars["Tab Bar"].buttons["Add Data"].waitForExistence(timeout: 5))
30+
app.tabBars["Tab Bar"].buttons["Add Data"].tap()
31+
32+
XCTAssertTrue(app.staticTexts["Blood Pressure"].waitForExistence(timeout: 5))
33+
app.staticTexts["Blood Pressure"].tap()
34+
35+
XCTAssertTrue(app.navigationBars["Blood Pressure"].waitForExistence(timeout: 5))
36+
XCTAssertTrue(app.staticTexts["Systolic (mmHg)"].waitForExistence(timeout: 5))
37+
XCTAssertTrue(app.staticTexts["Diastolic (mmHg)"].waitForExistence(timeout: 5))
38+
39+
let textFields = app.textFields.allElementsBoundByIndex
40+
XCTAssertEqual(textFields.count, 2)
41+
42+
let systolicField = textFields[0].coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5))
43+
systolicField.tap()
44+
textFields[0].typeText("120")
45+
46+
let diastolicField = textFields[1].coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5))
47+
diastolicField.tap()
48+
textFields[1].typeText("80")
49+
50+
XCTAssertTrue(app.buttons["Add"].waitForExistence(timeout: 5))
51+
XCTAssertTrue(app.buttons["Add"].isEnabled)
52+
app.buttons["Add"].tap()
53+
try app.handleHealthKitAuthorization()
54+
if app.buttons["Add"].waitForExistence(timeout: 20) {
55+
app.buttons["Add"].tap()
56+
try app.handleHealthKitAuthorization()
57+
}
58+
XCTAssertTrue(app.staticTexts["What data would you like to add?"].waitForExistence(timeout: 5))
59+
60+
// invalid input
61+
XCTAssertTrue(app.staticTexts["Blood Pressure"].waitForExistence(timeout: 5))
62+
app.staticTexts["Blood Pressure"].tap()
63+
64+
XCTAssertTrue(app.buttons["Add"].waitForExistence(timeout: 5))
65+
XCTAssertFalse(app.buttons["Add"].isEnabled)
66+
67+
let textFields2 = app.textFields.allElementsBoundByIndex
68+
69+
let systolicField2 = textFields2[0].coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5))
70+
systolicField2.tap()
71+
textFields2[0].typeText("120")
72+
73+
let diastolicField2 = textFields2[1].coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5))
74+
diastolicField2.tap()
75+
textFields2[1].typeText("invalid")
76+
77+
app.buttons["Add"].tap()
78+
if app.buttons["Add"].waitForExistence(timeout: 20) {
79+
app.buttons["Add"].tap()
80+
try app.handleHealthKitAuthorization()
81+
}
82+
XCTAssertTrue(app.staticTexts["Error"].waitForExistence(timeout: 5))
83+
}
84+
}

0 commit comments

Comments
 (0)