Merge "Locking the All Apps view before asserting PS components." into main

This commit is contained in:
Treehugger Robot
2024-05-02 19:02:42 +00:00
committed by Android (Google) Code Review
3 changed files with 40 additions and 12 deletions

View File

@@ -27,6 +27,7 @@ import android.util.Log;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
import com.android.launcher3.tapl.HomeAllApps;
import com.android.launcher3.tapl.LauncherInstrumentation;
import com.android.launcher3.tapl.PrivateSpaceContainer;
import com.android.launcher3.util.TestUtil;
@@ -100,10 +101,18 @@ public class TaplPrivateSpaceTest extends AbstractQuickStepTest {
public void testPrivateSpaceContainerIsPresent() {
// Scroll to the bottom of All Apps
executeOnLauncher(launcher -> launcher.getAppsView().resetAndScrollToPrivateSpaceHeader());
// Freeze All Apps
HomeAllApps homeAllApps = mLauncher.getAllApps();
homeAllApps.freeze();
// Verify Unlocked View elements are present.
assertNotNull("Private Space Unlocked View not found, or is not correct",
mLauncher.getAllApps().getPrivateSpaceUnlockedView());
try {
// Verify Unlocked View elements are present.
assertNotNull("Private Space Unlocked View not found, or is not correct",
homeAllApps.getPrivateSpaceUnlockedView());
} finally {
// UnFreeze
homeAllApps.unfreeze();
}
}
@Test
@@ -117,10 +126,18 @@ public class TaplPrivateSpaceTest extends AbstractQuickStepTest {
waitForLauncherUIUpdate();
// Scroll to the bottom of All Apps
executeOnLauncher(launcher -> launcher.getAppsView().resetAndScrollToPrivateSpaceHeader());
// Freeze All Apps
HomeAllApps homeAllApps = mLauncher.getAllApps();
homeAllApps.freeze();
// Verify the Installed App is displayed in correct position.
PrivateSpaceContainer psContainer = mLauncher.getAllApps().getPrivateSpaceUnlockedView();
psContainer.verifyInstalledAppIsPresent(INSTALLED_APP_NAME);
try {
// Verify the Installed App is displayed in correct position.
PrivateSpaceContainer psContainer = homeAllApps.getPrivateSpaceUnlockedView();
psContainer.verifyInstalledAppIsPresent(INSTALLED_APP_NAME);
} finally {
// UnFreeze
homeAllApps.unfreeze();
}
}
@Test
@@ -134,8 +151,17 @@ public class TaplPrivateSpaceTest extends AbstractQuickStepTest {
waitForLauncherUIUpdate();
// Scroll to the bottom of All Apps
executeOnLauncher(launcher -> launcher.getAppsView().resetAndScrollToPrivateSpaceHeader());
// Get the "uninstall" menu item.
mLauncher.getAllApps().getAppIcon(INSTALLED_APP_NAME).openMenu().getMenuItem("Uninstall");
// Freeze All Apps
HomeAllApps homeAllApps = mLauncher.getAllApps();
homeAllApps.freeze();
try {
// Get the "uninstall" menu item.
homeAllApps.getAppIcon(INSTALLED_APP_NAME).openMenu().getMenuItem("Uninstall");
} finally {
// UnFreeze
homeAllApps.unfreeze();
}
}
private void waitForPrivateSpaceSetup() {