mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 09:56:49 +00:00
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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user