Merge "Fixing TaplUninstallRemoveTest#uninstallWorkspaceIcon test" into main

This commit is contained in:
Jagrut Desai
2024-04-15 16:41:46 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 6 deletions
@@ -39,6 +39,7 @@ import com.android.launcher3.ui.AbstractLauncherUiTest;
import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape;
import com.android.launcher3.util.TestUtil;
import com.android.launcher3.util.Wait;
import com.android.launcher3.util.rule.ScreenRecordRule;
import com.android.launcher3.util.rule.TestStabilityRule;
import org.junit.Test;
@@ -132,6 +133,7 @@ public class TaplUninstallRemoveTest extends AbstractLauncherUiTest<Launcher> {
*/
@Test
@PlatinumTest(focusArea = "launcher")
@ScreenRecordRule.ScreenRecord // b/319501259
public void uninstallWorkspaceIcon() throws IOException {
Point[] gridPositions = TestUtil.getCornersAndCenterPositions(mLauncher);
StringBuilder sb = new StringBuilder();
@@ -162,12 +164,10 @@ public class TaplUninstallRemoveTest extends AbstractLauncherUiTest<Launcher> {
mLauncher.getWorkspace().verifyWorkspaceAppIconIsGone(
DUMMY_APP_NAME + " was expected to disappear after uninstall.", DUMMY_APP_NAME);
if (!TestStabilityRule.isPresubmit()) { // b/315847371
Log.d(UIOBJECT_STALE_ELEMENT, "second getWorkspaceIconsPositions()");
Map<String, Point> finalPositions =
mLauncher.getWorkspace().getWorkspaceIconsPositions();
assertThat(finalPositions).doesNotContainKey(DUMMY_APP_NAME);
}
Log.d(UIOBJECT_STALE_ELEMENT, "second getWorkspaceIconsPositions()");
Map<String, Point> finalPositions =
mLauncher.getWorkspace().getWorkspaceIconsPositions();
assertThat(finalPositions).doesNotContainKey(DUMMY_APP_NAME);
} finally {
TestUtil.uninstallDummyApp();
}
@@ -347,6 +347,7 @@ public final class Workspace extends Home {
*/
public Map<String, Point> getWorkspaceIconsPositions() {
final UiObject2 workspace = verifyActiveContainer();
mLauncher.waitForLauncherInitialized(); // b/319501259
List<UiObject2> workspaceIcons =
mLauncher.waitForObjectsInContainer(workspace, AppIcon.getAnyAppIconSelector());
return workspaceIcons.stream()