From 439d1a89a74bdc874099da9b276524ba7954bc80 Mon Sep 17 00:00:00 2001 From: Jinhui Wang Date: Tue, 18 Apr 2017 16:42:22 -0700 Subject: Make test harness pass on large display BUG: 37484156 Change-Id: I22b76863918e0ca16cae6fb0658e4cf45838036f --- .../afwtest/uiautomator/pages/gms/EnterPasswordPage.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libs/UiAutomatorLib/src/com/android/afwtest/uiautomator/pages/gms/EnterPasswordPage.java') diff --git a/libs/UiAutomatorLib/src/com/android/afwtest/uiautomator/pages/gms/EnterPasswordPage.java b/libs/UiAutomatorLib/src/com/android/afwtest/uiautomator/pages/gms/EnterPasswordPage.java index abebc0d..96e7dcd 100644 --- a/libs/UiAutomatorLib/src/com/android/afwtest/uiautomator/pages/gms/EnterPasswordPage.java +++ b/libs/UiAutomatorLib/src/com/android/afwtest/uiautomator/pages/gms/EnterPasswordPage.java @@ -18,7 +18,9 @@ package com.android.afwtest.uiautomator.pages.gms; import static com.android.afwtest.uiautomator.Constants.GMS_NEXT_BUTTON_SELECTOR; import static com.android.afwtest.uiautomator.Constants.GMS_PKG_NAME; +import static com.android.afwtest.uiautomator.Constants.GMS_TEXT_FIELD_SELECTOR; +import android.os.SystemClock; import android.support.test.uiautomator.By; import android.support.test.uiautomator.BySelector; import android.support.test.uiautomator.UiDevice; @@ -90,6 +92,14 @@ public final class EnterPasswordPage extends UiPage { */ @Override public void navigate() throws Exception { + WidgetUtils.waitAndClick(getUiDevice(), + GMS_TEXT_FIELD_SELECTOR, + TimeUnit.SECONDS.toMillis(5)); + // Clicking the text field will bring up the keyboard and change the view hierachy of + // current screen; textField may become stale. Try to find it again before simulating + // the keyboard events. + SystemClock.sleep(TimeUnit.SECONDS.toMillis(5)); + //Enter password by key event KeyCharacterMap map = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD); KeyEvent[] events = map.getEvents(mPassword.toCharArray()); -- cgit v1.2.3