PR#128 Fix Compose UI sync issue

Sometimes the emptyPasswordShowsProperErrorMessage failed because while waiting for Idling Resources/Coroutines to run the clock has been updated and the Snackbar got dismissed.
autoAdvance=off, waitForIdle, autoAdvance=on pattern ensures this doesnt happen
This commit is contained in:
Gergely Hegedus 2022-09-29 14:59:37 +03:00
parent 6a0bb381a8
commit e3720ff3f6
2 changed files with 12 additions and 0 deletions

View file

@ -83,6 +83,9 @@ class AuthComposeInstrumentedTest : KoinTest {
robot.setUsername("banan")
.assertUsername("banan")
.clickOnLogin()
composeTestRule.mainClock.autoAdvance = false
composeTestRule.waitForIdle()
composeTestRule.mainClock.autoAdvance = true
robot.assertErrorIsShown(R.string.password_is_invalid)
.assertNotLoading()
@ -99,6 +102,9 @@ class AuthComposeInstrumentedTest : KoinTest {
.setPassword("banan")
.assertPassword("banan")
.clickOnLogin()
composeTestRule.mainClock.autoAdvance = false
composeTestRule.waitForIdle()
composeTestRule.mainClock.autoAdvance = true
robot.assertErrorIsShown(R.string.username_is_invalid)
.assertNotLoading()

View file

@ -99,6 +99,9 @@ class AuthComposeInstrumentedTest {
robot.setUsername("banan")
.assertUsername("banan")
.clickOnLogin()
composeTestRule.mainClock.autoAdvance = false
composeTestRule.waitForIdle()
composeTestRule.mainClock.autoAdvance = true
robot.assertErrorIsShown(R.string.password_is_invalid)
.assertNotLoading()
@ -115,6 +118,9 @@ class AuthComposeInstrumentedTest {
.setPassword("banan")
.assertPassword("banan")
.clickOnLogin()
composeTestRule.mainClock.autoAdvance = false
composeTestRule.waitForIdle()
composeTestRule.mainClock.autoAdvance = true
robot.assertErrorIsShown(R.string.username_is_invalid)
.assertNotLoading()