From 0edb04ca248da66e3013690be6fd73f9d472d3a4 Mon Sep 17 00:00:00 2001 From: vadimt Date: Mon, 13 May 2019 18:28:19 -0700 Subject: [PATCH] Fixing flakiness of widget tests Change-Id: I1af6a733a3a7a89899c83d6714117ff9a51528d2 --- tests/src/com/android/launcher3/ui/TestViewHelpers.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/src/com/android/launcher3/ui/TestViewHelpers.java b/tests/src/com/android/launcher3/ui/TestViewHelpers.java index 2116f5e2d5..a73bde0116 100644 --- a/tests/src/com/android/launcher3/ui/TestViewHelpers.java +++ b/tests/src/com/android/launcher3/ui/TestViewHelpers.java @@ -27,6 +27,7 @@ import android.graphics.Point; import android.os.Process; import android.os.SystemClock; import android.util.Log; +import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; @@ -186,10 +187,8 @@ public class TestViewHelpers { */ public static UiObject2 openWidgetsTray() { final UiDevice device = getDevice(); - device.pressMenu(); // Enter overview mode. - device.wait(Until.findObject( - By.text(getTargetContext().getString(R.string.widget_button_text))), - AbstractLauncherUiTest.DEFAULT_UI_TIMEOUT).click(); + device.pressKeyCode(KeyEvent.KEYCODE_W, KeyEvent.META_CTRL_ON); + device.waitForIdle(); return findViewById(R.id.widgets_list_view); }