diff --git a/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/robot/AboutScreenRobot.kt b/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/robot/AboutScreenRobot.kt index 42ba98740..1d731ef02 100644 --- a/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/robot/AboutScreenRobot.kt +++ b/core/testing/src/main/java/io/github/droidkaigi/confsched/testing/robot/AboutScreenRobot.kt @@ -2,10 +2,22 @@ package io.github.droidkaigi.confsched.testing.robot import androidx.compose.ui.test.assertIsDisplayed import androidx.compose.ui.test.hasTestTag +import androidx.compose.ui.test.onRoot +import androidx.compose.ui.test.performScrollToNode +import androidx.compose.ui.test.performTouchInput +import androidx.compose.ui.test.swipeUp import io.github.droidkaigi.confsched.about.AboutScreen +import io.github.droidkaigi.confsched.about.AboutScreenLazyColumnTestTag +import io.github.droidkaigi.confsched.about.section.AboutCreditsContributorsItemTestTag +import io.github.droidkaigi.confsched.about.section.AboutCreditsSponsorsItemTestTag +import io.github.droidkaigi.confsched.about.section.AboutCreditsStaffItemTestTag import io.github.droidkaigi.confsched.about.section.AboutCreditsTitleTestTag import io.github.droidkaigi.confsched.about.section.AboutDetailTestTag import io.github.droidkaigi.confsched.about.section.AboutFooterLinksTestTag +import io.github.droidkaigi.confsched.about.section.AboutOthersCodeOfConductItemTestTag +import io.github.droidkaigi.confsched.about.section.AboutOthersLicenseItemTestTag +import io.github.droidkaigi.confsched.about.section.AboutOthersPrivacyPolicyItemTestTag +import io.github.droidkaigi.confsched.about.section.AboutOthersSettingsItemTestTag import io.github.droidkaigi.confsched.about.section.AboutOthersTitleTestTag import io.github.droidkaigi.confsched.designsystem.theme.KaigiTheme import javax.inject.Inject @@ -24,6 +36,24 @@ class AboutScreenRobot @Inject constructor( waitUntilIdle() } + fun scrollToCreditsSection() { + composeTestRule + .onNode(hasTestTag(AboutScreenLazyColumnTestTag)) + .performScrollToNode(hasTestTag(AboutCreditsStaffItemTestTag)) + + composeTestRule.onRoot().performTouchInput { + swipeUp(startY = centerY, endY = centerY - 200) + } + waitUntilIdle() + } + + fun scrollToOthersSection() { + composeTestRule + .onNode(hasTestTag(AboutScreenLazyColumnTestTag)) + .performScrollToNode(hasTestTag(AboutOthersTitleTestTag)) + waitUntilIdle() + } + fun checkDetailSectionDisplayed() { composeTestRule .onNode(hasTestTag(AboutDetailTestTag)) @@ -36,12 +66,52 @@ class AboutScreenRobot @Inject constructor( .assertIsDisplayed() } + fun checkCreditsSectionContentsDisplayed() { + composeTestRule + .onNode(hasTestTag(AboutCreditsContributorsItemTestTag)) + .assertExists() + .assertIsDisplayed() + + composeTestRule + .onNode(hasTestTag(AboutCreditsStaffItemTestTag)) + .assertExists() + .assertIsDisplayed() + + composeTestRule + .onNode(hasTestTag(AboutCreditsSponsorsItemTestTag)) + .assertExists() + .assertIsDisplayed() + } + fun checkOthersSectionTitleDisplayed() { composeTestRule .onNode(hasTestTag(AboutOthersTitleTestTag)) .assertIsDisplayed() } + fun checkOthersSectionContentsDisplayed() { + composeTestRule + .onNode(hasTestTag(AboutOthersCodeOfConductItemTestTag)) + .assertExists() + .assertIsDisplayed() + + composeTestRule + .onNode(hasTestTag(AboutOthersLicenseItemTestTag)) + .assertExists() + .assertIsDisplayed() + + composeTestRule + .onNode(hasTestTag(AboutOthersPrivacyPolicyItemTestTag)) + .assertExists() + .assertIsDisplayed() + + composeTestRule + .onNode(hasTestTag(AboutOthersSettingsItemTestTag)) + .assertExists() + .assertIsDisplayed() + } + + // TODO https://github.com/DroidKaigi/conference-app-2024/issues/670 fun checkFooterLinksSectionDisplayed() { composeTestRule .onNode(hasTestTag(AboutFooterLinksTestTag)) diff --git a/feature/about/src/androidUnitTest/kotlin/io/github/droidkaigi/confsched/about/AboutScreenTest.kt b/feature/about/src/androidUnitTest/kotlin/io/github/droidkaigi/confsched/about/AboutScreenTest.kt index 132621976..9fcad9083 100644 --- a/feature/about/src/androidUnitTest/kotlin/io/github/droidkaigi/confsched/about/AboutScreenTest.kt +++ b/feature/about/src/androidUnitTest/kotlin/io/github/droidkaigi/confsched/about/AboutScreenTest.kt @@ -48,6 +48,29 @@ class AboutScreenTest( checkDetailSectionDisplayed() } } + describe("when scroll to credits section") { + doIt { + scrollToCreditsSection() + } + itShould("show credits contents") { + captureScreenWithChecks { + checkCreditsSectionTitleDisplayed() + checkCreditsSectionContentsDisplayed() + } + } + } + describe("when scroll to others section") { + doIt { + scrollToOthersSection() + } + itShould("show others contents") { + captureScreenWithChecks { + checkOthersSectionTitleDisplayed() + checkOthersSectionContentsDisplayed() + } + } + } + // TODO https://github.com/DroidKaigi/conference-app-2024/issues/670 } } } diff --git a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/AboutScreen.kt b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/AboutScreen.kt index 222e673de..0a59750e6 100644 --- a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/AboutScreen.kt +++ b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/AboutScreen.kt @@ -33,6 +33,8 @@ import org.jetbrains.compose.resources.stringResource const val aboutScreenRoute = "about" +const val AboutScreenLazyColumnTestTag = "AboutScreenLazyColumnTestTag" + object AboutScreenTestTag { const val Screen = "AboutScreen" } @@ -93,7 +95,9 @@ fun AboutScreen( ), ) { padding -> LazyColumn( - Modifier.nestedScroll(scrollBehavior.nestedScrollConnection), + Modifier + .nestedScroll(scrollBehavior.nestedScrollConnection) + .testTag(AboutScreenLazyColumnTestTag), contentPadding = padding, state = lazyListState, ) { diff --git a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutOthers.kt b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutOthers.kt index 458f46ba3..c7da061f5 100644 --- a/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutOthers.kt +++ b/feature/about/src/commonMain/kotlin/io/github/droidkaigi/confsched/about/section/AboutOthers.kt @@ -30,6 +30,7 @@ const val AboutOthersTitleTestTag = "AboutOthersTitleTestTag" const val AboutOthersCodeOfConductItemTestTag = "AboutOthersCodeOfConductItemTestTag" const val AboutOthersLicenseItemTestTag = "AboutOthersLicenseItemTestTag" const val AboutOthersPrivacyPolicyItemTestTag = "AboutOthersPrivacyPolicyItemTestTag" +const val AboutOthersSettingsItemTestTag = "AboutOthersSettingsItemTestTag" fun LazyListScope.aboutOthers( modifier: Modifier = Modifier, @@ -92,7 +93,7 @@ fun LazyListScope.aboutOthers( leadingIcon = Outlined.Settings, label = stringResource(AboutRes.string.settings), onClickAction = onSettingsItemClick, - testTag = "TODO", + testTag = AboutOthersSettingsItemTestTag, modifier = modifier .padding( horizontal = 16.dp,