Always waiting for the drop bar to go away after an icon drag.

Should fix a test flake.

Test: affected tests
Change-Id: Icfb2a18aa625ba5435a3311d40ce30b5fdcc592e
This commit is contained in:
vadimt
2019-02-13 12:31:30 -08:00
parent bd7678635e
commit daa518f2a5
2 changed files with 16 additions and 9 deletions
@@ -74,8 +74,11 @@ class Launchable {
*/
public Workspace dragToWorkspace() {
final UiDevice device = mLauncher.getDevice();
mObject.drag(new Point(
device.getDisplayWidth() / 2, device.getDisplayHeight() / 2), DRAG_SPEED);
Workspace.dragIconToWorkspace(
mLauncher,
this,
new Point(device.getDisplayWidth() / 2, device.getDisplayHeight() / 2),
DRAG_SPEED);
return new Workspace(mLauncher);
}
}
@@ -96,7 +96,13 @@ public final class Workspace extends Home {
public void ensureWorkspaceIsScrollable() {
final UiObject2 workspace = verifyActiveContainer();
if (!isWorkspaceScrollable(workspace)) {
dragIconToNextScreen(getHotseatAppIcon("Messages"), workspace);
dragIconToWorkspace(
mLauncher,
getHotseatAppIcon("Messages"),
new Point(mLauncher.getDevice().getDisplayWidth(),
workspace.getVisibleBounds().centerY()),
ICON_DRAG_SPEED);
verifyActiveContainer();
}
assertTrue("Home screen workspace didn't become scrollable",
isWorkspaceScrollable(workspace));
@@ -112,12 +118,10 @@ public final class Workspace extends Home {
mHotseat, AppIcon.getAppIconSelector(appName, mLauncher)));
}
private void dragIconToNextScreen(AppIcon app, UiObject2 workspace) {
final Point dest = new Point(
mLauncher.getDevice().getDisplayWidth(), workspace.getVisibleBounds().centerY());
app.getObject().drag(dest, ICON_DRAG_SPEED);
mLauncher.waitUntilGone("drop_target_bar");
verifyActiveContainer();
static void dragIconToWorkspace(LauncherInstrumentation launcher, Launchable launchable,
Point dest, int icon_drag_speed) {
launchable.getObject().drag(dest, icon_drag_speed);
launcher.waitUntilGone("drop_target_bar");
}
/**