Last active
May 2, 2022 13:00
-
-
Save igorescodro/31ce370f47ac3309995ae4131285e0d6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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_markAsReadViaNotificationActions() { | |
// Send the notification | |
val id = 99 | |
val name = "New message received from Bruno" | |
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 in the "Mark as read" action button | |
manager.activeNotifications.first().notification.actions[0].actionIntent.send() | |
// Validate the message is mark as read | |
Assert.assertTrue(messageRepository.getLatestMessage(id = id).isRead()) | |
// Validate the notification was dismissed | |
Assert.assertTrue(manager.activeNotifications.isEmpty()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment