mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
BIT-1599: Add test tags as resources for selection dialogs (#1081)
This commit is contained in:
parent
3eabdbf8b6
commit
cfc6dff1d7
4 changed files with 13 additions and 15 deletions
|
@ -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,
|
||||
)
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue