diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/BitwardenSelectionDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/BitwardenSelectionDialog.kt index 677e2425a..2115d16e5 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/BitwardenSelectionDialog.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/BitwardenSelectionDialog.kt @@ -15,9 +15,12 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment +import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.res.stringResource +import androidx.compose.ui.semantics.semantics +import androidx.compose.ui.semantics.testTagsAsResourceId import androidx.compose.ui.unit.dp import androidx.compose.ui.window.Dialog import com.x8bit.bitwarden.R @@ -32,6 +35,7 @@ import com.x8bit.bitwarden.ui.platform.components.util.maxDialogHeight * [BitwardenSelectionRow]. */ @Suppress("LongMethod") +@OptIn(ExperimentalComposeUiApi::class) @Composable fun BitwardenSelectionDialog( title: String, @@ -45,6 +49,7 @@ fun BitwardenSelectionDialog( val scrollState = rememberScrollState() Column( modifier = Modifier + .semantics { testTagsAsResourceId = true } .requiredHeightIn( max = configuration.maxDialogHeight, ) diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/search/SearchScreenTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/search/SearchScreenTest.kt index 1b16e1391..ed4ad5cfd 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/search/SearchScreenTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/search/SearchScreenTest.kt @@ -9,7 +9,6 @@ import androidx.compose.ui.test.hasScrollToNodeAction import androidx.compose.ui.test.hasText import androidx.compose.ui.test.isDialog import androidx.compose.ui.test.onAllNodesWithText -import androidx.compose.ui.test.onChildren import androidx.compose.ui.test.onNodeWithContentDescription import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.performClick @@ -492,9 +491,8 @@ class SearchScreenTest : BaseComposeTest() { .performClick() composeTestRule - .onNode(isDialog()) - .onChildren() - .filterToOne(hasText("mockName-$number")) + .onAllNodesWithText("mockName-$number") + .filterToOne(hasAnyAncestor(isDialog())) .assertIsDisplayed() } @@ -703,9 +701,8 @@ class SearchScreenTest : BaseComposeTest() { .performClick() composeTestRule - .onNode(isDialog()) - .onChildren() - .filterToOne(hasText("mockName-$number")) + .onAllNodesWithText("mockName-$number") + .filterToOne(hasAnyAncestor(isDialog())) .assertIsDisplayed() } diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/tools/feature/send/SendScreenTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/tools/feature/send/SendScreenTest.kt index 51504524e..1ab4f92fb 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/tools/feature/send/SendScreenTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/tools/feature/send/SendScreenTest.kt @@ -12,7 +12,6 @@ import androidx.compose.ui.test.isDialog import androidx.compose.ui.test.isDisplayed import androidx.compose.ui.test.isPopup import androidx.compose.ui.test.onAllNodesWithText -import androidx.compose.ui.test.onChildren import androidx.compose.ui.test.onNodeWithContentDescription import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.performClick @@ -444,9 +443,8 @@ class SendScreenTest : BaseComposeTest() { .performClick() composeTestRule - .onNode(isDialog()) - .onChildren() - .filterToOne(hasText(DEFAULT_SEND_ITEM.name)) + .onAllNodesWithText(DEFAULT_SEND_ITEM.name) + .filterToOne(hasAnyAncestor(isDialog())) .assertIsDisplayed() } diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting/VaultItemListingScreenTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting/VaultItemListingScreenTest.kt index e442239b8..565a164b6 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting/VaultItemListingScreenTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting/VaultItemListingScreenTest.kt @@ -12,7 +12,6 @@ import androidx.compose.ui.test.isDialog import androidx.compose.ui.test.isDisplayed import androidx.compose.ui.test.isPopup import androidx.compose.ui.test.onAllNodesWithText -import androidx.compose.ui.test.onChildren import androidx.compose.ui.test.onNodeWithContentDescription import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.performClick @@ -985,9 +984,8 @@ class VaultItemListingScreenTest : BaseComposeTest() { .performClick() composeTestRule - .onNode(isDialog()) - .onChildren() - .filterToOne(hasText("mockTitle-$number")) + .onAllNodesWithText("mockTitle-$number") + .filterToOne(hasAnyAncestor(isDialog())) .assertIsDisplayed() }