Skip to content

Commit

Permalink
Fix backup/restore instrumentation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
grote committed May 31, 2024
1 parent 1beebdc commit ab4b1f1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ internal interface LargeRestoreTestBase : LargeTestBase {
backupListItem.clickAndWaitForNewWindow()
waitUntilIdle()

waitForAppSelectionLoaded()
// just tap next in app selection
appsSelectedButton.clickAndWaitForNewWindow()

waitForInstallResult()

if (someAppsNotInstalledText.exists()) {
Expand Down Expand Up @@ -104,6 +108,17 @@ internal interface LargeRestoreTestBase : LargeTestBase {
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 {

withContext(Dispatchers.Main) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ object RestoreScreen : UiDeviceScreen<RestoreScreen>() {

val backupListItem = findObject { textContains("Last backup") }

val appsSelectedButton = findObject { text("Restore backup") }

val nextButton = findObject { text("Next") }

val finishButton = findObject { text("Finish") }
Expand Down

0 comments on commit ab4b1f1

Please sign in to comment.