Skip to content

Commit bbdc9f8

Browse files
authored
fixes failing tests (#470)
1 parent 1026ae4 commit bbdc9f8

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

toolkit/featureforms/src/androidTest/java/com/arcgismaps/toolkit/featureforms/GroupElementTests.kt

+12-4
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ import androidx.compose.ui.semantics.SemanticsProperties
2020
import androidx.compose.ui.state.ToggleableState
2121
import androidx.compose.ui.test.SemanticsNodeInteraction
2222
import androidx.compose.ui.test.assertIsDisplayed
23+
import androidx.compose.ui.test.assertIsSelected
2324
import androidx.compose.ui.test.assertTextContains
24-
import androidx.compose.ui.test.hasScrollAction
2525
import androidx.compose.ui.test.hasText
2626
import androidx.compose.ui.test.junit4.createComposeRule
2727
import androidx.compose.ui.test.onChildren
28+
import androidx.compose.ui.test.onNodeWithContentDescription
2829
import androidx.compose.ui.test.onNodeWithText
2930
import androidx.compose.ui.test.onParent
3031
import androidx.compose.ui.test.performClick
@@ -105,7 +106,7 @@ class GroupElementTests {
105106
val groupElementToTest =
106107
getGroupElementWithLabel("Group with children that are visible dependent")
107108
// find the scrollable container
108-
val lazyColumn = composeTestRule.onNode(hasScrollAction())
109+
val lazyColumn = composeTestRule.onNodeWithContentDescription("lazy column")
109110
// scroll until the group is visible
110111
lazyColumn.performScrollToNode(hasText(groupElementToTest.label))
111112
// find the group and check if displayed
@@ -115,8 +116,15 @@ class GroupElementTests {
115116
groupElement.assertTextContains(groupElementToTest.description)
116117
// assert only the header is visible and other field elements are not
117118
assert(groupElement.onParent().onChildren().fetchSemanticsNodes().count() == 1)
118-
// find and click on the radio button option
119-
composeTestRule.onNodeWithText("show invisible form element").performClick()
119+
// find the radio button option that enables the group element's children visibility
120+
val radioButtonLabel = "show invisible form element"
121+
val radioButton = composeTestRule.onNodeWithText(radioButtonLabel)
122+
// scroll to the radio button and click it
123+
lazyColumn.performScrollToNode(hasText(radioButtonLabel))
124+
radioButton.performClick()
125+
radioButton.assertIsSelected()
126+
// scroll back to the group element
127+
lazyColumn.performScrollToNode(hasText(groupElementToTest.label))
120128
// assert the and other field elements are visible
121129
assert(groupElement.onParent().onChildren().fetchSemanticsNodes().count() > 1)
122130
}

toolkit/featureforms/src/androidTest/java/com/arcgismaps/toolkit/featureforms/ThemingTests.kt

+3
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,11 @@ class ThemingTests {
135135
field.performTextInput("test")
136136
val text = composeTestRule.onNodeWithText("test", useUnmergedTree = true)
137137
text.assertIsDisplayed()
138+
// bring focus to the field
139+
field.performClick()
138140
// test focused text color
139141
text.assertTextColor(Color.Blue)
142+
// clear focus from the field
140143
field.performImeAction()
141144
// test unfocused text color
142145
text.assertTextColor(Color.Black)

0 commit comments

Comments
 (0)