From ccf611234a8d670e225cb942c05e01e0e205a523 Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Tue, 25 Jul 2023 15:47:09 +0100 Subject: [PATCH] Add test to access overview app menu. Approved tapl DD: go/tapl-overview-task-menu-app-info Fix: 292081139 Test: TaplTestsQuickstep. Change-Id: Ic74267ec80b0a8c6af502a445d355f0420d8f569 --- .../android/quickstep/TaplTestsQuickstep.java | 14 ++++++++++++++ .../AlphaJumpDetector.java | 3 ++- .../launcher3/tapl/OverviewTaskMenu.java | 18 ++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java index 06ce0e5273..9d188ed2d1 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java @@ -44,6 +44,7 @@ import com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel; import com.android.launcher3.tapl.Overview; import com.android.launcher3.tapl.OverviewActions; import com.android.launcher3.tapl.OverviewTask; +import com.android.launcher3.tapl.OverviewTaskMenu; import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; import com.android.launcher3.ui.TaplTestsLauncher3; import com.android.launcher3.util.DisplayController; @@ -196,6 +197,19 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { actionsView.clickAndDismissScreenshot(); } + + @Test + public void testOverviewActionsMenu() throws Exception { + startTestAppsWithCheck(); + + OverviewTaskMenu menu = mLauncher.goHome().switchToOverview().getCurrentTask().tapMenu(); + + assertNotNull("Tapping App info menu item returned null", menu.tapAppInfoMenuItem()); + executeOnLauncher(launcher -> assertTrue( + "Launcher activity is the top activity; expecting another activity to be the top", + isInLaunchedApp(launcher))); + } + private int getCurrentOverviewPage(Launcher launcher) { return launcher.getOverviewPanel().getCurrentPage(); } diff --git a/tests/src/com/android/launcher3/util/viewcapture_analysis/AlphaJumpDetector.java b/tests/src/com/android/launcher3/util/viewcapture_analysis/AlphaJumpDetector.java index cb404b966c..6444ffc4f5 100644 --- a/tests/src/com/android/launcher3/util/viewcapture_analysis/AlphaJumpDetector.java +++ b/tests/src/com/android/launcher3/util/viewcapture_analysis/AlphaJumpDetector.java @@ -133,7 +133,8 @@ final class AlphaJumpDetector extends AnomalyDetector { + "|LinearLayout:id/action_buttons|ImageButton:id/action_split", RECENTS_DRAG_LAYER + "NexusOverviewActionsView:id/overview_actions_view" - + "|LinearLayout:id/action_buttons|ImageButton:id/action_split" + + "|LinearLayout:id/action_buttons|ImageButton:id/action_split", + DRAG_LAYER + "IconView" ); /** diff --git a/tests/tapl/com/android/launcher3/tapl/OverviewTaskMenu.java b/tests/tapl/com/android/launcher3/tapl/OverviewTaskMenu.java index e349620e28..7c29a6cf87 100644 --- a/tests/tapl/com/android/launcher3/tapl/OverviewTaskMenu.java +++ b/tests/tapl/com/android/launcher3/tapl/OverviewTaskMenu.java @@ -50,6 +50,24 @@ public class OverviewTaskMenu { } } + /** Taps the app info item from the overview task menu and returns the LaunchedAppState + * representing the App info settings page. */ + @NonNull + public LaunchedAppState tapAppInfoMenuItem() { + try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck(); + LauncherInstrumentation.Closable c = mLauncher.addContextLayer( + "before tapping the app info menu item")) { + mLauncher.clickLauncherObject( + mLauncher.findObjectInContainer(mMenu, By.text("App info"))); + + try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer( + "tapped app info menu item")) { + mLauncher.waitUntilSystemLauncherObjectGone("overview_panel"); + return new LaunchedAppState(mLauncher); + } + } + } + /** Returns true if an item matching the given string is present in the menu. */ public boolean hasMenuItem(String expectedMenuItemText) { UiObject2 menuItem = mLauncher.findObjectInContainer(mMenu, By.text(expectedMenuItemText));