Not treating "Screen is empty" as an anomaly in NavigationModeSwitchRule
It's an acceptable state when Launcher just starts under instrumentation. Change-Id: Ia6eb2550effbd9236bb955e0c0e04416fc5fa506
This commit is contained in:
parent
e6691f34c1
commit
09ce192b4e
|
@ -30,6 +30,7 @@ import android.content.Context;
|
|||
import android.content.pm.PackageManager;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.test.uiautomator.By;
|
||||
import androidx.test.uiautomator.UiDevice;
|
||||
|
||||
import com.android.launcher3.tapl.LauncherInstrumentation;
|
||||
|
@ -80,7 +81,12 @@ public class NavigationModeSwitchRule implements TestRule {
|
|||
Mode mode = description.getAnnotation(NavigationModeSwitch.class).mode();
|
||||
return new Statement() {
|
||||
private void assertTrue(String message, boolean condition) {
|
||||
mLauncher.checkForAnomaly();
|
||||
if (mLauncher.getDevice().hasObject(By.textStartsWith(""))) {
|
||||
// The condition above is "screen is not empty". We are not treating
|
||||
// "Screen is empty" as an anomaly here. It's an acceptable state when
|
||||
// Launcher just starts under instrumentation.
|
||||
mLauncher.checkForAnomaly();
|
||||
}
|
||||
if (!condition) {
|
||||
final AssertionError assertionError = new AssertionError(message);
|
||||
FailureWatcher.onError(mLauncher.getDevice(), description, assertionError);
|
||||
|
|
Loading…
Reference in New Issue