Merge "Testing to see if using isInStableState is better condition vs getCurrentStableState" into sc-v2-dev am: a917d24d2b

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/16184044

Change-Id: I03c254acdfc75a256365cc220c6f41189033db65
This commit is contained in:
Alex Chau
2021-11-04 18:10:58 +00:00
committed by Automerger Merge Worker
2 changed files with 10 additions and 4 deletions
@@ -346,13 +346,19 @@ public abstract class AbstractLauncherUiTest {
}
// 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.
// expecting the results of that gesture because the wait can hide flakeness.
protected void waitForState(String message, Supplier<LauncherState> state) {
waitForLauncherCondition(message,
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 waitForStableState(String message, Supplier<LauncherState> state) {
waitForLauncherCondition(message,
launcher -> launcher.getStateManager().isInStableState(state.get()));
}
protected void waitForResumed(String message) {
waitForLauncherCondition(message, launcher -> launcher.hasBeenResumed());
}
@@ -91,9 +91,9 @@ public class WorkProfileTest extends AbstractLauncherUiTest {
public void workTabExists() {
mDevice.pressHome();
waitForLauncherCondition("Launcher didn't start", Objects::nonNull);
waitForState("Launcher internal state didn't switch to Normal", () -> NORMAL);
waitForStableState("Launcher internal state didn't switch to Normal", () -> NORMAL);
executeOnLauncher(launcher -> launcher.getStateManager().goToState(ALL_APPS));
waitForState("Launcher internal state didn't switch to All Apps", () -> ALL_APPS);
waitForStableState("Launcher internal state didn't switch to All Apps", () -> ALL_APPS);
waitForLauncherCondition("Personal tab is missing",
launcher -> launcher.getAppsView().isPersonalTabVisible(),
LauncherInstrumentation.WAIT_TIME_MS);