Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8568602a authored by Jon Miranda's avatar Jon Miranda
Browse files

Add back waitForStateTransitionToEnd to fix flakiness.

Bug: 202735477
Test: presubmit
Change-Id: I03c7e8b0c40177f4e6e38a7d9aa3e01b029effd6
parent f37d7a21
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -352,6 +352,14 @@ public abstract class AbstractLauncherUiTest {
                launcher -> launcher.getStateManager().getCurrentStableState() == state.get());
    }

    // Cannot be used in TaplTests between a Tapl call injecting a gesture and a tapl call
    // expecting the results of that gesture because the wait can hide flakeness.
    protected void waitForStateTransitionToEnd(String message, Supplier<LauncherState> state) {
        waitForLauncherCondition(message,
                launcher -> launcher.getStateManager().isInStableState(state.get())
                        && !launcher.getStateManager().isInTransition());
    }

    protected void waitForResumed(String message) {
        waitForLauncherCondition(message, launcher -> launcher.hasBeenResumed());
    }
+4 −2
Original line number Diff line number Diff line
@@ -62,10 +62,12 @@ public class WorkProfileTest extends AbstractLauncherUiTest {

        mDevice.pressHome();
        waitForLauncherCondition("Launcher didn't start", Objects::nonNull);
        waitForState("Launcher internal state didn't switch to Normal", () -> NORMAL);
        waitForStateTransitionToEnd("Launcher internal state didn't switch to Normal",
                () -> NORMAL);
        waitForResumed("Launcher internal state is still Background");
        executeOnLauncher(launcher -> launcher.getStateManager().goToState(ALL_APPS));
        waitForState("Launcher internal state didn't switch to All Apps", () -> ALL_APPS);
        waitForStateTransitionToEnd("Launcher internal state didn't switch to All Apps",
                () -> ALL_APPS);
    }

    @After