Skip to content

Instantly share code, notes, and snippets.

@rubenquadros
Created September 4, 2021 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubenquadros/86898791d78e3b90b9dc8b8cab8e09c7 to your computer and use it in GitHub Desktop.
Save rubenquadros/86898791d78e3b90b9dc8b8cab8e09c7 to your computer and use it in GitHub Desktop.
Testing game videos screen
class GameVideoTest() {
@get:Rule val composeTestRule = createComposeRule()
@Test
fun vide_player_and_playlist_show_be_shown() {
composeTestRule.setContent {
ShowGameVideos(
gameVideos =
FakeGamesData.getFakeGameVideos()
)
}
// Video player should be shown
composeTestRule
.onNodeWithTag("VideoPlayer")
.assertIsDisplayed()
// Thubnail of video should be shown in playlist
composeTestRule
.onAllNodesWithContentDescription("Thumbnail")
.assertCountEquals(3)
// Play button should be shown for currently playing video in playlist
composeTestRule
.onNodeWithContentDescription("Playing")
.assertIsDisplayed()
// Now playing should be shown for currently playing video in playlist
composeTestRule
.onNodeWithText("Now Playing")
.assertIsDisplayed()
}
}
object FakeGamesData {
fun getFakeGameVideos(): GameVideosEntity {
// provide fake data
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment