Skip to content

Commit

Permalink
Update Firebase Setup (#120)
Browse files Browse the repository at this point in the history
# Update Firebase Setup


## ⚙️ Release Notes 
- Update Firebase Setup


### Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
PSchmiedmayer authored Dec 10, 2024
1 parent 7b60bfd commit 532d7e7
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion ENGAGE-HF-Firebase
Submodule ENGAGE-HF-Firebase updated 81 files
+1 −0 .github/workflows/production.yml
+14 −0 CONTRIBUTORS.md
+15 −0 Dockerfile
+5 −0 Dockerfile.license
+175 −124 README.md
+21 −0 docker-compose.yml
+5 −0 docker-compose.yml.license
+2 −1 firebase.json
+98 −0 firestore.indexes.json
+5 −0 firestore.indexes.json.license
+12 −7 firestore.rules
+5 −0 functions/data/debug/users.json
+4 −4 functions/data/medicationCodes.json
+7 −7 functions/data/medications.json
+6 −6 functions/data/organizations.json
+5 −5 functions/data/questionnaires.json
+42 −40 functions/models/package-lock.json
+12 −1 functions/models/src/fhir/fhirAppointment.ts
+10 −0 functions/models/src/fhir/fhirObservation.ts
+0 −0 functions/models/src/helpers/array.ts
+1 −0 functions/models/src/index.ts
+93 −15 functions/models/src/types/userMessage.ts
+18 −1 functions/models/src/types/userRegistration.ts
+4 −4 functions/models/src/types/video.ts
+478 −469 functions/package-lock.json
+3 −3 functions/package.json
+65 −42 functions/src/functions/blocking.ts
+1 −1 functions/src/functions/defaultSeed.test.ts
+49 −8 functions/src/functions/defaultSeed.ts
+18 −5 functions/src/functions/enrollUser.test.ts
+4 −2 functions/src/functions/enrollUser.ts
+16 −81 functions/src/functions/helpers.ts
+3 −8 functions/src/functions/onSchedule.ts
+1 −1 functions/src/functions/onUserDocumentWritten.ts
+25 −1 functions/src/functions/onUserWritten.ts
+0 −2 functions/src/functions/updateUserInformation.test.ts
+8 −3 functions/src/healthSummary/generate+localizations.ts
+4 −2 functions/src/healthSummary/generate.test.ts
+5 −9 functions/src/healthSummary/generate.ts
+1 −1 functions/src/healthSummary/generateChart.test.ts
+1 −1 functions/src/healthSummary/generateSpeedometer.test.ts
+3 −2 functions/src/models/healthSummaryData.ts
+1 −0 functions/src/models/medicationRequestContext.ts
+1 −10 functions/src/services/database/collections.ts
+7 −0 functions/src/services/database/databaseService.ts
+17 −2 functions/src/services/database/firestoreService.ts
+1 −1 functions/src/services/healthSummary/databaseHealthSummaryService.test.ts
+3 −5 functions/src/services/healthSummary/databaseHealthSummaryService.ts
+10 −2 functions/src/services/healthSummary/healthSummaryService.mock.ts
+7 −0 functions/src/services/history/databaseHistoryService.ts
+1 −0 functions/src/services/history/historyService.ts
+5 −5 functions/src/services/medication/databaseMedicationService.ts
+1 −2 functions/src/services/medication/medicationService.ts
+40 −25 functions/src/services/message/defaultMessageService.ts
+2 −1 functions/src/services/message/messageService.ts
+2 −2 functions/src/services/patient/databasePatientService.ts
+23 −7 functions/src/services/patient/patientService.mock.ts
+6 −3 functions/src/services/recommendation/recommendationService.test.ts
+22 −9 functions/src/services/recommendation/recommendationService.ts
+11 −5 functions/src/services/recommendation/recommenders/betaBlockerRecommender.test.ts
+3 −2 functions/src/services/recommendation/recommenders/diureticRecommender.test.ts
+10 −4 functions/src/services/recommendation/recommenders/mraRecommender.test.ts
+23 −11 functions/src/services/recommendation/recommenders/rasiRecommender.test.ts
+14 −3 functions/src/services/recommendation/recommenders/recommender.ts
+13 −7 functions/src/services/recommendation/recommenders/sglt2iRecommender.test.ts
+39 −5 functions/src/services/seeding/debugData/debugDataService.ts
+1 −1 functions/src/services/seeding/staticData/staticDataService.ts
+1 −1 functions/src/services/symptomScore/defaultSymptomScoreCalculator.ts
+104 −26 functions/src/services/trigger/triggerService.test.ts
+328 −176 functions/src/services/trigger/triggerService.ts
+20 −14 functions/src/services/user/databaseUserService.test.ts
+113 −76 functions/src/services/user/databaseUserService.ts
+12 −1 functions/src/services/user/userService.mock.ts
+7 −1 functions/src/services/user/userService.ts
+5 −0 functions/src/tests/mocks/firestore.ts
+2 −1 functions/src/tests/mocks/healthSummaryData.ts
+ functions/src/tests/resources/emptyHealthSummary.pdf
+ functions/src/tests/resources/mockHealthSummary.pdf
+1 −1 functions/src/tests/resources/seeding/users_0_messages.json
+136 −0 functions/src/tests/rules/userCollections.test.ts
+11 −0 functions/src/tests/rules/users.test.ts
3 changes: 2 additions & 1 deletion ENGAGEHF/Account/InvitationCodeModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)")
Expand Down
43 changes: 20 additions & 23 deletions ENGAGEHFUITests/Education/EducationViewUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 532d7e7

Please sign in to comment.