diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentTest.kt index b3e9922c9195fea17295954099074f981e272597..3df630d6cb70d01d8af5578bd46ec4f27b85de7d 100644 --- a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentTest.kt +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/main/home/HomeFragmentTest.kt @@ -34,6 +34,7 @@ import de.rki.coronawarnapp.util.shortcuts.AppShortcutsHelper import de.rki.coronawarnapp.util.ui.SingleLiveEvent import de.rki.coronawarnapp.vaccination.core.VaccinationSettings import de.rki.coronawarnapp.vaccination.core.repository.VaccinationRepository +import de.rki.coronawarnapp.vaccination.ui.homecard.CreateVaccinationHomeCard import io.mockk.MockKAnnotations import io.mockk.Runs import io.mockk.every @@ -325,6 +326,7 @@ class HomeFragmentTest : BaseUITest() { else -> add(tracingStateItem) } add(submissionTestResultItem) + add(CreateVaccinationHomeCard.Item {}) Statistics.statisticsData?.let { add(StatisticsHomeCard.Item(data = it, onHelpAction = { })) } diff --git a/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/vaccination/VaccinationConsentFragmentTest.kt b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/vaccination/VaccinationConsentFragmentTest.kt new file mode 100644 index 0000000000000000000000000000000000000000..10e7acdf14539cb7128ede16db3fabccef1a6e4d --- /dev/null +++ b/Corona-Warn-App/src/androidTest/java/de/rki/coronawarnapp/ui/vaccination/VaccinationConsentFragmentTest.kt @@ -0,0 +1,67 @@ +package de.rki.coronawarnapp.ui.vaccination + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import dagger.Module +import dagger.android.ContributesAndroidInjector +import de.rki.coronawarnapp.vaccination.ui.consent.VaccinationConsentFragment +import de.rki.coronawarnapp.vaccination.ui.consent.VaccinationConsentViewModel +import io.mockk.MockKAnnotations +import io.mockk.impl.annotations.MockK +import org.junit.After +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import testhelpers.BaseUITest +import testhelpers.Screenshot +import testhelpers.SystemUIDemoModeRule +import testhelpers.launchFragment2 +import testhelpers.launchFragmentInContainer2 +import testhelpers.takeScreenshot +import tools.fastlane.screengrab.locale.LocaleTestRule + +@RunWith(AndroidJUnit4::class) +class VaccinationConsentFragmentTest : BaseUITest() { + @Rule + @JvmField + val localeTestRule = LocaleTestRule() + + @get:Rule + val systemUIDemoModeRule = SystemUIDemoModeRule() + + @MockK lateinit var viewModel: VaccinationConsentViewModel + + @Before + fun setup() { + MockKAnnotations.init(this, relaxed = true) + + setupMockViewModel( + object : VaccinationConsentViewModel.Factory { + override fun create(): VaccinationConsentViewModel = viewModel + } + ) + } + + @After + fun teardown() { + clearAllViewModels() + } + + @Test + fun launch_fragment() { + launchFragment2<VaccinationConsentFragment>() + } + + @Screenshot + @Test + fun capture_screenshot() { + launchFragmentInContainer2<VaccinationConsentFragment>() + takeScreenshot<VaccinationConsentFragment>() + } +} + +@Module +abstract class VaccinationConsentFragmentTestModule { + @ContributesAndroidInjector + abstract fun vaccinationConsentFragment(): VaccinationConsentFragment +} diff --git a/Corona-Warn-App/src/androidTest/java/testhelpers/FragmentTestModuleRegistrar.kt b/Corona-Warn-App/src/androidTest/java/testhelpers/FragmentTestModuleRegistrar.kt index 038042a5810542131a3ebe6ccb8f898fb435a572..43cbbd1cc1639350586413ec1301b8f2ede903a7 100644 --- a/Corona-Warn-App/src/androidTest/java/testhelpers/FragmentTestModuleRegistrar.kt +++ b/Corona-Warn-App/src/androidTest/java/testhelpers/FragmentTestModuleRegistrar.kt @@ -36,6 +36,7 @@ import de.rki.coronawarnapp.ui.submission.SubmissionTestResultTestModule import de.rki.coronawarnapp.ui.submission.SubmissionTestResultTestNegativeModule import de.rki.coronawarnapp.ui.submission.SubmissionYourConsentFragmentTestModule import de.rki.coronawarnapp.ui.tracing.TracingDetailsFragmentTestTestModule +import de.rki.coronawarnapp.ui.vaccination.VaccinationConsentFragmentTestModule import de.rki.coronawarnapp.vaccination.ui.details.VaccinationDetailsFragmentTestModule @Module( @@ -83,8 +84,9 @@ import de.rki.coronawarnapp.vaccination.ui.details.VaccinationDetailsFragmentTes CreateEventTestModule::class, TraceLocationsFragmentTestModule::class, QrCodeDetailFragmentTestModule::class, - // Vaccination Passport + // Vaccination VaccinationDetailsFragmentTestModule::class, + VaccinationConsentFragmentTestModule::class, ] ) class FragmentTestModuleRegistrar