Merge "Add test to access overview app menu." into udc-qpr-dev

This commit is contained in:
Pat Manning
2023-08-02 18:02:29 +00:00
committed by Android (Google) Code Review
3 changed files with 34 additions and 1 deletions
@@ -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.<RecentsView>getOverviewPanel().getCurrentPage();
}
@@ -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"
);
/**
@@ -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));