Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class ChannelListPage {
// The channel preview renders the failed state via MessageReadStatusIcon,
// unlike the message list, which uses its own failed icon
val deliveryStatusIsFailed: BySelector = By.res("Stream_MessageReadStatus_isError")
val unreadCountIndicator = By.res("Stream_UnreadCountIndicator")
val timestamp = By.res("Stream_Timestamp")
val typingIndicator = By.res("Stream_ChannelListTypingIndicator")
val mutedIcon = By.res("Stream_ChannelMutedIcon")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ class UserRobot {
return this
}

fun markMessageAsUnread(messageCellIndex: Int = 0): UserRobot {
openContextMenu(messageCellIndex)
ContextMenu.markAsUnread.waitToAppear().click()
return this
}

fun pinMessage(messageCellIndex: Int = 0): UserRobot {
openContextMenu(messageCellIndex)
ContextMenu.pin.waitToAppear().click()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,26 @@ import io.getstream.chat.android.e2e.test.uiautomator.waitToDisappear
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import io.getstream.chat.android.compose.R as ComposeR
import io.getstream.chat.android.ui.common.R as UiCommonR

fun UserRobot.assertChannelAvatar(): UserRobot {
assertTrue(Channel.avatar.isDisplayed())
return this
}

fun UserRobot.assertChannelUnreadCount(count: Int): UserRobot {
// The badge exposes only a content description; its text is cleared from the
// semantics tree by clearAndSetSemantics in UnreadCountIndicator.
val expectedDescription = appContext.resources.getQuantityString(
ComposeR.plurals.stream_compose_channel_item_unread,
count,
count,
)
assertTrue(By.desc(expectedDescription).waitDisplayed())
return this
}

fun UserRobot.assertChannelActionsSheetForGroupChannel(): UserRobot {
assertTrue(ChannelMenu.viewInfo.waitDisplayed())
assertTrue(ChannelMenu.leaveGroup.isDisplayed())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ class MessageDeliveryStatusTests : StreamTestCase() {
step("WHEN user replies to message in thread") {
userRobot.openThread().sendMessage(sampleText)
}
step("AND the thread reply is delivered") {
userRobot.assertMessageDeliveryStatus(MessageDeliveryStatus.SENT)
}
step("AND participant reads the user's thread reply") {
participantRobot.readMessage()
}
Expand Down Expand Up @@ -347,6 +350,9 @@ class MessageDeliveryStatusTests : StreamTestCase() {
step("AND user sends a new message") {
userRobot.sendMessage(sampleText)
}
step("AND the message is delivered") {
userRobot.assertMessageDeliveryStatus(MessageDeliveryStatus.SENT)
}
step("WHEN user returns to the channel list") {
userRobot.moveToChannelListFromMessageList()
}
Expand Down Expand Up @@ -469,6 +475,9 @@ class MessageDeliveryStatusTests : StreamTestCase() {
step("AND user sends a new message") {
userRobot.sendMessage(sampleText)
}
step("AND the message is delivered") {
userRobot.assertMessageDeliveryStatus(MessageDeliveryStatus.SENT)
}
step("AND participant reads the message") {
participantRobot.readMessage()
userRobot.assertMessageDeliveryStatus(MessageDeliveryStatus.READ)
Expand All @@ -491,6 +500,9 @@ class MessageDeliveryStatusTests : StreamTestCase() {
step("AND user replies to message in thread") {
userRobot.openThread().sendMessage(sampleText)
}
step("AND the thread reply is delivered") {
userRobot.assertMessageDeliveryStatus(MessageDeliveryStatus.SENT)
}
step("AND participant reads the thread reply") {
participantRobot.readMessage()
userRobot.assertMessageDeliveryStatus(MessageDeliveryStatus.READ)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@

package io.getstream.chat.android.compose.tests

import io.getstream.chat.android.compose.robots.assertChannelUnreadCount
import io.getstream.chat.android.compose.robots.assertMessage
import io.getstream.chat.android.compose.robots.assertMessageDeliveryStatus
import io.getstream.chat.android.compose.robots.assertScrollToFirstUnreadButton
import io.getstream.chat.android.compose.robots.assertUnreadSeparator
import io.getstream.chat.android.compose.sample.ui.InitTestActivity
import io.getstream.chat.android.e2e.test.mockserver.MessageDeliveryStatus
import io.qameta.allure.kotlin.Allure.step
import io.qameta.allure.kotlin.AllureId
import org.junit.Ignore
import org.junit.Test

class UnreadMessagesTests : StreamTestCase() {
Expand All @@ -30,19 +33,24 @@ class UnreadMessagesTests : StreamTestCase() {
private val sampleText = "Test"

@AllureId("11453")
@Ignore("https://linear.app/stream/issue/AND-1329")
@Test
fun test_unreadSeparatorIsShown_whenParticipantSendsMessagesWhileUserIsAway() {
val unreadCount = 2
step("GIVEN user opens the channel and sends the message") {
userRobot.login().openChannel().sendMessage(sampleText)
}
step("AND the message is delivered") {
userRobot.assertMessageDeliveryStatus(MessageDeliveryStatus.SENT)
}
step("AND user moves back to the channel list") {
userRobot.moveToChannelListFromMessageList()
}
step("WHEN participant sends new messages") {
participantRobot.sendMultipleMessages(text = "New", count = unreadCount)
}
step("AND the channel preview shows the unread count") {
userRobot.assertChannelUnreadCount(unreadCount)
}
step("AND user reopens the channel") {
userRobot.openChannel()
}
Expand All @@ -52,19 +60,24 @@ class UnreadMessagesTests : StreamTestCase() {
}

@AllureId("11454")
@Ignore("https://linear.app/stream/issue/AND-1329")
@Test
fun test_userScrollsToFirstUnreadMessage() {
val unreadCount = 25
step("GIVEN user opens the channel and sends the message") {
userRobot.login().openChannel().sendMessage(sampleText)
}
step("AND the message is delivered") {
userRobot.assertMessageDeliveryStatus(MessageDeliveryStatus.SENT)
}
step("AND user moves back to the channel list") {
userRobot.moveToChannelListFromMessageList()
}
step("AND participant sends new messages") {
participantRobot.sendMultipleMessages(text = "New", count = unreadCount)
}
step("AND the channel preview shows the unread count") {
userRobot.assertChannelUnreadCount(unreadCount)
}
step("WHEN user reopens the channel") {
userRobot.openChannel()
}
Expand All @@ -79,14 +92,41 @@ class UnreadMessagesTests : StreamTestCase() {
}
}

@AllureId("6073")
@Test
fun test_userMarksMessageAsUnread() {
val unreadCount = 2
step("GIVEN user opens the channel and sends the message") {
userRobot.login().openChannel().sendMessage(sampleText)
}
step("AND the message is delivered") {
userRobot.assertMessageDeliveryStatus(MessageDeliveryStatus.SENT)
}
step("AND participant sends messages") {
participantRobot.sendMultipleMessages(text = "New", count = unreadCount)
userRobot.assertMessage("New-$unreadCount")
}
step("WHEN user marks the first participant message as unread") {
userRobot.markMessageAsUnread(messageCellIndex = 1)
}
step("THEN the unread separator is shown with the unread count") {
userRobot.assertUnreadSeparator(unreadCount = unreadCount)
}
step("AND the channel preview shows the unread count") {
userRobot.moveToChannelListFromMessageList().assertChannelUnreadCount(unreadCount)
}
}

@AllureId("11455")
@Ignore("https://linear.app/stream/issue/AND-1329")
@Test
fun test_userDismissesTheUnreadIndicator() {
val unreadCount = 25
step("GIVEN user opens the channel and sends the message") {
userRobot.login().openChannel().sendMessage(sampleText)
}
step("AND the message is delivered") {
userRobot.assertMessageDeliveryStatus(MessageDeliveryStatus.SENT)
}
step("AND user moves back to the channel list") {
userRobot.moveToChannelListFromMessageList()
}
Expand Down
Loading