Loading tests/tapl/com/android/launcher3/tapl/AddToHomeScreenPrompt.java +7 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.launcher3.tapl; import static java.util.regex.Pattern.CASE_INSENSITIVE; import androidx.test.uiautomator.By; import androidx.test.uiautomator.BySelector; import androidx.test.uiautomator.UiObject2; import com.android.launcher3.testing.TestProtocol; Loading @@ -33,11 +34,14 @@ public class AddToHomeScreenPrompt { AddToHomeScreenPrompt(LauncherInstrumentation launcher) { mLauncher = launcher; mWidgetCell = launcher.waitForLauncherObject(By.clazz( "com.android.launcher3.widget.WidgetCell")); mWidgetCell = launcher.waitForLauncherObject(getSelector()); mLauncher.assertNotNull("Can't find widget cell object", mWidgetCell); } private static BySelector getSelector() { return By.clazz("com.android.launcher3.widget.WidgetCell"); } public void addAutomatically() { try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck()) { if (mLauncher.getNavigationModel() Loading @@ -53,6 +57,7 @@ public class AddToHomeScreenPrompt { mLauncher.waitForObjectInContainer( mWidgetCell.getParent().getParent().getParent().getParent(), By.text(ADD_AUTOMATICALLY)).click(); mLauncher.waitUntilLauncherObjectGone(getSelector()); } } } tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +28 −20 Original line number Diff line number Diff line Loading @@ -542,32 +542,32 @@ public final class LauncherInstrumentation { if (mDevice.isNaturalOrientation()) { waitForLauncherObject(APPS_RES_ID); } else { waitUntilGone(APPS_RES_ID); waitUntilLauncherObjectGone(APPS_RES_ID); } waitUntilGone(OVERVIEW_RES_ID); waitUntilGone(WIDGETS_RES_ID); waitUntilLauncherObjectGone(OVERVIEW_RES_ID); waitUntilLauncherObjectGone(WIDGETS_RES_ID); return waitForLauncherObject(WORKSPACE_RES_ID); } case WIDGETS: { waitUntilGone(WORKSPACE_RES_ID); waitUntilGone(APPS_RES_ID); waitUntilGone(OVERVIEW_RES_ID); waitUntilLauncherObjectGone(WORKSPACE_RES_ID); waitUntilLauncherObjectGone(APPS_RES_ID); waitUntilLauncherObjectGone(OVERVIEW_RES_ID); return waitForLauncherObject(WIDGETS_RES_ID); } case ALL_APPS: { waitUntilGone(WORKSPACE_RES_ID); waitUntilGone(OVERVIEW_RES_ID); waitUntilGone(WIDGETS_RES_ID); waitUntilLauncherObjectGone(WORKSPACE_RES_ID); waitUntilLauncherObjectGone(OVERVIEW_RES_ID); waitUntilLauncherObjectGone(WIDGETS_RES_ID); return waitForLauncherObject(APPS_RES_ID); } case OVERVIEW: { if (hasAllAppsInOverview()) { waitForLauncherObject(APPS_RES_ID); } else { waitUntilGone(APPS_RES_ID); waitUntilLauncherObjectGone(APPS_RES_ID); } waitUntilGone(WORKSPACE_RES_ID); waitUntilGone(WIDGETS_RES_ID); waitUntilLauncherObjectGone(WORKSPACE_RES_ID); waitUntilLauncherObjectGone(WIDGETS_RES_ID); return waitForLauncherObject(OVERVIEW_RES_ID); } Loading @@ -575,10 +575,10 @@ public final class LauncherInstrumentation { return waitForFallbackLauncherObject(OVERVIEW_RES_ID); } case BACKGROUND: { waitUntilGone(WORKSPACE_RES_ID); waitUntilGone(APPS_RES_ID); waitUntilGone(OVERVIEW_RES_ID); waitUntilGone(WIDGETS_RES_ID); waitUntilLauncherObjectGone(WORKSPACE_RES_ID); waitUntilLauncherObjectGone(APPS_RES_ID); waitUntilLauncherObjectGone(OVERVIEW_RES_ID); waitUntilLauncherObjectGone(WIDGETS_RES_ID); return null; } default: Loading Loading @@ -647,7 +647,7 @@ public final class LauncherInstrumentation { false, GestureScope.INSIDE_TO_OUTSIDE); try (LauncherInstrumentation.Closable c = addContextLayer( "Swiped up from context menu to home")) { waitUntilGone(CONTEXT_MENU_RES_ID); waitUntilLauncherObjectGone(CONTEXT_MENU_RES_ID); } } if (hasLauncherObject(WORKSPACE_RES_ID)) { Loading Loading @@ -800,9 +800,17 @@ public final class LauncherInstrumentation { } } void waitUntilGone(String resId) { assertTrue("Unexpected launcher object visible: " + resId, mDevice.wait(Until.gone(getLauncherObjectSelector(resId)), void waitUntilLauncherObjectGone(String resId) { waitUntilGoneBySelector(getLauncherObjectSelector(resId)); } void waitUntilLauncherObjectGone(BySelector selector) { waitUntilGoneBySelector(makeLauncherSelector(selector)); } private void waitUntilGoneBySelector(BySelector launcherSelector) { assertTrue("Unexpected launcher object visible: " + launcherSelector, mDevice.wait(Until.gone(launcherSelector), WAIT_TIME_MS)); } Loading tests/tapl/com/android/launcher3/tapl/Workspace.java +1 −1 Original line number Diff line number Diff line Loading @@ -230,7 +230,7 @@ public final class Workspace extends Home { launcher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START); } LauncherInstrumentation.log("dragIconToWorkspace: end"); launcher.waitUntilGone("drop_target_bar"); launcher.waitUntilLauncherObjectGone("drop_target_bar"); } /** Loading Loading
tests/tapl/com/android/launcher3/tapl/AddToHomeScreenPrompt.java +7 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.launcher3.tapl; import static java.util.regex.Pattern.CASE_INSENSITIVE; import androidx.test.uiautomator.By; import androidx.test.uiautomator.BySelector; import androidx.test.uiautomator.UiObject2; import com.android.launcher3.testing.TestProtocol; Loading @@ -33,11 +34,14 @@ public class AddToHomeScreenPrompt { AddToHomeScreenPrompt(LauncherInstrumentation launcher) { mLauncher = launcher; mWidgetCell = launcher.waitForLauncherObject(By.clazz( "com.android.launcher3.widget.WidgetCell")); mWidgetCell = launcher.waitForLauncherObject(getSelector()); mLauncher.assertNotNull("Can't find widget cell object", mWidgetCell); } private static BySelector getSelector() { return By.clazz("com.android.launcher3.widget.WidgetCell"); } public void addAutomatically() { try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck()) { if (mLauncher.getNavigationModel() Loading @@ -53,6 +57,7 @@ public class AddToHomeScreenPrompt { mLauncher.waitForObjectInContainer( mWidgetCell.getParent().getParent().getParent().getParent(), By.text(ADD_AUTOMATICALLY)).click(); mLauncher.waitUntilLauncherObjectGone(getSelector()); } } }
tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +28 −20 Original line number Diff line number Diff line Loading @@ -542,32 +542,32 @@ public final class LauncherInstrumentation { if (mDevice.isNaturalOrientation()) { waitForLauncherObject(APPS_RES_ID); } else { waitUntilGone(APPS_RES_ID); waitUntilLauncherObjectGone(APPS_RES_ID); } waitUntilGone(OVERVIEW_RES_ID); waitUntilGone(WIDGETS_RES_ID); waitUntilLauncherObjectGone(OVERVIEW_RES_ID); waitUntilLauncherObjectGone(WIDGETS_RES_ID); return waitForLauncherObject(WORKSPACE_RES_ID); } case WIDGETS: { waitUntilGone(WORKSPACE_RES_ID); waitUntilGone(APPS_RES_ID); waitUntilGone(OVERVIEW_RES_ID); waitUntilLauncherObjectGone(WORKSPACE_RES_ID); waitUntilLauncherObjectGone(APPS_RES_ID); waitUntilLauncherObjectGone(OVERVIEW_RES_ID); return waitForLauncherObject(WIDGETS_RES_ID); } case ALL_APPS: { waitUntilGone(WORKSPACE_RES_ID); waitUntilGone(OVERVIEW_RES_ID); waitUntilGone(WIDGETS_RES_ID); waitUntilLauncherObjectGone(WORKSPACE_RES_ID); waitUntilLauncherObjectGone(OVERVIEW_RES_ID); waitUntilLauncherObjectGone(WIDGETS_RES_ID); return waitForLauncherObject(APPS_RES_ID); } case OVERVIEW: { if (hasAllAppsInOverview()) { waitForLauncherObject(APPS_RES_ID); } else { waitUntilGone(APPS_RES_ID); waitUntilLauncherObjectGone(APPS_RES_ID); } waitUntilGone(WORKSPACE_RES_ID); waitUntilGone(WIDGETS_RES_ID); waitUntilLauncherObjectGone(WORKSPACE_RES_ID); waitUntilLauncherObjectGone(WIDGETS_RES_ID); return waitForLauncherObject(OVERVIEW_RES_ID); } Loading @@ -575,10 +575,10 @@ public final class LauncherInstrumentation { return waitForFallbackLauncherObject(OVERVIEW_RES_ID); } case BACKGROUND: { waitUntilGone(WORKSPACE_RES_ID); waitUntilGone(APPS_RES_ID); waitUntilGone(OVERVIEW_RES_ID); waitUntilGone(WIDGETS_RES_ID); waitUntilLauncherObjectGone(WORKSPACE_RES_ID); waitUntilLauncherObjectGone(APPS_RES_ID); waitUntilLauncherObjectGone(OVERVIEW_RES_ID); waitUntilLauncherObjectGone(WIDGETS_RES_ID); return null; } default: Loading Loading @@ -647,7 +647,7 @@ public final class LauncherInstrumentation { false, GestureScope.INSIDE_TO_OUTSIDE); try (LauncherInstrumentation.Closable c = addContextLayer( "Swiped up from context menu to home")) { waitUntilGone(CONTEXT_MENU_RES_ID); waitUntilLauncherObjectGone(CONTEXT_MENU_RES_ID); } } if (hasLauncherObject(WORKSPACE_RES_ID)) { Loading Loading @@ -800,9 +800,17 @@ public final class LauncherInstrumentation { } } void waitUntilGone(String resId) { assertTrue("Unexpected launcher object visible: " + resId, mDevice.wait(Until.gone(getLauncherObjectSelector(resId)), void waitUntilLauncherObjectGone(String resId) { waitUntilGoneBySelector(getLauncherObjectSelector(resId)); } void waitUntilLauncherObjectGone(BySelector selector) { waitUntilGoneBySelector(makeLauncherSelector(selector)); } private void waitUntilGoneBySelector(BySelector launcherSelector) { assertTrue("Unexpected launcher object visible: " + launcherSelector, mDevice.wait(Until.gone(launcherSelector), WAIT_TIME_MS)); } Loading
tests/tapl/com/android/launcher3/tapl/Workspace.java +1 −1 Original line number Diff line number Diff line Loading @@ -230,7 +230,7 @@ public final class Workspace extends Home { launcher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START); } LauncherInstrumentation.log("dragIconToWorkspace: end"); launcher.waitUntilGone("drop_target_bar"); launcher.waitUntilLauncherObjectGone("drop_target_bar"); } /** Loading