diff --git a/ENGAGEHF/Account/InvitationCodeModule.swift b/ENGAGEHF/Account/InvitationCodeModule.swift index 9c9f36e3..f905ee8f 100644 --- a/ENGAGEHF/Account/InvitationCodeModule.swift +++ b/ENGAGEHF/Account/InvitationCodeModule.swift @@ -100,6 +100,7 @@ class InvitationCodeModule: Module, EnvironmentAccessible { details.password = password details.name = PersonNameComponents(givenName: "Leland", familyName: "Stanford") try await accountService.signUp(with: details) + try await Task.sleep(for: .seconds(0.5)) try await verifyOnboardingCode(invitationCode) } catch { logger.error("Failed setting up test account : \(error)") diff --git a/ENGAGEHFUITests/Dashboard/RecentVitalsUITests.swift b/ENGAGEHFUITests/Dashboard/RecentVitalsUITests.swift index 1d095e42..96e577f0 100644 --- a/ENGAGEHFUITests/Dashboard/RecentVitalsUITests.swift +++ b/ENGAGEHFUITests/Dashboard/RecentVitalsUITests.swift @@ -9,6 +9,16 @@ import XCTest final class RecentVitalsUITests: XCTestCase { + private var expectedFormattedMeasurementDate: String { + let expectedDateComponents = DateComponents(year: 2024, month: 6, day: 5, hour: 12, minute: 33, second: 11) + let expectedDate = Calendar.current.date(from: expectedDateComponents) ?? .now + let daylightSavingTimeOffset = TimeZone.current.daylightSavingTimeOffset(for: expectedDate) + let formatter = DateFormatter() + formatter.dateFormat = "M/d/yyyy, h:mm a" + return formatter.string(from: expectedDate.addingTimeInterval(daylightSavingTimeOffset)) + } + + override func setUpWithError() throws { try super.setUpWithError() @@ -58,7 +68,7 @@ final class RecentVitalsUITests: XCTestCase { XCTAssert(app.staticTexts["Recent Vitals"].waitForExistence(timeout: 0.5)) XCTAssert(app.staticTexts["Weight Quantity: \(expectedWeight)"].exists) XCTAssert(app.staticTexts["Weight Unit: \(weightUnit)"].exists) - XCTAssert(app.staticTexts["Weight Date: 6/5/2024, 12:33 PM"].exists) + XCTAssert(app.staticTexts["Weight Date: \(expectedFormattedMeasurementDate)"].exists) app.staticTexts["Weight Quantity: \(expectedWeight)"].tap() XCTAssert(app.staticTexts["Body Weight"].waitForExistence(timeout: 2.0)) @@ -103,7 +113,7 @@ final class RecentVitalsUITests: XCTestCase { let heartRateQuantityText = "Heart Rate Quantity: 62" XCTAssert(app.staticTexts[heartRateQuantityText].exists) XCTAssert(app.staticTexts["Heart Rate Unit: BPM"].exists) - XCTAssert(app.staticTexts["Heart Rate Date: 6/5/2024, 12:33 PM"].exists) + XCTAssert(app.staticTexts["Heart Rate Date: \(expectedFormattedMeasurementDate)"].exists) app.staticTexts[heartRateQuantityText].tap() XCTAssert(app.staticTexts["Heart Rate"].waitForExistence(timeout: 2.0)) @@ -114,7 +124,7 @@ final class RecentVitalsUITests: XCTestCase { let bloodPressureQuantityText = "Blood Pressure Quantity: 103/64" XCTAssert(app.staticTexts[bloodPressureQuantityText].exists) XCTAssert(app.staticTexts["Blood Pressure Unit: mmHg"].exists) - XCTAssert(app.staticTexts["Blood Pressure Date: 6/5/2024, 12:33 PM"].exists) + XCTAssert(app.staticTexts["Blood Pressure Date: \(expectedFormattedMeasurementDate)"].exists) app.staticTexts[bloodPressureQuantityText].tap() XCTAssert(app.staticTexts["Blood Pressure"].waitForExistence(timeout: 2.0))