From b9b75281b1bcd9e9e91b7877b1e798797a0456b9 Mon Sep 17 00:00:00 2001 From: Andrew Cole Date: Tue, 13 Jun 2023 15:01:37 -0700 Subject: [PATCH] Test Uninstall Flakiness Fixing a flake in a e2e test that is occuring in testUninstallFromAllApps. The offending test was not always waiting for the platform to uninstall the app, which would remove the app from AllApps. Bug: 258071914 Test: testUninstallFromAllApps Change-Id: I38d162ba09f38feca49a96fa126db7ffc22ce935 --- .../android/launcher3/ui/TaplTestsLauncher3.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java index a12d10b193..8b17cdad5b 100644 --- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java +++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java @@ -23,7 +23,6 @@ import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeFalse; import static org.junit.Assume.assumeTrue; @@ -58,6 +57,7 @@ import com.android.launcher3.tapl.Workspace; import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; import com.android.launcher3.util.LauncherLayoutBuilder; import com.android.launcher3.util.TestUtil; +import com.android.launcher3.util.Wait; import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord; import com.android.launcher3.util.rule.TISBindRule; import com.android.launcher3.widget.picker.WidgetsFullSheet; @@ -507,13 +507,9 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { private void verifyAppUninstalledFromAllApps(Workspace workspace, String appName) { final HomeAllApps allApps = workspace.switchToAllApps(); - allApps.freeze(); - try { - assertNull(appName + " app was found on all apps after being uninstalled", - allApps.tryGetAppIcon(appName)); - } finally { - allApps.unfreeze(); - } + Wait.atMost(appName + " app was found on all apps after being uninstalled", + () -> allApps.tryGetAppIcon(appName) == null, + DEFAULT_UI_TIMEOUT, mLauncher); } @Ignore("b/256615483") @@ -540,7 +536,6 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { Workspace workspace = mLauncher.getWorkspace(); final HomeAllApps allApps = workspace.switchToAllApps(); workspace = allApps.getAppIcon(DUMMY_APP_NAME).uninstall(); - waitForLauncherUIUpdate(); verifyAppUninstalledFromAllApps(workspace, DUMMY_APP_NAME); } finally { TestUtil.uninstallDummyApp();