Skip to content

Commit

Permalink
added a scroll screenshot test.
Browse files Browse the repository at this point in the history
  • Loading branch information
takathemax committed Aug 17, 2023
1 parent f70c59d commit 1f1dd7e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package io.github.droidkaigi.confsched2023.testing.robot

import androidx.compose.ui.test.hasTestTag
import androidx.compose.ui.test.isRoot
import androidx.compose.ui.test.junit4.AndroidComposeTestRule
import androidx.compose.ui.test.performTouchInput
import androidx.compose.ui.test.swipeUp
import com.github.takahirom.roborazzi.captureRoboImage
import io.github.droidkaigi.confsched2023.designsystem.theme.KaigiTheme
import io.github.droidkaigi.confsched2023.sponsors.SponsorsScreen
import io.github.droidkaigi.confsched2023.sponsors.SponsorsScreenTestTag
import io.github.droidkaigi.confsched2023.testing.RobotTestRule
import io.github.droidkaigi.confsched2023.testing.coroutines.runTestWithLogging
import kotlinx.coroutines.test.TestDispatcher
Expand Down Expand Up @@ -37,6 +41,17 @@ class SponsorsScreenRobot @Inject constructor(
waitUntilIdle()
}

fun scrollSponsorScreen() {
composeTestRule
.onNode(hasTestTag(SponsorsScreenTestTag))
.performTouchInput {
swipeUp(
startY = visibleSize.height * 3F / 4,
endY = visibleSize.height / 3F,
)
}
}

fun checkScreenCapture() {
composeTestRule
.onNode(isRoot())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,16 @@ class SponsorsScreenTest {
checkScreenCapture()
}
}

@Test
@Category(ScreenshotTests::class)
fun checkScrollShot() {
sponsorsScreenRobot {
setupScreenContent()
scrollSponsorScreen()
checkScreenCapture()
scrollSponsorScreen()
checkScreenCapture()
}
}
}

0 comments on commit 1f1dd7e

Please sign in to comment.