Waiting for Launcher stop when dropping a widget that starts an activity

This will help to ensure that Launcher state has settled before continuing the test.

Bug: 313926097
Flag: N/A
Test: presubmit
Change-Id: I810c3bd1da2839a482422396536acd664f3e4b82
This commit is contained in:
Vadim Tryshev
2023-12-06 18:46:14 -08:00
parent 0156324805
commit 4b3cc96ac2
6 changed files with 52 additions and 34 deletions
@@ -20,8 +20,6 @@ import androidx.annotation.NonNull;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.UiObject2;
import com.android.launcher3.testing.shared.TestProtocol;
/** Represents the menu of an overview task. */
public class OverviewTaskMenu {
@@ -61,12 +59,9 @@ public class OverviewTaskMenu {
try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck();
LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
"before tapping the app info menu item")) {
mLauncher.executeAndWaitForLauncherEvent(
mLauncher.executeAndWaitForLauncherStop(
() -> mLauncher.clickLauncherObject(
mLauncher.findObjectInContainer(mMenu, By.text("App info"))),
event -> TestProtocol.LAUNCHER_ACTIVITY_STOPPED_MESSAGE
.equals(event.getClassName().toString()),
() -> "Launcher activity didn't stop",
"tapped app info menu item");
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(