Skip to content

Instantly share code, notes, and snippets.

@rubenquadros
Created September 4, 2021 18:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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