From 18862453596d73b8dd92f86bbb9cc63bad7e17e8 Mon Sep 17 00:00:00 2001 From: vadimt Date: Tue, 14 May 2019 18:55:37 -0700 Subject: [PATCH] Swipe from all apps from overview starts on an icon In some configs, Overview has prediction row, in others hotseat. So swiping from an icon in either. Change-Id: I98db3df4f612fcd9d5b7057835c49ca58313210f --- .../launcher3/tapl/LauncherInstrumentation.java | 12 ++++++++++++ tests/tapl/com/android/launcher3/tapl/Overview.java | 7 ++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index db447ee46a..ec62188950 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -531,6 +531,14 @@ public final class LauncherInstrumentation { return object; } + @NonNull + UiObject2 waitForLauncherObjectByClass(String clazz) { + final BySelector selector = getLauncherObjectSelectorByClass(clazz); + final UiObject2 object = mDevice.wait(Until.findObject(selector), WAIT_TIME_MS); + assertNotNull("Can't find a launcher object; selector: " + selector, object); + return object; + } + @NonNull UiObject2 waitForFallbackLauncherObject(String resName) { final BySelector selector = getFallbackLauncherObjectSelector(resName); @@ -543,6 +551,10 @@ public final class LauncherInstrumentation { return By.res(getLauncherPackageName(), resName); } + BySelector getLauncherObjectSelectorByClass(String clazz) { + return By.pkg(getLauncherPackageName()).clazz(clazz); + } + BySelector getFallbackLauncherObjectSelector(String resName) { return By.res(getOverviewPackageName(), resName); } diff --git a/tests/tapl/com/android/launcher3/tapl/Overview.java b/tests/tapl/com/android/launcher3/tapl/Overview.java index 08d974c99a..ec99d26c19 100644 --- a/tests/tapl/com/android/launcher3/tapl/Overview.java +++ b/tests/tapl/com/android/launcher3/tapl/Overview.java @@ -49,11 +49,12 @@ public final class Overview extends BaseOverview { "want to switch from overview to all apps")) { verifyActiveContainer(); - // Swipe from the prediction row to the top. + // Swipe from an app icon to the top. LauncherInstrumentation.log("Overview.switchToAllApps before swipe"); - final UiObject2 predictionRow = mLauncher.waitForLauncherObject("prediction_row"); + final UiObject2 appIcon = mLauncher.waitForLauncherObjectByClass( + "android.widget.TextView"); mLauncher.swipeToState(mLauncher.getDevice().getDisplayWidth() / 2, - predictionRow.getVisibleBounds().centerY(), + appIcon.getVisibleBounds().centerY(), mLauncher.getDevice().getDisplayWidth() / 2, 0, 50, ALL_APPS_STATE_ORDINAL);