diff --git a/app/src/androidTest/java/com/jmp/xtudent/features/onboarding/screen/OnboardingCarouselScreen.kt b/app/src/androidTest/java/com/jmp/xtudent/features/onboarding/screen/OnboardingCarouselScreen.kt index 0e82218..1de7db3 100644 --- a/app/src/androidTest/java/com/jmp/xtudent/features/onboarding/screen/OnboardingCarouselScreen.kt +++ b/app/src/androidTest/java/com/jmp/xtudent/features/onboarding/screen/OnboardingCarouselScreen.kt @@ -10,7 +10,9 @@ import com.jmp.examsfeature.presentation.list.screens.ExamsScreenTestTags.EMPTY_ import com.jmp.onboardingfeature.OnboardingCarouselScreenTestTags.FIRST_ONBOARDING_LOTTIE import com.jmp.onboardingfeature.OnboardingCarouselScreenTestTags.NEXT_BUTTON import com.jmp.onboardingfeature.OnboardingCarouselScreenTestTags.ONBOARDING_SCREEN_NAME +import com.jmp.onboardingfeature.OnboardingCarouselScreenTestTags.SECOND_ONBOARDING_LOTTIE import com.jmp.onboardingfeature.OnboardingCarouselScreenTestTags.SKIP_BUTTON +import com.jmp.onboardingfeature.OnboardingCarouselScreenTestTags.THIRD_ONBOARDING_LOTTIE import com.jmp.xtudent.core.TestUtils.waitForNode import com.jmp.xtudent.features.exams.list.screen.ExamsScreen @@ -42,9 +44,21 @@ open class OnboardingCarouselScreen( } fun waitUntilFirstLottieIsLoaded(): OnboardingCarouselScreen = apply { + waitUntilLottieIsLoaded(FIRST_ONBOARDING_LOTTIE) + } + + fun waitUntilSecondLottieIsLoaded(): OnboardingCarouselScreen = apply { + waitUntilLottieIsLoaded(SECOND_ONBOARDING_LOTTIE) + } + + fun waitUntilThirdLottieIsLoaded(): OnboardingCarouselScreen = apply { + waitUntilLottieIsLoaded(THIRD_ONBOARDING_LOTTIE) + } + + private fun waitUntilLottieIsLoaded(testTag: String): OnboardingCarouselScreen = apply { waitUntil { composeTestRule - .onNodeWithTag(FIRST_ONBOARDING_LOTTIE) + .onNodeWithTag(testTag) .fetchSemanticsNode() .config .getOrNull(SemanticsProperties.ProgressBarRangeInfo) diff --git a/app/src/androidTest/java/com/jmp/xtudent/features/onboarding/test/OnboardingCarouselScreenTest.kt b/app/src/androidTest/java/com/jmp/xtudent/features/onboarding/test/OnboardingCarouselScreenTest.kt index 62aa4c8..9e70dbd 100644 --- a/app/src/androidTest/java/com/jmp/xtudent/features/onboarding/test/OnboardingCarouselScreenTest.kt +++ b/app/src/androidTest/java/com/jmp/xtudent/features/onboarding/test/OnboardingCarouselScreenTest.kt @@ -22,6 +22,7 @@ open class OnboardingCarouselScreenTest : UiTest() { @Test fun shouldOpenOnboardingCarouselScreen() = runTest { onOnboardingCarouselScreen() + .waitUntilFirstLottieIsLoaded() compareScreenshot(composeRule) } @@ -30,6 +31,7 @@ open class OnboardingCarouselScreenTest : UiTest() { fun shouldNavigateToSecondOnboardingSlide() = runTest { onOnboardingCarouselScreen() .tapOnNextButton() + .waitUntilSecondLottieIsLoaded() compareScreenshot(composeRule) } @@ -39,6 +41,7 @@ open class OnboardingCarouselScreenTest : UiTest() { onOnboardingCarouselScreen() .tapOnNextButton() .tapOnNextButton() + .waitUntilThirdLottieIsLoaded() compareScreenshot(composeRule) }