Skip to content

Commit 46a6e84

Browse files
Increased Visualization UI Testing Coverage (#48)
# *Increased Visualization UI Testing Coverage* ## ♻️ 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.* This PR expands the testing coverage for the health data visualizations. - We include UI testing for threshold and average elements for each type of chart - We include UI testing for correct summary text when a data point is clicked ## 📚 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): - [x] 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: Sixian Du <[email protected]>
1 parent 95cba05 commit 46a6e84

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

NeutroFeverGuardUITests/HKVisualizationTests.swift

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ class HKVisualizationTests: XCTestCase {
4545
XCTAssertTrue(app.staticTexts["Body Temperature Over Time"].exists)
4646
XCTAssertTrue(app.staticTexts["Heart Rate Over Time"].exists)
4747

48-
// Test Lollipop functions
49-
XCTAssertTrue(app.tabBars["Tab Bar"].buttons["Dashboard"].waitForExistence(timeout: 2))
50-
app.tabBars["Tab Bar"].buttons["Dashboard"].tap()
51-
try app.handleHealthKitAuthorization()
52-
5348
// Wait for chart to appear
5449
let chartTitle = app.staticTexts["Oxygen Saturation Over Time"]
5550
XCTAssertTrue(chartTitle.waitForExistence(timeout: 5))
@@ -69,4 +64,36 @@ class HKVisualizationTests: XCTestCase {
6964
let dateExists = app.staticTexts[dateStr].waitForExistence(timeout: 2)
7065
XCTAssertTrue(dateExists, "Today's date (\(dateStr)) should appear after tapping")
7166
}
67+
68+
@MainActor
69+
func testThresholdAndAverageForAllCharts() throws {
70+
let app = XCUIApplication()
71+
72+
XCTAssertTrue(app.wait(for: .runningForeground, timeout: 2.0))
73+
74+
XCTAssertTrue(app.tabBars["Tab Bar"].buttons["Dashboard"].waitForExistence(timeout: 2))
75+
app.tabBars["Tab Bar"].buttons["Dashboard"].tap()
76+
try app.handleHealthKitAuthorization()
77+
78+
// Check for Heart Rate Chart
79+
let heartRateChartTitle = app.staticTexts["Heart Rate Over Time"]
80+
XCTAssertTrue(heartRateChartTitle.waitForExistence(timeout: 5), "Heart Rate chart title should exist")
81+
82+
let heartRateThreshold = app.otherElements["Threshold"]
83+
XCTAssertTrue(heartRateThreshold.waitForExistence(timeout: 2), "Heart Rate threshold line should be visible.")
84+
85+
// Check for Body Temperature Chart
86+
let bodyTempChartTitle = app.staticTexts["Body Temperature Over Time"]
87+
XCTAssertTrue(bodyTempChartTitle.waitForExistence(timeout: 5), "Body Temperature chart title should exist")
88+
89+
let bodyTempThreshold = app.otherElements["Threshold"]
90+
XCTAssertTrue(bodyTempThreshold.waitForExistence(timeout: 2), "Body Temperature threshold line should be visible.")
91+
92+
// Check for Oxygen Saturation Chart
93+
let oxygenSatChartTitle = app.staticTexts["Oxygen Saturation Over Time"]
94+
XCTAssertTrue(oxygenSatChartTitle.waitForExistence(timeout: 5), "Oxygen Saturation chart title should exist")
95+
96+
let oxygenSatThreshold = app.otherElements["Threshold"]
97+
XCTAssertTrue(oxygenSatThreshold.waitForExistence(timeout: 2), "Oxygen Saturation threshold line should be visible.")
98+
}
7299
}

0 commit comments

Comments
 (0)