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

Apache License 2.0
61 stars 93 forks source link

Instrumental test #172

Open rbrthmn opened 7 months ago

rbrthmn commented 7 months ago

Since the default input for "Tip Percentage" is already "15", when the instrumental test is runned it inputs the value "20", combining the vale into "2015", resulting in the "Tip Amount"'s value being $201.50. To fix this, it is only necessary to to clear the input before input the new one, with the method performTextClearance() from composeTestRule.

composeTestRule.onNodeWithText("Bill Amount").performTextInput("10") composeTestRule.onNodeWithText("Tip Percentage").performTextClearance() composeTestRule.onNodeWithText("Tip Percentage").performTextInput("20")