From 6eaba0b87aaed177445a0ccb65b0303c730a77f5 Mon Sep 17 00:00:00 2001 From: Steve Soltys Date: Mon, 25 Sep 2023 16:57:19 +0000 Subject: [PATCH] Wait until storage location is initialized for e2e test --- .../java/com/stevesoltys/seedvault/e2e/LargeTestBase.kt | 6 ++++++ .../stevesoltys/seedvault/e2e/screen/impl/BackupScreen.kt | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/app/src/androidTest/java/com/stevesoltys/seedvault/e2e/LargeTestBase.kt b/app/src/androidTest/java/com/stevesoltys/seedvault/e2e/LargeTestBase.kt index 31aa0e07..46f3e411 100644 --- a/app/src/androidTest/java/com/stevesoltys/seedvault/e2e/LargeTestBase.kt +++ b/app/src/androidTest/java/com/stevesoltys/seedvault/e2e/LargeTestBase.kt @@ -8,6 +8,7 @@ import androidx.annotation.WorkerThread import androidx.preference.PreferenceManager import androidx.test.platform.app.InstrumentationRegistry import androidx.test.uiautomator.UiDevice +import androidx.test.uiautomator.Until import com.stevesoltys.seedvault.crypto.ANDROID_KEY_STORE import com.stevesoltys.seedvault.crypto.KEY_ALIAS_BACKUP import com.stevesoltys.seedvault.crypto.KEY_ALIAS_MAIN @@ -171,6 +172,11 @@ internal interface LargeTestBase : KoinComponent { useThisFolderButton.clickAndWaitForNewWindow() allowButton.clickAndWaitForNewWindow() } + + BackupScreen { + device.wait(Until.hasObject(initializingText), 10000) + device.wait(Until.gone(initializingText), 120000) + } } fun confirmCode() { diff --git a/app/src/androidTest/java/com/stevesoltys/seedvault/e2e/screen/impl/BackupScreen.kt b/app/src/androidTest/java/com/stevesoltys/seedvault/e2e/screen/impl/BackupScreen.kt index dc33be7b..13235b6e 100644 --- a/app/src/androidTest/java/com/stevesoltys/seedvault/e2e/screen/impl/BackupScreen.kt +++ b/app/src/androidTest/java/com/stevesoltys/seedvault/e2e/screen/impl/BackupScreen.kt @@ -1,5 +1,7 @@ package com.stevesoltys.seedvault.e2e.screen.impl +import androidx.test.uiautomator.By +import androidx.test.uiautomator.BySelector import com.stevesoltys.seedvault.e2e.screen.UiDeviceScreen object BackupScreen : UiDeviceScreen() { @@ -11,4 +13,6 @@ object BackupScreen : UiDeviceScreen() { val backupStatusButton = findObject { text("Backup status") } val backupLocationButton = findObject { text("Backup location") } + + val initializingText: BySelector = By.textContains("Initializing backup location") }