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

SpeziOnboarding #129

Open
wants to merge 56 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
5e86439
SpeziOnboarding
pauljohanneskraft Oct 21, 2024
f8530e9
Merge branch 'main' into feature/spezi-onboarding
pauljohanneskraft Oct 23, 2024
bfc3a6f
update
pauljohanneskraft Oct 24, 2024
6407397
Merge branch 'main' into feature/spezi-onboarding
Basler182 Nov 3, 2024
aaf29df
SpeziViews
pauljohanneskraft Nov 9, 2024
11efb05
intermediate
pauljohanneskraft Nov 10, 2024
5fa1c8d
Update SuspendButton implementation
pauljohanneskraft Nov 10, 2024
37159b8
Update tests for PersonalInfo
pauljohanneskraft Nov 11, 2024
f3f516b
Finish up SpeziViews
pauljohanneskraft Nov 11, 2024
306b46b
Rename test
pauljohanneskraft Nov 11, 2024
dc8133b
Fix import issues
pauljohanneskraft Nov 11, 2024
4258420
Remove import issues
pauljohanneskraft Nov 11, 2024
e3baa1b
Add import
pauljohanneskraft Nov 11, 2024
0a94bc5
Move files into the correct repositories
pauljohanneskraft Nov 11, 2024
40601b4
Rename package
pauljohanneskraft Nov 11, 2024
728e534
Remove nonimported usages of PersonNameComponents
pauljohanneskraft Nov 11, 2024
7928eb2
Update previews
pauljohanneskraft Nov 11, 2024
d974d16
fix imports
pauljohanneskraft Nov 11, 2024
5143693
detekt
pauljohanneskraft Nov 11, 2024
2c8e57b
Fix tests
pauljohanneskraft Nov 11, 2024
10a2543
fix
pauljohanneskraft Nov 12, 2024
5c2d056
Update
pauljohanneskraft Nov 18, 2024
6f5b66c
review adaptions
pauljohanneskraft Nov 18, 2024
e02bad3
tests
pauljohanneskraft Nov 18, 2024
0a0fc2f
adapt tests
pauljohanneskraft Nov 18, 2024
35f5076
update
pauljohanneskraft Nov 19, 2024
307d84c
Adapt contact
pauljohanneskraft Nov 19, 2024
fcda9c7
Add modifier parameters
pauljohanneskraft Nov 19, 2024
088e66f
Fix tests
pauljohanneskraft Nov 19, 2024
2207da9
detekt
pauljohanneskraft Nov 19, 2024
c84e748
update
pauljohanneskraft Nov 19, 2024
d184b64
adapt tests
pauljohanneskraft Nov 19, 2024
58dc269
small update
pauljohanneskraft Nov 19, 2024
858c75f
Make sure to only trigger validation after the first input
pauljohanneskraft Nov 19, 2024
f3af7e3
detekt
pauljohanneskraft Nov 19, 2024
ace70d4
Add onSubmit
pauljohanneskraft Nov 19, 2024
1e2b0a9
Merge branch 'feature/spezi-views' into feature/spezi-onboarding
pauljohanneskraft Nov 22, 2024
d61539f
detekt
pauljohanneskraft Nov 22, 2024
7a94909
Merge completed
pauljohanneskraft Nov 22, 2024
f4bcd7a
Improve onboarding
pauljohanneskraft Nov 23, 2024
e3a1791
Add current state of SpeziOnboarding
pauljohanneskraft Nov 24, 2024
7287d9a
Merge branch 'main' into feature/spezi-onboarding
pauljohanneskraft Nov 24, 2024
3e83e41
detekt
pauljohanneskraft Nov 24, 2024
e34fccd
Update OnboardingTests
pauljohanneskraft Nov 24, 2024
758b44c
Use IllegalOnboardingStep
pauljohanneskraft Nov 24, 2024
3ca3568
Remove empty tests
pauljohanneskraft Nov 24, 2024
3b9e3c2
Update Consent
pauljohanneskraft Nov 24, 2024
602b794
Make it build
pauljohanneskraft Nov 24, 2024
b8af94b
Reduce changes
pauljohanneskraft Nov 24, 2024
4e6e3ee
Bring back some old functionality
pauljohanneskraft Nov 24, 2024
b810c92
Remove unused type
pauljohanneskraft Nov 24, 2024
7759e92
Remove consent from ENGAGE-HF
pauljohanneskraft Nov 26, 2024
bc9663c
Remove tests
pauljohanneskraft Nov 26, 2024
2c4e8a7
update tests
pauljohanneskraft Nov 26, 2024
32746ae
detekt
pauljohanneskraft Nov 26, 2024
4eb35c8
Merge branch 'main' into feature/spezi-onboarding
pauljohanneskraft Nov 26, 2024
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
4 changes: 0 additions & 4 deletions app/src/main/kotlin/edu/stanford/bdh/engagehf/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,6 @@ class MainActivity : FragmentActivity() {
Routes.SequentialOnboardingScreen
)

