Created
December 29, 2023 14:37
-
-
Save ngallazzi/758ed053020c97056f10ea2959dcb573 to your computer and use it in GitHub Desktop.
compose tests asserts
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 MyLayoutTest { | |
@get:Rule | |
val composeTestRule = createAndroidComposeRule<ComponentActivity>() | |
@Test | |
fun testGreetingButtonExists() { | |
// Start the app | |
composeTestRule.setContent { | |
MyLayout() | |
} | |
// Asserts that a node with content description "Greeting Button" exists | |
composeTestRule.onNodeWithContentDescription( | |
"Greeting Button" | |
).assertExists() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment