Hopefully reducing flakes by waiting for SysUI objects
Looks like when orientation change is involved, it takes some time for SysUI object to reappear. Change-Id: Id08d385ea1a535d8bcd87b123f0373cd28d90a92
This commit is contained in:
parent
9893578356
commit
2ec9f290bf
|
@ -71,7 +71,7 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
|
||||||
|
|
||||||
mLauncher.swipe(centerX, startY, centerX, startY - swipeHeight - slop, expectedState);
|
mLauncher.swipe(centerX, startY, centerX, startY - swipeHeight - slop, expectedState);
|
||||||
} else {
|
} else {
|
||||||
mLauncher.getSystemUiObject("recent_apps").click();
|
mLauncher.waitForSystemUiObject("recent_apps").click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +80,6 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getSwipeStartY() {
|
protected int getSwipeStartY() {
|
||||||
return mLauncher.getSystemUiObject("home").getVisibleBounds().centerY();
|
return mLauncher.waitForSystemUiObject("home").getVisibleBounds().centerY();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,7 +288,7 @@ public final class LauncherInstrumentation {
|
||||||
executeAndWaitForEvent(
|
executeAndWaitForEvent(
|
||||||
() -> {
|
() -> {
|
||||||
log("LauncherInstrumentation.pressHome before clicking");
|
log("LauncherInstrumentation.pressHome before clicking");
|
||||||
getSystemUiObject("home").click();
|
waitForSystemUiObject("home").click();
|
||||||
},
|
},
|
||||||
event -> true,
|
event -> true,
|
||||||
"Pressing Home didn't produce any events");
|
"Pressing Home didn't produce any events");
|
||||||
|
@ -298,7 +298,7 @@ public final class LauncherInstrumentation {
|
||||||
executeAndWaitForEvent(
|
executeAndWaitForEvent(
|
||||||
() -> {
|
() -> {
|
||||||
log("LauncherInstrumentation.pressHome before clicking");
|
log("LauncherInstrumentation.pressHome before clicking");
|
||||||
getSystemUiObject("home").click();
|
waitForSystemUiObject("home").click();
|
||||||
},
|
},
|
||||||
event -> true,
|
event -> true,
|
||||||
"Pressing Home didn't produce any events");
|
"Pressing Home didn't produce any events");
|
||||||
|
@ -394,8 +394,9 @@ public final class LauncherInstrumentation {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
UiObject2 getSystemUiObject(String resId) {
|
UiObject2 waitForSystemUiObject(String resId) {
|
||||||
final UiObject2 object = mDevice.findObject(By.res(SYSTEMUI_PACKAGE, resId));
|
final UiObject2 object = mDevice.wait(
|
||||||
|
Until.findObject(By.res(SYSTEMUI_PACKAGE, resId)), WAIT_TIME_MS);
|
||||||
assertNotNull("Can't find a systemui object with id: " + resId, object);
|
assertNotNull("Can't find a systemui object with id: " + resId, object);
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ public final class Overview extends BaseOverview {
|
||||||
verifyActiveContainer();
|
verifyActiveContainer();
|
||||||
|
|
||||||
// Swipe from navbar to the top.
|
// Swipe from navbar to the top.
|
||||||
final UiObject2 navBar = mLauncher.getSystemUiObject("navigation_bar_frame");
|
final UiObject2 navBar = mLauncher.waitForSystemUiObject("navigation_bar_frame");
|
||||||
final Point start = navBar.getVisibleCenter();
|
final Point start = navBar.getVisibleCenter();
|
||||||
LauncherInstrumentation.log("Overview.switchToAllApps before swipe");
|
LauncherInstrumentation.log("Overview.switchToAllApps before swipe");
|
||||||
mLauncher.swipe(start.x, start.y, start.x, 0, ALL_APPS_STATE_ORDINAL);
|
mLauncher.swipe(start.x, start.y, start.x, 0, ALL_APPS_STATE_ORDINAL);
|
||||||
|
|
Loading…
Reference in New Issue