https://kotlinlang.org logo
#compose
Title
# compose
k

Kevin Worth

08/02/2022, 6:08 PM
Compose testing - views/recycling pagers - where each page has the same basic views but different content. I assume it's bad practice to use the Ids of semantics nodes to - for instance - assert that something that was displayed is no longer displayed... Or is it generally safe to use the Ids? Example: 1. Screen A has Title(
Text
with
testTag == "title"
) and Image (object with
stateDescription == "foo"
) 2. Swipe left to go to Screen B 3. Screen B has Title(
Text
with
testTag == "title"
) and Image (object with
stateDescription == "foo"
) So, how might one ensure that the swipe was successful (and finished)? How can we be confident we are seeing a new screen and we aren't accidentally still on Screen A? Note: We don't want to hardcode things such as "swiping from A to B means you first see 'Title A' and then you see 'Title B'", because we have many variants and many pages (not feasible to program everything through to "swiping from variantQ screen G takes you to variantQ screen H"). We just want to make sure that the user is able to swipe through all the pages (App Intro Slides) and then get to the app's home screen/activity at the end. We've found it's feasible to capture the node id of either the Title or the Image and then make sure we don't get the same node Id after the swipe...but it feels like the type of thing that would likely be discouraged. Any suggestions? Thanks for your time.
5 Views