Created
April 29, 2022 17:20
-
-
Save igorescodro/307f927b32ec649b1253449bc33df0ad to your computer and use it in GitHub Desktop.
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
@Test | |
fun test_whenNotificationIsClickedOpensDetails() { | |
// Send the notification | |
val id = 13 | |
val name = "New reward!" | |
myNotification.send(id = id, name = name) | |
val manager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager | |
// Wait until the active notification list has a new one | |
composeTestRule.waitUntil { manager.activeNotifications.isNotEmpty() } | |
// Run the PendingIntent related to notification content | |
manager.activeNotifications.first().notification.contentIntent.send() | |
// Validate the screen is shown | |
composeTestRule.onNodeWithText("My screen title").assertIsDisplayed() | |
composeTestRule.onNodeWithText(name).assertIsDisplayed() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment