Add test on RoomDetailsView
This commit is contained in:
parent
69e66d9101
commit
aa1e214e46
2 changed files with 32 additions and 1 deletions
|
|
@ -223,7 +223,7 @@ private fun RoomDetailsTopBar(
|
||||||
actions = {
|
actions = {
|
||||||
if (showEdit) {
|
if (showEdit) {
|
||||||
IconButton(onClick = { showMenu = !showMenu }) {
|
IconButton(onClick = { showMenu = !showMenu }) {
|
||||||
Icon(Icons.Default.MoreVert, "")
|
Icon(Icons.Default.MoreVert, stringResource(id = CommonStrings.a11y_user_menu))
|
||||||
}
|
}
|
||||||
DropdownMenu(
|
DropdownMenu(
|
||||||
expanded = showMenu,
|
expanded = showMenu,
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ package io.element.android.features.roomdetails.impl
|
||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
import androidx.compose.ui.test.junit4.AndroidComposeTestRule
|
import androidx.compose.ui.test.junit4.AndroidComposeTestRule
|
||||||
import androidx.compose.ui.test.junit4.createAndroidComposeRule
|
import androidx.compose.ui.test.junit4.createAndroidComposeRule
|
||||||
|
import androidx.compose.ui.test.onNodeWithContentDescription
|
||||||
import androidx.compose.ui.test.onNodeWithTag
|
import androidx.compose.ui.test.onNodeWithTag
|
||||||
import androidx.compose.ui.test.performClick
|
import androidx.compose.ui.test.performClick
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
|
|
@ -126,6 +127,36 @@ class RoomDetailsViewTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `click on add topic emit expected event`() {
|
||||||
|
ensureCalledOnceWithParam<RoomDetailsAction>(RoomDetailsAction.AddTopic) { callback ->
|
||||||
|
rule.setRoomDetailView(
|
||||||
|
state = aRoomDetailsState(
|
||||||
|
eventSink = EventsRecorder(expectEvents = false),
|
||||||
|
roomTopic = RoomTopicState.CanAddTopic,
|
||||||
|
),
|
||||||
|
onActionClicked = callback,
|
||||||
|
)
|
||||||
|
rule.clickOn(R.string.screen_room_details_add_topic_title)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `click on menu edit emit expected event`() {
|
||||||
|
ensureCalledOnceWithParam<RoomDetailsAction>(RoomDetailsAction.Edit) { callback ->
|
||||||
|
rule.setRoomDetailView(
|
||||||
|
state = aRoomDetailsState(
|
||||||
|
eventSink = EventsRecorder(expectEvents = false),
|
||||||
|
canEdit = true,
|
||||||
|
),
|
||||||
|
onActionClicked = callback,
|
||||||
|
)
|
||||||
|
val menuContentDescription = rule.activity.getString(CommonStrings.a11y_user_menu)
|
||||||
|
rule.onNodeWithContentDescription(menuContentDescription).performClick()
|
||||||
|
rule.clickOn(CommonStrings.action_edit)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `click on avatar test`() {
|
fun `click on avatar test`() {
|
||||||
val eventsRecorder = EventsRecorder<RoomDetailsEvent>(expectEvents = false)
|
val eventsRecorder = EventsRecorder<RoomDetailsEvent>(expectEvents = false)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue