summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2021-02-03 21:37:36 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2021-02-03 21:37:36 +0000
commitb754d44b97b9dcf186af046e9d8ab0621e3a2d66 (patch)
tree8c5c834833bc0233726527635a9cf5aba61671e4
parent42a101abe85d76de19e14df70ab26f943679c520 (diff)
parent70ac90a3774ea72330b8dbf9502ef64750db8d8c (diff)
downloadcts-android11-mainline-release.tar.gz
Change-Id: I6d12c9c28a0aee2258819d395e5ac02ef7a46872
-rw-r--r--hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java
index 4c99693f979..2e785f500f9 100644
--- a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java
+++ b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java
@@ -21,6 +21,7 @@ import android.content.ContentResolver;
import android.content.Intent;
import android.content.IntentSender;
import android.database.Cursor;
+import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import android.os.SystemClock;
@@ -118,8 +119,18 @@ public class DocumentsClientTest extends DocumentsClientTestCase {
// Repeat swipe gesture to find our item
// (UiScrollable#scrollIntoView does not seem to work well with SwipeRefreshLayout)
UiObject targetObject = new UiObject(docList.childSelector(new UiSelector().text(label)));
+ UiObject saveButton = findSaveButton();
int stepLimit = 10;
- while (!targetObject.exists() && stepLimit-- > 0) {
+ while (stepLimit-- > 0) {
+ if (targetObject.exists()) {
+ boolean targetObjectFullyVisible = !saveButton.exists()
+ || targetObject.getVisibleBounds().bottom
+ <= saveButton.getVisibleBounds().top;
+ if (targetObjectFullyVisible) {
+ break;
+ }
+ }
+
mDevice.swipe(/* startX= */ mDevice.getDisplayWidth() / 2,
/* startY= */ mDevice.getDisplayHeight() / 2,
/* endX= */ mDevice.getDisplayWidth() / 2,