is OnboardingNavigationEvent.ConsentScreen -> navHostController.navigate(
Routes.ConsentScreen
)

is AppNavigationEvent.AppScreen -> navHostController.navigateTo(
route = Routes.AppScreen,
clearBackStack = event.clearBackStack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ sealed class Routes {
@Serializable
data object OnboardingScreen : Routes()

@Serializable
data object ConsentScreen : Routes()

@Serializable
data object ContactScreen : Routes()
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import edu.stanford.spezi.module.onboarding.consent.ConsentManager
import edu.stanford.spezi.module.onboarding.invitation.InvitationCodeRepository
import edu.stanford.spezi.module.onboarding.onboarding.OnboardingRepository
import edu.stanford.spezi.module.onboarding.sequential.SequentialOnboardingRepository
Expand All @@ -30,9 +29,4 @@ abstract class OnboardingModule {
abstract fun bindSequentialOnboardingRepository(
engageSequentialOnboardingRepository: EngageSequentialOnboardingRepository,
): SequentialOnboardingRepository

@Binds
abstract fun bindOnConsentRepository(
engageConsentManager: EngageConsentManager,
): ConsentManager
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package edu.stanford.spezi.core.utils

interface Standard
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's please start creating correct modules as part of this PR already, you can use the script that I have shared. In iOS this is defined under Spezi package. Create a module under modules:spezi and define this interface there, and add modules:spezi dependency where you need this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to wait for this until SpeziAccount is merged, hope that's fine. Especially, I would want them to be self-contained (if this makes sense), i.e. to have no dependencies outside of their own package ecosystem and that will most likely mean that we will need to put some stuff into the packages that do not exist in the iOS version and that are Android-specific (e.g. SpeziTheme, etc).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I can do, is simply creating a single package for this interface, so that it isn't part of core:utils, if that's good enough

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import dagger.hilt.testing.TestInstallIn
import edu.stanford.spezi.module.account.di.AccountModule
import edu.stanford.spezi.module.account.manager.InvitationAuthManager
import edu.stanford.spezi.module.account.manager.UserSessionManager
import edu.stanford.spezi.module.onboarding.consent.ConsentManager
import edu.stanford.spezi.module.onboarding.fakes.FakeOnboardingRepository
import edu.stanford.spezi.module.onboarding.invitation.InvitationCodeRepository
import edu.stanford.spezi.module.onboarding.onboarding.OnboardingRepository
Expand Down Expand Up @@ -43,8 +42,4 @@ class TestOnboardingModule {
@Provides
@Singleton
fun provideSequentialOnboardingRepository(): SequentialOnboardingRepository = mockk()

@Provides
@Singleton
fun provideOnConsentRepository(): ConsentManager = mockk()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package edu.stanford.spezi.module.onboarding.spezi

import androidx.compose.ui.test.junit4.createComposeRule
import edu.stanford.spezi.module.onboarding.spezi.composables.DynamicOnboardingTestComposable
import edu.stanford.spezi.module.onboarding.spezi.simulators.DynamicOnboardingSimulator
import org.junit.Before
import org.junit.Rule
import org.junit.Test

class DynamicOnboardingTest {

@get:Rule
val composeRule = createComposeRule()

@Before
fun init() {
composeRule.setContent {
DynamicOnboardingTestComposable()
}
}

@Test
fun testDynamicOnboardingFlowONE() {
dynamicOnboarding {
assertTextExists("START")
clickButton("ONE")
assertTextExists("TITLE: ONE")
clickButton("Next")
assertTextExists("TITLE: TWO")
clickButton("Next")
assertTextExists("Done")
assertTextExists("Dynamic Onboarding done!")
}
}

@Test
fun testDynamicOnboardingFlowTWO() {
dynamicOnboarding {
assertTextExists("START")
clickButton("TWO")
assertTextExists("TITLE: TWO")
clickButton("Next")
assertTextExists("Done")
assertTextExists("Dynamic Onboarding done!")
}
}

@Test
fun testDynamicOnboardingFlowTHREE() {
dynamicOnboarding {
assertTextExists("START")
clickButton("THREE")
assertTextExists("TITLE: THREE")
clickButton("Next")
assertTextExists("TITLE: ONE")
clickButton("Next")
assertTextExists("TITLE: TWO")
clickButton("Next")
assertTextExists("Done")
assertTextExists("Dynamic Onboarding done!")
}
}

@Test
fun testDynamicOnboardingFlowNext() {
dynamicOnboarding {
assertTextExists("START")
clickButton("Next")
composeRule.waitForIdle()
assertTextExists("TITLE: ONE")
clickButton("Next")
assertTextExists("TITLE: TWO")
clickButton("Next")
assertTextExists("Done")
assertTextExists("Dynamic Onboarding done!")
}
}

private fun dynamicOnboarding(block: DynamicOnboardingSimulator.() -> Unit) {
DynamicOnboardingSimulator(composeRule).apply { block() }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package edu.stanford.spezi.module.onboarding.spezi

import androidx.compose.ui.test.junit4.createComposeRule
import edu.stanford.spezi.module.onboarding.spezi.composables.SequentialOnboardingTestComposable
import edu.stanford.spezi.module.onboarding.spezi.simulators.SequentialOnboardingSimulator
import org.junit.Before
import org.junit.Rule
import org.junit.Test

class SequentialOnboardingTest {

@get:Rule
val composeRule = createComposeRule()

@Before
fun init() {
composeRule.setContent {
SequentialOnboardingTestComposable()
}
}

@Test
fun testSequentialOnboarding() {
sequentialOnboarding {
assertTextExists("Things to know")
assertTextExists("And you should pay close attention ...")

assertTextExists("1")
assertTextExists("A thing to know")
assertTextDoesNotExist("2")
assertTextDoesNotExist("Second thing to know")
assertTextDoesNotExist("3")
assertTextDoesNotExist("Third thing to know")
assertTextDoesNotExist("4")
assertTextDoesNotExist("Now you should know all the things!")

clickButton("Next")

assertTextExists("1")
assertTextExists("A thing to know")
assertTextExists("2")
assertTextExists("Second thing to know")
assertTextDoesNotExist("3")
assertTextDoesNotExist("Third thing to know")
assertTextDoesNotExist("4")
assertTextDoesNotExist("Now you should know all the things!")

clickButton("Next")

assertTextExists("1")
assertTextExists("A thing to know")
assertTextExists("2")
assertTextExists("Second thing to know")
assertTextExists("3")
assertTextExists("Third thing to know")
assertTextDoesNotExist("4")
assertTextDoesNotExist("Now you should know all the things!")

clickButton("Next")

assertTextExists("1")
assertTextExists("A thing to know")
assertTextExists("2")
assertTextExists("Second thing to know")
assertTextExists("3")
assertTextExists("Third thing to know")
assertTextExists("4")
assertTextExists("Now you should know all the things!")

clickButton("Continue")

assertTextExists("Done")
assertTextExists("Sequential Onboarding done!")
}
}

private fun sequentialOnboarding(block: SequentialOnboardingSimulator.() -> Unit) {
SequentialOnboardingSimulator(composeRule).apply { block() }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package edu.stanford.spezi.module.onboarding.spezi

import androidx.compose.ui.test.junit4.createComposeRule
import edu.stanford.spezi.module.onboarding.spezi.composables.WelcomeOnboardingTestComposable
import edu.stanford.spezi.module.onboarding.spezi.simulators.WelcomeOnboardingSimulator
import org.junit.Before
import org.junit.Rule
import org.junit.Test

class WelcomeOnboardingTest {

@get:Rule
val composeRule = createComposeRule()

@Before
fun init() {
composeRule.setContent {
WelcomeOnboardingTestComposable()
}
}

@Test
fun testWelcomeOnboarding() {
welcomeOnboarding {
assertTextExists("Welcome")
assertTextExists("Spezi UI Tests")

assertTextExists("Tortoise")
assertTextExists("A Tortoise!")

assertTextExists("Tree")
assertTextExists("A Tree!")

assertTextExists("Letter")
assertTextExists("A letter!")

assertTextExists("Circle")
assertTextExists("A circle!")

clickButton("Learn More")

assertTextExists("Done")
assertTextExists("Welcome Onboarding done!")
}
}

private fun welcomeOnboarding(block: WelcomeOnboardingSimulator.() -> Unit) {
WelcomeOnboardingSimulator(composeRule).apply { block() }
}
}
Loading
Loading