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

This commit is contained in:
Alex Chau
2021-11-04 17:43:35 +00:00
committed by Android (Google) Code Review
2 changed files with 10 additions and 4 deletions

View File

@@ -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());
}

View File

@@ -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);