Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/fix testing #5

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
runsonlabels: '["macOS", "self-hosted"]'
setupSimulators: true
setupfirebaseemulator: true
customcommand: "npm install --previx ./functions && firebase emulators:exec --import=./firebase 'fastlane test'"
customcommand: "npm install --prefix ./functions && firebase emulators:exec --import=./firebase 'fastlane test'"
uploadcoveragereport:
name: Upload Coverage Report
needs: buildandtest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "84060c25a97a757bf3045128a2563021282283c70a9cb6009941a41298deef92",
"originHash" : "7a1ae4cd835f2e84578822a40fc673f29fc7ab26c0416a0079ce8402bbb3da0b",
"pins" : [
{
"identity" : "abseil-cpp-binary",
Expand Down Expand Up @@ -190,6 +190,15 @@
"version" : "1.2.2"
}
},
{
"identity" : "spezibluetooth",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziBluetooth.git",
"state" : {
"revision" : "3178bc1184dc6636e8112694e09fdfca7cbcf7d7",
"version" : "1.0.2"
}
},
{
"identity" : "spezicontact",
"kind" : "remoteSourceControl",
Expand All @@ -199,6 +208,15 @@
"version" : "1.0.0"
}
},
{
"identity" : "spezifileformats",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziFileFormats",
"state" : {
"revision" : "017ea997f4f6128b15e8b8d4aac979cb7a822e74",
"version" : "1.2.0"
}
},
{
"identity" : "spezifirebase",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -280,6 +298,15 @@
"version" : "1.2.3"
}
},
{
"identity" : "swift-atomics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-atomics.git",
"state" : {
"revision" : "cd142fd2f64be2100422d658e7411e39489da985",
"version" : "1.2.0"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
Expand All @@ -289,6 +316,15 @@
"version" : "1.1.0"
}
},
{
"identity" : "swift-nio",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio.git",
"state" : {
"revision" : "fc63f0cf4e55a4597407a9fc95b16a2bc44b4982",
"version" : "2.64.0"
}
},
{
"identity" : "swift-package-list",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -316,6 +352,15 @@
"version" : "509.0.2"
}
},
{
"identity" : "swift-system",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-system.git",
"state" : {
"revision" : "025bcb1165deab2e20d4eaba79967ce73013f496",
"version" : "1.2.1"
}
},
{
"identity" : "swiftlint",
"kind" : "remoteSourceControl",
Expand Down
1 change: 1 addition & 0 deletions ENGAGEHFUITests/OnboardingUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ extension XCUIApplication {
textFields["Enter your last name ..."].typeText("Stanford")

XCTAssertTrue(scrollViews["Signature Field"].waitForExistence(timeout: 2))
scrollViews["Signature Field"].tap()
scrollViews["Signature Field"].swipeRight()

XCTAssert(buttons["I Consent"].waitForExistence(timeout: 2)
Expand Down
7 changes: 7 additions & 0 deletions functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,27 @@ exports.checkInvitationCode = onCall(async (request) => {

try {
// Based on https://github.com/StanfordSpezi/SpeziStudyApplication/blob/main/functions/index.js
logger.debug("Fetching invitation code document");
const invitationCodeRef = firestore.doc(`invitationCodes/${invitationCode}`);
const invitationCodeDoc = await invitationCodeRef.get();
logger.debug(`Found invitation code document: ${invitationCodeDoc.exists}`);

if (!invitationCodeDoc.exists || (invitationCodeDoc.data().used)) {
logger.warn(`Invitation code not found or already used: ${invitationCode}`);
throw new https.HttpsError("not-found", "Invitation code not found or already used.");
}

logger.debug("Getting user study document")
const userStudyRef = firestore.doc(`users/${userId}`);
const userStudyDoc = await userStudyRef.get();
logger.debug("Finished getting user study document")

if (userStudyDoc.exists) {
logger.warn(`User (${userId}) is already enrolled in the study.`);
throw new https.HttpsError("already-exists", "User is already enrolled in the study.");
}

logger.debug("Transaction: Enrolling user in study");
await firestore.runTransaction(async (transaction) => {
transaction.set(userStudyRef, {
invitationCode: invitationCode,
Expand Down
Loading