Browse Source

Screenshot tests reliability improvements

Add more sleeps to SetupEncryptionDialogFragment.error and TrashBinActivity.empty, which fail frequently

Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
Álvaro Brey Vilas 3 years ago
parent
commit
236925de99

+ 3 - 4
app/src/androidTest/java/com/owncloud/android/ui/dialog/SetupEncryptionDialogFragmentIT.kt

@@ -21,7 +21,6 @@
  */
 package com.owncloud.android.ui.dialog
 
-import android.view.Window
 import androidx.test.espresso.intent.rule.IntentsTestRule
 import androidx.test.internal.runner.junit4.statement.UiThreadStatement.runOnUiThread
 import com.nextcloud.client.TestActivity
@@ -29,7 +28,6 @@ import com.owncloud.android.AbstractIT
 import com.owncloud.android.utils.ScreenshotTest
 import org.junit.Rule
 import org.junit.Test
-import java.util.Objects
 
 class SetupEncryptionDialogFragmentIT : AbstractIT() {
     @get:Rule
@@ -69,7 +67,7 @@ class SetupEncryptionDialogFragmentIT : AbstractIT() {
 
         waitForIdleSync()
 
-        screenshot(Objects.requireNonNull<Window>(sut.requireDialog().window).decorView)
+        screenshot(sut.requireDialog().window!!.decorView)
     }
 
     @Test
@@ -87,8 +85,9 @@ class SetupEncryptionDialogFragmentIT : AbstractIT() {
             sut.errorSavingKeys()
         }
 
+        shortSleep()
         waitForIdleSync()
 
-        screenshot(Objects.requireNonNull<Window>(sut.requireDialog().window).decorView)
+        screenshot(sut.requireDialog().window!!.decorView)
     }
 }

+ 2 - 0
app/src/androidTest/java/com/owncloud/android/ui/trashbin/TrashbinActivityIT.kt

@@ -86,6 +86,8 @@ class TrashbinActivityIT : AbstractIT() {
         sut.runOnUiThread { sut.loadFolder() }
 
         shortSleep()
+        shortSleep()
+        waitForIdleSync()
 
         screenshot(sut)
     }