Skip to content

Commit

Permalink
Fix Previews & Improve Test Stability (#98)
Browse files Browse the repository at this point in the history
# Fix Previews & Improve Test Stability

## ♻️ Current situation & Problem
- Some previews are crashing as the `Scheduler` module is not injected
properly. It has removed the conformance to `DefaultInitializable` in
the latest major release of Spezi Scheduler.
- The tests in the Template Application can be flakey and can fail due
to multiple smaller timeout reasons.

## ⚙️ Release Notes 
- Updating all dependencies to the latest versions.
- Fixes the previews by explicitly spelling out the Scheduler
dependency.
- Improve test stability by updating dependencies & increasing timeouts.
- Adjust scheduler tests to reflect the updated versions of
dependencies.

## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
PSchmiedmayer authored Feb 4, 2025
1 parent bc37660 commit 0b78038
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 48 deletions.
20 changes: 20 additions & 0 deletions .linkspector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# This source file is part of the Stanford Spezi Template Application open-source project
#
# SPDX-FileCopyrightText: 2023 Stanford University
#
# SPDX-License-Identifier: MIT
#

dirs:
- .
excludedFiles:
- ./Scripts/TEMPLATEREADME.md
useGitIgnore: true
ignorePatterns:
- pattern: '^doc:.*$'
replacementPatterns:
- pattern: '(.*)#gh-dark-mode-only'
replacement: '$1'
- pattern: '(.*)#gh-light-mode-only'
replacement: '$1'
6 changes: 3 additions & 3 deletions Scripts/TEMPLATEREADME.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ SPDX-License-Identifier: MIT
# Spezi Template Application

This repository contains the Spezi Template Application.
The Spezi Template Application is using the [Spezi](https://github.com/StanfordSpezi/Spezi) ecosystem and builds on top of the [{{SSTA}}](https://github.com/StanfordSpezi/Spezi{{TA}}).<!-- markdown-link-check-disable-line -->
The Spezi Template Application is using the [Spezi](https://github.com/StanfordSpezi/Spezi) ecosystem and builds on top of the [{{SSTA}}](https://github.com/StanfordSpezi/Spezi{{TA}}).

> [!NOTE] 
> Do you want to learn more about the {{SSTA}} and how to use, extend, and modify this application? Check out the [{{SSTA}} documentation](https://stanfordspezi.github.io/Spezi{{TA}})<!-- markdown-link-check-disable-line -->
> Do you want to learn more about the {{SSTA}} and how to use, extend, and modify this application? Check out the [{{SSTA}} documentation](https://stanfordspezi.github.io/Spezi{{TA}}).

## Spezi Template Application Features
Expand All @@ -29,4 +29,4 @@ The Spezi Template Application is using the [Spezi](https://github.com/StanfordS

## License

This project is licensed under the MIT License. See [Licenses](LICENSES) for more information.<!-- markdown-link-check-disable-line -->
This project is licensed under the MIT License. See [Licenses](LICENSES) for more information.
5 changes: 1 addition & 4 deletions Scripts/create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,6 @@ done
rm -rf "./${appNameNoSpacesEscaped}/Supporting Files/${appNameNoSpacesEscaped}.docc"
mv "./Scripts/TEMPLATEREADME.md" "./README.md"
linkCheckDisabledEscaped=$(sed 's:/:\\/:g' <<< "<!-- markdown-link-check-disable-line -->")
sed -i '' "s/${linkCheckDisabledEscaped}//g" "./README.md"
rm -f ".linkspector.yml"
rm -rf "./Scripts"
rm -f "./.github/workflows/documentation-deployment.yml"
4 changes: 2 additions & 2 deletions TemplateApplication.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@
repositoryURL = "https://github.com/StanfordSpezi/SpeziScheduler.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.1.0;
minimumVersion = 1.1.1;
};
};
2F49B7742980407B00BCB272 /* XCRemoteSwiftPackageReference "Spezi" */ = {
Expand Down Expand Up @@ -1185,7 +1185,7 @@
repositoryURL = "https://github.com/StanfordBDHG/XCTestExtensions.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.0;
minimumVersion = 1.1.2;
};
};
2FE5DC9A29EDD9EF004B9AB4 /* XCRemoteSwiftPackageReference "XCTHealthKit" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/app-check.git",
"state" : {
"revision" : "87dd288fc792bf9751e522e171a47df5b783b0b8",
"version" : "11.1.0"
"revision" : "61b85103a1aeed8218f17c794687781505fbbef5",
"version" : "11.2.0"
}
},
{
Expand All @@ -42,8 +42,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/krzyzanowskim/CryptoSwift.git",
"state" : {
"revision" : "678d442c6f7828def400a70ae15968aef67ef52d",
"version" : "1.8.3"
"revision" : "729e01bc9b9dab466ac85f21fb9ee2bc1c61b258",
"version" : "1.8.4"
}
},
{
Expand All @@ -60,17 +60,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk.git",
"state" : {
"revision" : "f909f901bfba9e27e4e9da83242a4915d6dd64bb",
"version" : "11.3.0"
"revision" : "075679d6b25b28f4cb167f1d7769b58fb556fb30",
"version" : "11.8.0"
}
},
{
"identity" : "googleappmeasurement",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : {
"revision" : "93406fd21b85e66e2d6dbf50b472161fd75c3f1f",
"version" : "11.3.0"
"revision" : "be0881ff728eca210ccb628092af400c086abda3",
"version" : "11.7.0"
}
},
{
Expand Down Expand Up @@ -105,17 +105,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/gtm-session-fetcher.git",
"state" : {
"revision" : "a2ab612cb980066ee56d90d60d8462992c07f24b",
"version" : "3.5.0"
"revision" : "3cdb78efb79b4a5383c3911488d8025bfc545b5e",
"version" : "4.3.0"
}
},
{
"identity" : "healthkitonfhir",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/HealthKitOnFHIR.git",
"state" : {
"revision" : "87a9257e6fa37407f3437e4a0bf21dd09a4ea7c5",
"version" : "0.2.11"
"revision" : "c898c0bace660ecae37fc682d629f7883f92e700",
"version" : "0.2.13"
}
},
{
Expand Down Expand Up @@ -168,8 +168,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/ResearchKitOnFHIR.git",
"state" : {
"revision" : "d8d8b0d01599ad8a5a8397d10a99073728e6ae9b",
"version" : "2.0.2"
"revision" : "2c70b9dc7a1be9c804222e93d1737be9fca9af84",
"version" : "2.0.3"
}
},
{
Expand Down Expand Up @@ -213,17 +213,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziFirebase.git",
"state" : {
"revision" : "7c6829624884f6f1d700e0316b2580b39d3b0c5f",
"version" : "2.0.0"
"revision" : "5dd57f9de42c02d6a94f3af4d8cf3d9b81ec6661",
"version" : "2.0.1"
}
},
{
"identity" : "spezifoundation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziFoundation.git",
"state" : {
"revision" : "5b4ad1b343154b52a68c33a6bfe02d9cb07cb9dc",
"version" : "2.0.0"
"revision" : "c844b98242829fe44e7908739374d4c8b88d6da7",
"version" : "2.1.0"
}
},
{
Expand All @@ -247,10 +247,10 @@
{
"identity" : "spezinotifications",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziNotifications",
"location" : "https://github.com/StanfordSpezi/SpeziNotifications.git",
"state" : {
"revision" : "7f24fce6b969d0f1a7bcc0e228af1c01e55fb59f",
"version" : "1.0.2"
"revision" : "b886f192282a925f600ec5ecbc94acfc75460293",
"version" : "1.0.3"
}
},
{
Expand All @@ -276,26 +276,26 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziScheduler.git",
"state" : {
"revision" : "a4923dcdcc46d7edf0a7bf7ea9d9531d40abe147",
"version" : "1.1.0"
"revision" : "deb213f0be235c8cb606e2bb1a195f475637df2d",
"version" : "1.1.1"
}
},
{
"identity" : "spezistorage",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziStorage.git",
"state" : {
"revision" : "0f4a54430e51f82d29da63a7ce5f61bad7dfb9cd",
"version" : "1.2.1"
"revision" : "935a7e121d7235a394a2c744ba8b83fd52f71ece",
"version" : "1.2.3"
}
},
{
"identity" : "speziviews",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziViews.git",
"state" : {
"revision" : "69b085705f2af4c5dfe93278a228c12caa6c3379",
"version" : "1.8.0"
"revision" : "80c7cdfd5e50c3e279ab889cc90bbcfc88c4f24c",
"version" : "1.9.0"
}
},
{
Expand Down Expand Up @@ -348,8 +348,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/FelixHerrmann/swift-package-list",
"state" : {
"revision" : "e84b63c88f0797d769732440fe0786c5a2c634d8",
"version" : "4.4.0"
"revision" : "5e954ec39ce2374ff28a38224fd4e6bba7c57cdc",
"version" : "4.4.2"
}
},
{
Expand All @@ -375,8 +375,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/realm/SwiftLint.git",
"state" : {
"revision" : "25f2776977e663305bee71309ea1e34d435065f1",
"version" : "0.57.1"
"revision" : "eba420f77846e93beb98d516b225abeb2fef4ca2",
"version" : "0.58.2"
}
},
{
Expand All @@ -402,8 +402,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/XCTestExtensions.git",
"state" : {
"revision" : "5379d70249cae926927105bfb6686770f03ee5b9",
"version" : "1.1.0"
"revision" : "03eb0646dbceededbbb9d46b289f6eb50a4ec791",
"version" : "1.1.2"
}
},
{
Expand Down
1 change: 0 additions & 1 deletion TemplateApplication/Onboarding/OnboardingFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ struct OnboardingFlow: View {
OnboardingDataSource()
HealthKit()
AccountConfiguration(service: InMemoryAccountService())

TemplateApplicationScheduler()
}
}
Expand Down
1 change: 0 additions & 1 deletion TemplateApplication/Schedule/EventView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import SpeziQuestionnaire
import SpeziScheduler
import SpeziSchedulerUI
import SwiftUI


Expand Down
3 changes: 1 addition & 2 deletions TemplateApplication/Schedule/ScheduleView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@ struct ScheduleView: View {


#if DEBUG
#Preview("ScheduleView") {
#Preview {
@Previewable @State var presentingAccount = false

ScheduleView(presentingAccount: $presentingAccount)
.previewWith(standard: TemplateApplicationStandard()) {
Scheduler()
TemplateApplicationScheduler()
AccountConfiguration(service: InMemoryAccountService())
}
Expand Down
2 changes: 1 addition & 1 deletion TemplateApplicationUITests/OnboardingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ extension XCUIApplication {

try fill#Form(email: email, password: "StanfordRocks", name: PersonNameComponents(givenName: "Leland", familyName: "Stanford"))

XCTAssertTrue(collectionViews.buttons["#"].exists)
XCTAssertTrue(collectionViews.buttons["#"].waitForExistence(timeout: 2))
collectionViews.buttons["#"].tap()

if staticTexts["Consent"].waitForExistence(timeout: 4.0) && navigationBars.buttons["Back"].exists {
Expand Down
9 changes: 8 additions & 1 deletion TemplateApplicationUITests/SchedulerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SchedulerTests: XCTestCase {
app.deleteAndLaunch(withSpringboardAppName: "TemplateApplication")
}


@MainActor
func testScheduler() throws {
let app = XCUIApplication()
Expand Down Expand Up @@ -61,6 +61,13 @@ class SchedulerTests: XCTestCase {
XCTAssert(app.staticTexts["E-mail"].exists)
app.staticTexts["E-mail"].tap()

XCTAssert(nextButton.isEnabled)
nextButton.tap()

// staticTexts["What is your e-mail?"] is not exposed in the accessibility hierarchy; it seems like a bug in ResearchKit.
XCTAssert(app.textFields["Tap to answer"].exists)
try app.textFields["Tap to answer"].enter(value: "leland@stanford.edu")

XCTAssert(nextButton.isEnabled)
nextButton.tap()

Expand Down

0 comments on commit 0b78038

Please # to comment.