mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 01:19:33 +00:00
Add test on MessagesViewTest: clicking on more reaction from action list emits the expected Event.
This commit is contained in:
committed by
Benoit Marty
parent
6a8192d2d1
commit
64435db282
+27
@@ -399,6 +399,33 @@ class MessagesViewTest {
|
|||||||
rule.onAllNodesWithContentDescription(moreReactionContentDescription).onFirst().performClick()
|
rule.onAllNodesWithContentDescription(moreReactionContentDescription).onFirst().performClick()
|
||||||
eventsRecorder.assertSingle(CustomReactionEvents.ShowCustomReactionSheet(timelineItem))
|
eventsRecorder.assertSingle(CustomReactionEvents.ShowCustomReactionSheet(timelineItem))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `clicking on more reaction from action list emits the expected Event`() {
|
||||||
|
val eventsRecorder = EventsRecorder<CustomReactionEvents>()
|
||||||
|
val state = aMessagesState()
|
||||||
|
val timelineItem = state.timelineState.timelineItems.first() as TimelineItem.Event
|
||||||
|
val stateWithActionListState = state.copy(
|
||||||
|
actionListState = anActionListState(
|
||||||
|
target = ActionListState.Target.Success(
|
||||||
|
event = timelineItem,
|
||||||
|
displayEmojiReactions = true,
|
||||||
|
actions = persistentListOf(TimelineItemAction.Edit),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
customReactionState = aCustomReactionState(
|
||||||
|
eventSink = eventsRecorder
|
||||||
|
),
|
||||||
|
)
|
||||||
|
rule.setMessagesView(
|
||||||
|
state = stateWithActionListState,
|
||||||
|
)
|
||||||
|
val moreReactionContentDescription = rule.activity.getString(CommonStrings.a11y_react_with_other_emojis)
|
||||||
|
rule.onNodeWithContentDescription(moreReactionContentDescription).performClick()
|
||||||
|
// Give time for the close animation to complete
|
||||||
|
rule.mainClock.advanceTimeBy(milliseconds = 1_000)
|
||||||
|
eventsRecorder.assertSingle(CustomReactionEvents.ShowCustomReactionSheet(timelineItem))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setMessagesView(
|
private fun <R : TestRule> AndroidComposeTestRule<R, ComponentActivity>.setMessagesView(
|
||||||
|
|||||||
Reference in New Issue
Block a user