Skip to content

Commit 0c30209

Browse files
committed
Fix UITest & update package dependencies
1 parent a20bd2e commit 0c30209

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

Package.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ let package = Package(
2727
],
2828
dependencies: [
2929
.package(url: "https://github.com/apple/FHIRModels.git", from: "0.8.0"),
30-
.package(url: "https://github.com/StanfordSpezi/Spezi.git", from: "1.8.1"),
31-
.package(url: "https://github.com/StanfordSpezi/SpeziFoundation.git", branch: "localizations-dictionary"),
32-
.package(url: "https://github.com/StanfordSpezi/SpeziHealthKit.git", from: "1.3.2"),
33-
.package(url: "https://github.com/StanfordSpezi/SpeziScheduler.git", from: "1.2.14"),
30+
.package(url: "https://github.com/StanfordSpezi/Spezi.git", from: "1.10.1"),
31+
.package(url: "https://github.com/StanfordSpezi/SpeziFoundation.git", branch: "localizations-dictionary"), // TODO
32+
.package(url: "https://github.com/StanfordSpezi/SpeziHealthKit.git", branch: "lukas/linux-support"), // TODO
33+
.package(url: "https://github.com/StanfordSpezi/SpeziScheduler.git", from: "1.2.18"),
3434
.package(url: "https://github.com/StanfordSpezi/SpeziStorage.git", from: "2.1.0"),
3535
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.4"),
3636
.package(url: "https://github.com/apple/swift-algorithms.git", from: "1.2.1")

Sources/SpeziStudy/Study Manager/StudyManager.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ extension StudyManager {
316316
$0.id.starts(with: prefix) && !activeTaskIds.contains($0.id)
317317
})) ?? []
318318
for orphanedTask in orphanedTasks {
319-
logger.notice("Deleting orphaned Task for study '\(study.metadata.title.localizedString() ?? "")' (\(study.id)): \(orphanedTask)")
319+
logger.notice("Deleting orphaned Task for study '\(study.metadata.title[.enUS] ?? "")' (\(study.id)): \(orphanedTask)")
320320
try scheduler.deleteAllVersions(of: orphanedTask)
321321
}
322322
}
@@ -464,7 +464,7 @@ extension StudyManager {
464464

465465
/// Unenroll from a study.
466466
public func unenroll(from enrollment: StudyEnrollment) async throws {
467-
logger.notice("Unenrolling from study '\(enrollment.studyId)' (\(enrollment.studyBundle?.studyDefinition.metadata.title.localizedString() ?? ""))")
467+
logger.notice("Unenrolling from study '\(enrollment.studyId)' (\(enrollment.studyBundle?.studyDefinition.metadata.title[.enUS] ?? ""))")
468468
do {
469469
// Delete all Tasks associated with this study.
470470
// Note that we do this by simply fetching & deleting all Tasks with a matching prefix,
@@ -644,7 +644,7 @@ extension StudyManager {
644644
extension StudyManager {
645645
private func handleStudyLifecycleEvent(_ event: StudyLifecycleEvent, for studyBundle: StudyBundle, at date: Date) {
646646
logger.notice(
647-
"Handling study lifecycle event '\(String(describing: event))' for study \(studyBundle.id) (\(studyBundle.studyDefinition.metadata.title.localizedString() ?? ""))"
647+
"Handling study lifecycle event '\(String(describing: event))' for study \(studyBundle.id) (\(studyBundle.studyDefinition.metadata.title[.enUS] ?? ""))"
648648
)
649649
let cal = preferredLocale.calendar
650650
for enrollment in studyEnrollments where enrollment.studyId == studyBundle.id {

Tests/UITests/TestApp/HomeTab.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct HomeTab: View {
6565
let mockStudyV1 = try! mockStudy(revision: .v1) // swiftlint:disable:this force_try
6666
let mockStudyV2 = try! mockStudy(revision: .v2) // swiftlint:disable:this force_try
6767
let mockStudyV3 = try! mockStudy(revision: .v3) // swiftlint:disable:this force_try
68-
AsyncButton("Enroll in \(mockStudyV1.studyDefinition.metadata.title) (v\(mockStudyV1.studyDefinition.studyRevision))", state: $viewState) {
68+
AsyncButton("Enroll in \(mockStudyV1.studyDefinition.metadata.title[.enUS] ?? "") (v\(mockStudyV1.studyDefinition.studyRevision))", state: $viewState) {
6969
try await studyManager.enroll(in: mockStudyV1)
7070
}
7171
AsyncButton("Update enrollment to study revision 2", state: $viewState) {
@@ -88,7 +88,7 @@ struct HomeTab: View {
8888
VStack {
8989
if let study = enrollment.studyBundle?.studyDefinition {
9090
HStack {
91-
Text(study.metadata.title)
91+
Text(study.metadata.title[.enUS] ?? "")
9292
.font(.headline)
9393
}
9494
}

Tests/UITests/TestApp/MockStudy.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ func mockStudy(revision: MockStudyRevision) throws -> StudyBundle { // swiftlint
5757
studyRevision: revision.rawValue,
5858
metadata: StudyDefinition.Metadata(
5959
id: .studyId,
60-
title: "TestStudy",
61-
explanationText: "This is a fake study, intended for testing the SpeziStudy package.",
62-
shortExplanationText: "SpeziStudy fake test study",
60+
title: .init([.enUS: "TestStudy"]),
61+
explanationText: .init([.enUS: "This is a fake study, intended for testing the SpeziStudy package."]),
62+
shortExplanationText: .init([.enUS: "SpeziStudy fake test study"]),
6363
participationCriterion: .ageAtLeast(18) && !.ageAtLeast(60) && (.isFromRegion(.unitedStates) || .isFromRegion(.unitedKingdom)) && .speaksLanguage(.english),
6464
// swiftlint:disable:previous line_length
6565
enrollmentConditions: .none

Tests/UITests/TestAppUITests/TestAppUITests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class TestAppUITests: XCTestCase {
3939
let enrollmentDateText = DateFormatter.localizedString(from: .now, dateStyle: .short, timeStyle: .none)
4040
XCTAssert(app.staticTexts["Enrollment Date, \(enrollmentDateText)"].waitForExistence(timeout: 1))
4141

42+
app.swipeUp()
4243
XCTAssert(app.staticTexts["Article1 Title"].waitForExistence(timeout: 1))
4344
XCTAssert(app.staticTexts["Social Support"].waitForExistence(timeout: 1))
4445

@@ -52,6 +53,7 @@ class TestAppUITests: XCTestCase {
5253
// update the study to a newer version.
5354
// going from 1 to 2 will remove the questionnaire component.
5455
// since the informational component remains, and has already been completed, we expect it to stay completed.
56+
app.swipeDown()
5557
app.buttons["Update enrollment to study revision 2"].tap()
5658
XCTAssert(app.staticTexts["Study Revision, 2"].waitForExistence(timeout: 1))
5759
XCTAssert(completeWelcomeArticleButton.waitForNonExistence(timeout: 1))

0 commit comments

Comments
 (0)