Skip to content

Commit

Permalink
Stabilize UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Iliyan Germanov committed Nov 24, 2021
1 parent d1ed9a9 commit e1282b7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,30 @@ import androidx.compose.ui.test.junit4.AndroidComposeTestRule
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.test.ext.junit.rules.ActivityScenarioRule
import com.ivy.wallet.compose.clickWithRetry

class MainBottomBar<A : ComponentActivity>(
private val composeTestRule: AndroidComposeTestRule<ActivityScenarioRule<A>, A>
) {
fun clickHome() {
composeTestRule.onNode(hasTestTag("home"))
.performClick()
composeTestRule.clickWithRetry(
node = composeTestRule.onNode(hasTestTag("home")),
maxRetries = 3
)
}

fun clickAccounts() {
composeTestRule.onNode(hasTestTag("accounts"))
.performClick()
composeTestRule.clickWithRetry(
node = composeTestRule.onNode(hasTestTag("accounts")),
maxRetries = 3
)
}

fun clickAddFAB() {
composeTestRule.onNode(hasTestTag("fab_add"))
.performClick()
composeTestRule.clickWithRetry(
node = composeTestRule.onNode(hasTestTag("fab_add")),
maxRetries = 3
)
}

fun clickAddIncome() {
Expand Down
9 changes: 9 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
plugins {
`kotlin-dsl`
id("org.gradle.test-retry") version "1.2.0"
}

repositories {
mavenCentral()
}

tasks.test {
retry {
maxRetries.set(2)
maxFailures.set(10)
failOnPassedAfterRetry.set(false)
}
}

0 comments on commit e1282b7

Please sign in to comment.