Commit 60ad12a4 authored by sandromaggi's avatar sandromaggi Committed by Commit Bot

[Autofill Assistant] Attempt to fix flaky test

The reason for making a "snapshot" check on the keyboard is
(or was) to check against the following scenario:
* Keyboard showed up
* Keyboard was suppressed and hidden

The "snapshot" does not guard better than the waiting in this
case. Waiting for the keyboard should prove to be more stable
because it also covers cases where the keyboard is not yet
open but will appear in a short while.

The case where the keyboard is suppressed is not properly
covered in both cases.

Bug: 1108350
Change-Id: I196782916c4d35376d8d2afd6ab46f91265e0f19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2314177Reviewed-by: default avatarLuca Hunkeler <hluca@google.com>
Commit-Queue: Sandro Maggi <sandromaggi@google.com>
Cr-Commit-Position: refs/heads/master@{#791195}
parent 7de6023f
......@@ -16,10 +16,10 @@ import static androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibilit
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
import static org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiTestUtil.waitUntilKeyboardMatchesCondition;
import static org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiTestUtil.waitUntilViewAssertionTrue;
import static org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiTestUtil.waitUntilViewMatchesCondition;
import static org.chromium.content_public.browser.test.util.CriteriaHelper.DEFAULT_MAX_TIME_TO_POLL;
......@@ -38,7 +38,6 @@ import org.junit.runner.RunWith;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Restriction;
import org.chromium.chrome.browser.ChromeTabbedActivity;
import org.chromium.chrome.browser.autofill_assistant.proto.ActionProto;
import org.chromium.chrome.browser.autofill_assistant.proto.ChipProto;
import org.chromium.chrome.browser.autofill_assistant.proto.PromptProto;
......@@ -335,11 +334,7 @@ public class AutofillAssistantChromeTabIntegrationTest {
// Clicking location bar hides UI and shows the keyboard.
onView(withId(org.chromium.chrome.R.id.url_bar)).perform(click());
waitUntilViewAssertionTrue(withText("Prompt"), doesNotExist(), DEFAULT_MAX_TIME_TO_POLL);
ChromeTabbedActivity activity = mTestRule.getActivity();
assertThat(activity.getWindowAndroid().getKeyboardDelegate().isKeyboardShowing(
activity, activity.getCompositorViewHolder()),
is(true));
waitUntilKeyboardMatchesCondition(mTestRule, /* isShowing= */ true);
// Closing keyboard brings it back.
Espresso.pressBack();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment