Merge "Not assuming reverse order of menu shortcuts" into sc-dev

This commit is contained in:
Vadim Tryshev 2021-03-18 18:41:04 +00:00 committed by Android (Google) Code Review
commit 5c97cb689d
1 changed files with 21 additions and 10 deletions

View File

@ -334,20 +334,31 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest {
// 1. Open all apps and wait for load complete.
// 2. Find the app and long press it to show shortcuts.
// 3. Press icon center until shortcuts appear
final AllApps allApps = mLauncher.
getWorkspace().
switchToAllApps();
final AllApps allApps = mLauncher
.getWorkspace()
.switchToAllApps();
allApps.freeze();
try {
final AppIconMenuItem menuItem = allApps.
getAppIcon(APP_NAME).
openMenu().
getMenuItem(0);
final String shortcutName = menuItem.getText();
assertEquals("Wrong menu item", "Shortcut 3", shortcutName);
final AppIconMenu menu = allApps
.getAppIcon(APP_NAME)
.openMenu();
final AppIconMenuItem menuItem0 = menu.getMenuItem(0);
final AppIconMenuItem menuItem2 = menu.getMenuItem(2);
final AppIconMenuItem menuItem;
final String expectedShortcutName = "Shortcut 3";
if (menuItem0.getText().equals(expectedShortcutName)) {
menuItem = menuItem0;
} else {
final String shortcutName2 = menuItem2.getText();
assertEquals("Wrong menu item", expectedShortcutName, shortcutName2);
menuItem = menuItem2;
}
menuItem.dragToWorkspace(false, false);
mLauncher.getWorkspace().getWorkspaceAppIcon(shortcutName).launch(getAppPackageName());
mLauncher.getWorkspace().getWorkspaceAppIcon(expectedShortcutName)
.launch(getAppPackageName());
} finally {
allApps.unfreeze();
}