I'm implementing some instrumented tests using the Jetpack Compose testing library. I'm not too familiar with Kotlin / Android development yet, but I have years of experience with Selenium and other testing libraries, so I'm missing some basic things and have no idea how to implement them.
What I want to do:
- Iterate over an element (node) list. I have this list an all items are identified by the same test tag "item". I need to click on each one of these items.
On Selenium I can easily do that:
elements = driver.find_elements("item")
elements.each do |element|
element.click
end
But on Kotlin with the Composing Testing Framework I have no clue how to do that. The method below (responsible for returning a list of nodes) doesn't support forEach
:
composeTestRule.onAllNodes(hasTestTag("item")
- I also want to retrieve the list size.
On Selenium the method below returns the qty of items found:
driver.find_elements("item").size
But, again, there's nothing like that available with composing:
composeTestRule.onAllNodes(hasTestTag("item")
I've already read the official JetPack Compose Testing Tutorial, but it doesn't provide much details