diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 91dba9b9..80caf4e0 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -31,7 +31,7 @@ jobs: firebasejsonpath: ./ENGAGE-HF-Firebase/firebase.json setupfirebaseemulator: true checkout_submodules: true - customcommand: npm --prefix ENGAGE-HF-Firebase run prepare && firebase emulators:exec -c ./ENGAGE-HF-Firebase/firebase.json --export-on-exit=./firebase 'npm --prefix ./ENGAGE-HF-Firebase/functions run serve:seed' + customcommand: npm --prefix ENGAGE-HF-Firebase run prepare && firebase emulators:exec -c ./ENGAGE-HF-Firebase/firebase.json --export-on-exit=./firebase 'npm --prefix ./ENGAGE-HF-Firebase/functions run serve:seed && sleep 10' secrets: GOOGLE_APPLICATION_CREDENTIALS_BASE64: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_BASE64 }} uploadcoveragereport: diff --git a/ENGAGE-HF-Firebase b/ENGAGE-HF-Firebase index cc09c8d9..91a3e8b9 160000 --- a/ENGAGE-HF-Firebase +++ b/ENGAGE-HF-Firebase @@ -1 +1 @@ -Subproject commit cc09c8d9ba1b94e14bc7f62e1c4441b44a7c7b4d +Subproject commit 91a3e8b949ab03164f29f9ae0c98055622827bdd diff --git a/ENGAGEHF/Account/InvitationCodeModule.swift b/ENGAGEHF/Account/InvitationCodeModule.swift index 3227cb53..0b95415c 100644 --- a/ENGAGEHF/Account/InvitationCodeModule.swift +++ b/ENGAGEHF/Account/InvitationCodeModule.swift @@ -100,6 +100,7 @@ class InvitationCodeModule: Module, EnvironmentAccessible { if account.details != nil { // always start logged out, even if testing account had already been set up try await accountService.logout() + try await Task.sleep(for: .seconds(1)) } do { @@ -118,7 +119,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(10)) + try await Task.sleep(for: .seconds(1)) try await verifyOnboardingCode(invitationCode) } catch { logger.error("Failed setting up test account : \(error)") diff --git a/ENGAGEHFUITests/Education/EducationViewUITests.swift b/ENGAGEHFUITests/Education/EducationViewUITests.swift index acbc315d..d4bae5a4 100644 --- a/ENGAGEHFUITests/Education/EducationViewUITests.swift +++ b/ENGAGEHFUITests/Education/EducationViewUITests.swift @@ -20,9 +20,8 @@ final class EducationViewUITests: XCTestCase { app.launch() } - @MainActor - func testLongDescriptionVideoView() throws { + func testLongDescriptionVideoView() async throws { let app = XCUIApplication() _ = app.staticTexts["Home"].waitForExistence(timeout: 5) @@ -33,18 +32,16 @@ final class EducationViewUITests: XCTestCase { thumbnailOverlay.tap() - sleep(2) - // Validate navigation bar - XCTAssert(app.buttons["Education"].waitForExistence(timeout: 0.5)) + XCTAssert(app.buttons["Education"].waitForExistence(timeout: 2)) let expectedNavigationTitle = app.navigationBars["Long Description"] - XCTAssert(expectedNavigationTitle.exists) + XCTAssert(expectedNavigationTitle.waitForExistence(timeout: 2)) // Validate video player - XCTAssert(app.staticTexts["Installing ENGAGE-HF App and Connecting Omron Devices"].exists) - XCTAssert(app.links["Photo image of Education For Patients By Dr Zahra Azizi"].exists) - XCTAssert(app.buttons["Play"].exists) + XCTAssert(app.staticTexts["Installing ENGAGE-HF App and Connecting Omron Devices"].waitForExistence(timeout: 2)) + XCTAssert(app.links["Photo image of Education For Patients"].waitForExistence(timeout: 2)) + XCTAssert(app.buttons["Play"].waitForExistence(timeout: 2)) XCTAssert(app.buttons["Play"].isHittable) // Validate video description @@ -71,7 +68,8 @@ final class EducationViewUITests: XCTestCase { } - func testShortDescrtiptionVideoView() throws { + @MainActor + func testShortDescrtiptionVideoView() async throws { let app = XCUIApplication() _ = app.staticTexts["Home"].waitForExistence(timeout: 5) @@ -82,18 +80,16 @@ final class EducationViewUITests: XCTestCase { thumbnailOverlay.tap() - sleep(2) - // Validate navigation bar - XCTAssert(app.buttons["Education"].waitForExistence(timeout: 0.5)) + XCTAssert(app.buttons["Education"].waitForExistence(timeout: 2)) let expectedNavigationTitle = app.navigationBars["Short Description"] - XCTAssert(expectedNavigationTitle.exists) + XCTAssert(expectedNavigationTitle.waitForExistence(timeout: 2)) // Validate video player - XCTAssert(app.staticTexts["Beta Blockers for Heart Failure"].exists) - XCTAssert(app.links["Photo image of Education For Patients By Dr Zahra Azizi"].exists) - XCTAssert(app.buttons["Play"].exists) + XCTAssert(app.staticTexts["Beta Blockers for Heart Failure"].waitForExistence(timeout: 2)) + XCTAssert(app.links["Photo image of Education For Patients"].waitForExistence(timeout: 2)) + XCTAssert(app.buttons["Play"].waitForExistence(timeout: 2)) XCTAssert(app.buttons["Play"].isHittable) // Validate video description @@ -115,7 +111,8 @@ final class EducationViewUITests: XCTestCase { } - func testNoDescriptionVideoView() throws { + @MainActor + func testNoDescriptionVideoView() async throws { let app = XCUIApplication() _ = app.staticTexts["Home"].waitForExistence(timeout: 5) @@ -126,18 +123,18 @@ final class EducationViewUITests: XCTestCase { thumbnailOverlay.tap() - sleep(2) + try await Task.sleep(for: .seconds(2)) // Validate navigation bar - XCTAssert(app.buttons["Education"].waitForExistence(timeout: 0.5)) + XCTAssert(app.buttons["Education"].waitForExistence(timeout: 2)) let expectedNavigationTitle = app.navigationBars["No Description"] XCTAssert(expectedNavigationTitle.exists) // Validate video player - XCTAssert(app.staticTexts["How to Use the ENGAGE-HF App!"].exists) - XCTAssert(app.links["Photo image of Education For Patients By Dr Zahra Azizi"].exists) - XCTAssert(app.buttons["Play"].exists) + XCTAssert(app.staticTexts["How to Use the ENGAGE-HF App!"].waitForExistence(timeout: 2)) + XCTAssert(app.links["Photo image of Education For Patients"].waitForExistence(timeout: 2)) + XCTAssert(app.buttons["Play"].waitForExistence(timeout: 2)) XCTAssert(app.buttons["Play"].isHittable) // Make sure there's no description