瀏覽代碼

hardening of passcode screenshot test

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 4 年之前
父節點
當前提交
e21f6ef0db

+ 12 - 0
src/androidTest/java/com/owncloud/android/ui/activity/PassCodeActivityIT.kt

@@ -38,6 +38,10 @@ class PassCodeActivityIT : AbstractIT() {
         val sut = activityRule.launchActivity(Intent(PassCodeActivity.ACTION_CHECK))
 
         waitForIdleSync()
+
+        sut.runOnUiThread { sut.binding.txt0.clearFocus() }
+
+        shortSleep()
         screenshot(sut)
     }
 
@@ -47,6 +51,10 @@ class PassCodeActivityIT : AbstractIT() {
         val sut = activityRule.launchActivity(Intent(PassCodeActivity.ACTION_REQUEST_WITH_RESULT))
 
         waitForIdleSync()
+
+        sut.runOnUiThread { sut.binding.txt0.clearFocus() }
+
+        shortSleep()
         screenshot(sut)
     }
 
@@ -56,6 +64,10 @@ class PassCodeActivityIT : AbstractIT() {
         val sut = activityRule.launchActivity(Intent(PassCodeActivity.ACTION_CHECK_WITH_RESULT))
 
         waitForIdleSync()
+
+        sut.runOnUiThread { sut.binding.txt0.clearFocus() }
+
+        shortSleep()
         screenshot(sut)
     }
 }

+ 5 - 0
src/main/java/com/owncloud/android/ui/activity/PassCodeActivity.java

@@ -50,6 +50,7 @@ import java.util.Arrays;
 import javax.inject.Inject;
 
 import androidx.annotation.NonNull;
+import androidx.annotation.VisibleForTesting;
 import androidx.appcompat.app.AppCompatActivity;
 
 public class PassCodeActivity extends AppCompatActivity implements Injectable {
@@ -174,6 +175,10 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
         }
     }
 
+    @VisibleForTesting
+    public PasscodelockBinding getBinding() {
+        return binding;
+    }
 
     /**
      * Binds the appropriate listeners to the input boxes receiving each digit of the pass code.