Created
August 28, 2021 15:35
-
-
Save rubenquadros/1941b642fe1dd52fe89291cb516b994d to your computer and use it in GitHub Desktop.
Game details test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GameDetailsTest { | |
@get:Rule val composeTestRule = createComposeRule() | |
@Test | |
fun game_details_should_be_shown() { | |
composeTestRule.setContent { | |
EpicWorldTheme { | |
GameDetails( | |
gameDetails = | |
FakeGamesData.getFakeGameDetails(), | |
openGameTrailer = {} | |
) | |
} | |
} | |
// Game image should be shown | |
composeTestRule | |
.onNodeWithContentDescription("Game Image") | |
.assertIsDisplayed() | |
// Trailer play button should be shown and clickable | |
composeTestRule | |
.onNodeWithContentDescription("Play Trailer") | |
.assertIsDisplayed() | |
.assertHasClickAction() | |
// Game title should be shown | |
composeTestRule | |
.onNodeWithText("Grand Theft Auto V") | |
.assertIsDisplayed() | |
// Game genres should be shown | |
composeTestRule | |
.onNodeWithText("Action Adventure") | |
.assertIsDisplayed() | |
// Game description should be shown | |
composeTestRule | |
.onNodeWithText("About") | |
.assertIsDisplayed() | |
composeTestRule | |
.onNodeWithText("Show More") | |
.assertIsDisplayed() | |
composeTestRule | |
.onNodeWithTag("Description") | |
.assertIsDisplayed() | |
// Game platforms should be shown | |
composeTestRule | |
.onNodeWithText("Platforms") | |
.assertIsDisplayed() | |
composeTestRule | |
.onNodeWithTag("Game Platforms") | |
.assertIsDisplayed() | |
// Scroll to desired view | |
composeTestRule | |
.onNodeWithText("Stores") | |
.performScrollTo() | |
composeTestRule | |
.onNodeWithTag("Game Stores") | |
.performScrollTo() | |
// Game stores should be shown | |
composeTestRule | |
.onNodeWithText("Stores") | |
.assertIsDisplayed() | |
composeTestRule | |
.onNodeWithTag("Game Stores") | |
.assertIsDisplayed() | |
// Scroll to desired view | |
composeTestRule | |
.onNodeWithText("Developer") | |
.performScrollTo() | |
composeTestRule | |
.onNodeWithText("Rockstar North") | |
.performScrollTo() | |
// Game developers should be shown | |
composeTestRule | |
.onNodeWithText("Developer") | |
.assertIsDisplayed() | |
composeTestRule | |
.onNodeWithText("Rockstar North") | |
.assertIsDisplayed() | |
// Scroll to desired view | |
composeTestRule | |
.onNodeWithText("Publisher") | |
.performScrollTo() | |
composeTestRule | |
.onNodeWithText("Rockstar Games") | |
.performScrollTo() | |
// Game publishers should be shown | |
composeTestRule | |
.onNodeWithText("Publisher") | |
.assertIsDisplayed() | |
composeTestRule | |
.onNodeWithText("Rockstar Games") | |
.assertIsDisplayed() | |
} | |
} | |
object FakeGamesData { | |
fun getFakeGameDetails(): GameDetailsEntity { | |
// provide fake game details data | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment