Fix backup/restore instrumentation tests

This commit is contained in:
Torsten Grote 2024-05-31 09:53:22 -03:00
parent 88619b94c1
commit f408381d18
No known key found for this signature in database
GPG key ID: 3E5F77D92CF891FF
2 changed files with 17 additions and 0 deletions

View file

@ -72,6 +72,10 @@ internal interface LargeRestoreTestBase : LargeTestBase {
backupListItem.clickAndWaitForNewWindow() backupListItem.clickAndWaitForNewWindow()
waitUntilIdle() waitUntilIdle()
waitForAppSelectionLoaded()
// just tap next in app selection
appsSelectedButton.clickAndWaitForNewWindow()
waitForInstallResult() waitForInstallResult()
if (someAppsNotInstalledText.exists()) { if (someAppsNotInstalledText.exists()) {
@ -104,6 +108,17 @@ internal interface LargeRestoreTestBase : LargeTestBase {
spyOnKVRestoreData(result) spyOnKVRestoreData(result)
} }
private fun waitForAppSelectionLoaded() = runBlocking {
withContext(Dispatchers.Main) {
withTimeout(RESTORE_TIMEOUT) {
while (spyRestoreViewModel.selectedApps.value?.apps?.isNotEmpty() != true) {
delay(100)
}
}
}
waitUntilIdle()
}
private fun waitForInstallResult() = runBlocking { private fun waitForInstallResult() = runBlocking {
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {

View file

@ -11,6 +11,8 @@ object RestoreScreen : UiDeviceScreen<RestoreScreen>() {
val backupListItem = findObject { textContains("Last backup") } val backupListItem = findObject { textContains("Last backup") }
val appsSelectedButton = findObject { text("Restore backup") }
val nextButton = findObject { text("Next") } val nextButton = findObject { text("Next") }
val finishButton = findObject { text("Finish") } val finishButton = findObject { text("Finish") }