From 00a00ecbe483ca8c569ae53164369d5c2f800492 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 10 Jul 2025 11:40:38 +0200 Subject: [PATCH] Fix test --- .../changeroles/ChangeRolesViewTest.kt | 14 ++++++++++---- .../libraries/matrix/ui/components/SelectedUser.kt | 3 ++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/features/roomdetails/impl/src/test/kotlin/io/element/android/features/roomdetails/impl/rolesandpermissions/changeroles/ChangeRolesViewTest.kt b/features/roomdetails/impl/src/test/kotlin/io/element/android/features/roomdetails/impl/rolesandpermissions/changeroles/ChangeRolesViewTest.kt index 4bb0253e6a..6f2179d4d4 100644 --- a/features/roomdetails/impl/src/test/kotlin/io/element/android/features/roomdetails/impl/rolesandpermissions/changeroles/ChangeRolesViewTest.kt +++ b/features/roomdetails/impl/src/test/kotlin/io/element/android/features/roomdetails/impl/rolesandpermissions/changeroles/ChangeRolesViewTest.kt @@ -225,7 +225,10 @@ class ChangeRolesViewTest { ) // Unselect the user from the row list val contentDescription = rule.activity.getString(CommonStrings.action_remove) - rule.onNodeWithContentDescription(contentDescription).performClick() + rule.onNodeWithContentDescription( + label = contentDescription, + useUnmergedTree = true, + ).performClick() eventsRecorder.assertList( listOf( ChangeRolesEvent.QueryChanged(""), @@ -248,7 +251,7 @@ class ChangeRolesViewTest { rule.setChangeRolesContent( state = state, ) - // Select the user from the row list + // Select the user from the user list rule.onNodeWithText("Carol").performClick() eventsRecorder.assertList( listOf( @@ -271,8 +274,11 @@ class ChangeRolesViewTest { rule.setChangeRolesContent( state = state, ) - // Select the user from the rom list - rule.onAllNodesWithText("Bob")[1].performClick() + // Unselect the user from the user list + rule.onAllNodesWithText( + text = "Bob", + useUnmergedTree = true, + )[1].performClick() eventsRecorder.assertList( listOf( ChangeRolesEvent.QueryChanged(""), diff --git a/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/components/SelectedUser.kt b/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/components/SelectedUser.kt index cfd378d23c..f3c3c634e6 100644 --- a/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/components/SelectedUser.kt +++ b/libraries/matrixui/src/main/kotlin/io/element/android/libraries/matrix/ui/components/SelectedUser.kt @@ -101,7 +101,8 @@ fun SelectedUser( ) { Icon( imageVector = CompoundIcons.Close(), - contentDescription = null, + // Note: keep the context description for the test + contentDescription = stringResource(id = CommonStrings.action_remove), tint = ElementTheme.colors.iconOnSolidPrimary, modifier = Modifier.padding(2.dp) )