Skip to content

Commit

Permalink
Optimize UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Iliyan Germanov committed Nov 24, 2021
1 parent e1282b7 commit cf2c3f7
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,16 @@ fun ComposeTestRule.waitMillis(waitMs: Long) {
fun ComposeTestRule.clickWithRetry(
node: SemanticsNodeInteraction,
retryAttempt: Int = 0,
maxRetries: Int = 5,
waitBetweenRetriesMs: Long = 300,
maxRetries: Int = 15,
waitBetweenRetriesMs: Long = 100,
) {
try {
waitForIdle()
node
.assertExists()
node.assertExists()
.performClick()
} catch (e: AssertionError) {
waitMillis(waitBetweenRetriesMs)

if (retryAttempt < maxRetries) {
waitMillis(waitBetweenRetriesMs)

clickWithRetry(
node = node,
retryAttempt = retryAttempt + 1,
Expand Down

0 comments on commit cf2c3f7

Please sign in to comment.