summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVadim Tryshev <vadimt@google.com>2018-09-26 18:15:42 -0700
committerVadim Tryshev <vadimt@google.com>2018-09-26 18:15:42 -0700
commit43524d0daa5c17ec1b9bfc52d4272ee347a7c529 (patch)
tree3138d06d46cccce050b2f41f442b8abc50d5a969 /tests
parent9f2e997b309c0f14c21401d17686ecf9c2aa6d92 (diff)
downloadandroid_packages_apps_Trebuchet-43524d0daa5c17ec1b9bfc52d4272ee347a7c529.tar.gz
android_packages_apps_Trebuchet-43524d0daa5c17ec1b9bfc52d4272ee347a7c529.tar.bz2
android_packages_apps_Trebuchet-43524d0daa5c17ec1b9bfc52d4272ee347a7c529.zip
Attempting to fix flakes in AllAppsIconToHomeTest
Pressing an icon in AllApps doesn't show a context menu. The flake doesn't repro locally, the suspects are: 1. Too short wait time 2. App being partially covered by navbar. Hence the fixes. This patch is temporary, and will be replaced with a permanent one when this will be converted to TAPL. Test: AllAppsIconToHomeTest Change-Id: I0a03ff8827a5bc7940af3ec956d4b62330a16c66
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index 75efea4eb..9cbab5e18 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -17,6 +17,7 @@ package com.android.launcher3.ui;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
import android.app.Instrumentation;
import android.content.BroadcastReceiver;
@@ -74,7 +75,7 @@ public abstract class AbstractLauncherUiTest {
public static final long DEFAULT_BROADCAST_TIMEOUT_SECS = 5;
public static final long SHORT_UI_TIMEOUT= 300;
- public static final long DEFAULT_UI_TIMEOUT = 3000;
+ public static final long DEFAULT_UI_TIMEOUT = 10000;
public static final long DEFAULT_WORKER_TIMEOUT_SECS = 5;
protected MainThreadExecutor mMainThreadExecutor = new MainThreadExecutor();
@@ -151,16 +152,20 @@ public abstract class AbstractLauncherUiTest {
* @return the matching object.
*/
protected UiObject2 scrollAndFind(UiObject2 container, BySelector condition) {
- do {
+ container.setGestureMargins(0, 0, 0, 200);
+
+ int i = 0;
+ for (; ; ) {
// findObject can only execute after spring settles.
mDevice.wait(Until.findObject(condition), SHORT_UI_TIMEOUT);
UiObject2 widget = container.findObject(condition);
if (widget != null && widget.getVisibleBounds().intersects(
- 0, 0, mDevice.getDisplayWidth(), mDevice.getDisplayHeight())) {
+ 0, 0, mDevice.getDisplayWidth(), mDevice.getDisplayHeight() - 200)) {
return widget;
}
- } while (container.scroll(Direction.DOWN, 1f));
- return container.findObject(condition);
+ if (++i > 40) fail("Too many attempts");
+ container.scroll(Direction.DOWN, 1f);
+ }
}
/**