I practice writing ui tests. Now for practice, I decided to write tests for HorizontalPagerIndicator
(accompanist).
As you can see inside the HorizontalPagerIndicator
is drawn n
boxes (https://github.com/google/accompanist/blob/main/pager-indicators/src/main/java/com/google/accompanist/pager/PagerIndicator.kt).
First of all, in my test I would like to check that the number of shapes in the HorizontalPagerIndicator
is equal to the number of pages.
I tried the following to see the Semantic tree of a compose node:
onRoot(useUnmergedTree = true).printToLog("TEST_TAG")
And I found that the indicator node does not have any child. So I can't access the ones created inside the indicator boxes and check their number.
I would also like to check that when the pager page changes, the position of the indicator also changes.I don't have any ideas for implementing such a check. Please help me solve this problem. Perhaps I do not understand how to test this component at all.