google-developer-training / basic-android-kotlin-compose-training-tip-calculator

Apache License 2.0
61 stars 97 forks source link

Write automated tests: Android Basics with Compose #205

Open JuDCraide opened 6 months ago

JuDCraide commented 6 months ago

composeTestRule.onNodeWithText("Tip Percentage").performTextInput("20") This line didn`t work on my test Android UI Test, because I had a default value for Tip Percentage of 15, so instead of writing 20, it appended 20 the front of the TextField.

So to fix this search and found out I could use: composeTestRule.onNodeWithText("Tip Percentage").performTextReplacement("20") I believe this would be a better alternative to be used/teached on this codeLab, since from what I tested it works both on empty or existing default input string value. And I believe it's use case is more general, so it would be good to learn on the basic course. Thanks