Commit 265127e1 authored by Clemens Arbesser's avatar Clemens Arbesser Committed by Commit Bot

[Autofill Assistant] Close keyboard before closing dialog.

Closing the keyboard before attempting to click the button should
finally fix those flaky tests.

Bug: 1087042
Bug: 1084324
Change-Id: Iae013984e3b844eb665aac7f363f2111f139e378
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2218834
Commit-Queue: Sandro Maggi <sandromaggi@google.com>
Reviewed-by: default avatarSandro Maggi <sandromaggi@google.com>
Cr-Commit-Position: refs/heads/master@{#773064}
parent ec3e6d4a
...@@ -50,7 +50,6 @@ import org.junit.Test; ...@@ -50,7 +50,6 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.DisabledTest;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;
import org.chromium.chrome.browser.autofill_assistant.proto.ActionProto; import org.chromium.chrome.browser.autofill_assistant.proto.ActionProto;
...@@ -105,7 +104,6 @@ public class AutofillAssistantPersonalDataManagerTest { ...@@ -105,7 +104,6 @@ public class AutofillAssistantPersonalDataManagerTest {
*/ */
@Test @Test
@MediumTest @MediumTest
@DisabledTest(message = "crbug.com/1087042")
public void testCreateAndEnterProfile() throws Exception { public void testCreateAndEnterProfile() throws Exception {
ArrayList<ActionProto> list = new ArrayList<>(); ArrayList<ActionProto> list = new ArrayList<>();
list.add( list.add(
...@@ -164,6 +162,7 @@ public class AutofillAssistantPersonalDataManagerTest { ...@@ -164,6 +162,7 @@ public class AutofillAssistantPersonalDataManagerTest {
waitUntilViewMatchesCondition( waitUntilViewMatchesCondition(
withContentDescription("Email*"), allOf(isDisplayed(), isEnabled())); withContentDescription("Email*"), allOf(isDisplayed(), isEnabled()));
onView(withContentDescription("Email*")).perform(typeText("johndoe@google.com")); onView(withContentDescription("Email*")).perform(typeText("johndoe@google.com"));
Espresso.closeSoftKeyboard();
onView(withId(org.chromium.chrome.R.id.editor_dialog_done_button)) onView(withId(org.chromium.chrome.R.id.editor_dialog_done_button))
.perform(scrollTo(), click()); .perform(scrollTo(), click());
waitUntilViewMatchesCondition(withText("Continue"), isEnabled()); waitUntilViewMatchesCondition(withText("Continue"), isEnabled());
...@@ -181,7 +180,6 @@ public class AutofillAssistantPersonalDataManagerTest { ...@@ -181,7 +180,6 @@ public class AutofillAssistantPersonalDataManagerTest {
*/ */
@Test @Test
@MediumTest @MediumTest
@DisabledTest(message = "crbug.com/1087042")
public void testCreateAndEditProfileMultipleTimes() throws Exception { public void testCreateAndEditProfileMultipleTimes() throws Exception {
ArrayList<ActionProto> list = new ArrayList<>(); ArrayList<ActionProto> list = new ArrayList<>();
list.add( list.add(
...@@ -215,6 +213,7 @@ public class AutofillAssistantPersonalDataManagerTest { ...@@ -215,6 +213,7 @@ public class AutofillAssistantPersonalDataManagerTest {
waitUntilViewMatchesCondition( waitUntilViewMatchesCondition(
withContentDescription("Email*"), allOf(isDisplayed(), isEnabled())); withContentDescription("Email*"), allOf(isDisplayed(), isEnabled()));
onView(withContentDescription("Email*")).perform(typeText("doe@google.com")); onView(withContentDescription("Email*")).perform(typeText("doe@google.com"));
Espresso.closeSoftKeyboard();
onView(withId(org.chromium.chrome.R.id.editor_dialog_done_button)) onView(withId(org.chromium.chrome.R.id.editor_dialog_done_button))
.perform(scrollTo(), click()); .perform(scrollTo(), click());
waitUntilViewMatchesCondition(withText("Continue"), isEnabled()); waitUntilViewMatchesCondition(withText("Continue"), isEnabled());
...@@ -224,6 +223,7 @@ public class AutofillAssistantPersonalDataManagerTest { ...@@ -224,6 +223,7 @@ public class AutofillAssistantPersonalDataManagerTest {
onView(withContentDescription("Edit contact info")).perform(click()); onView(withContentDescription("Edit contact info")).perform(click());
waitUntilViewMatchesCondition( waitUntilViewMatchesCondition(
withContentDescription("Name*"), allOf(isDisplayed(), isEnabled())); withContentDescription("Name*"), allOf(isDisplayed(), isEnabled()));
Espresso.closeSoftKeyboard();
onView(withId(org.chromium.chrome.R.id.editor_dialog_done_button)) onView(withId(org.chromium.chrome.R.id.editor_dialog_done_button))
.perform(scrollTo(), click()); .perform(scrollTo(), click());
...@@ -232,6 +232,7 @@ public class AutofillAssistantPersonalDataManagerTest { ...@@ -232,6 +232,7 @@ public class AutofillAssistantPersonalDataManagerTest {
waitUntilViewMatchesCondition( waitUntilViewMatchesCondition(
withContentDescription("Name*"), allOf(isDisplayed(), isEnabled())); withContentDescription("Name*"), allOf(isDisplayed(), isEnabled()));
onView(withContentDescription("Name*")).perform(clearText(), typeText("Jane Doe")); onView(withContentDescription("Name*")).perform(clearText(), typeText("Jane Doe"));
Espresso.closeSoftKeyboard();
onView(withId(org.chromium.chrome.R.id.editor_dialog_done_button)) onView(withId(org.chromium.chrome.R.id.editor_dialog_done_button))
.perform(scrollTo(), click()); .perform(scrollTo(), click());
...@@ -460,6 +461,7 @@ public class AutofillAssistantPersonalDataManagerTest { ...@@ -460,6 +461,7 @@ public class AutofillAssistantPersonalDataManagerTest {
onView(withContentDescription("Email*")) onView(withContentDescription("Email*"))
.perform(clearText()) .perform(clearText())
.perform(typeText("janedoe@google.com")); .perform(typeText("janedoe@google.com"));
Espresso.closeSoftKeyboard();
onView(withId(org.chromium.chrome.R.id.editor_dialog_done_button)) onView(withId(org.chromium.chrome.R.id.editor_dialog_done_button))
.perform(scrollTo(), click()); .perform(scrollTo(), click());
waitUntilViewMatchesCondition(withText("Contact info"), isDisplayed()); waitUntilViewMatchesCondition(withText("Contact info"), isDisplayed());
...@@ -540,6 +542,7 @@ public class AutofillAssistantPersonalDataManagerTest { ...@@ -540,6 +542,7 @@ public class AutofillAssistantPersonalDataManagerTest {
.atPosition(1 /* address of Adam, 0 is SELECT (empty) */) .atPosition(1 /* address of Adam, 0 is SELECT (empty) */)
.inRoot(withDecorView(withClassName(containsString("Popup")))) .inRoot(withDecorView(withClassName(containsString("Popup"))))
.perform(click()); .perform(click());
Espresso.closeSoftKeyboard();
onView(withId(org.chromium.chrome.R.id.editor_dialog_done_button)) onView(withId(org.chromium.chrome.R.id.editor_dialog_done_button))
.perform(scrollTo(), click()); .perform(scrollTo(), click());
waitUntilViewMatchesCondition(allOf(withId(R.id.credit_card_number), waitUntilViewMatchesCondition(allOf(withId(R.id.credit_card_number),
...@@ -691,6 +694,7 @@ public class AutofillAssistantPersonalDataManagerTest { ...@@ -691,6 +694,7 @@ public class AutofillAssistantPersonalDataManagerTest {
.atPosition(3) .atPosition(3)
.inRoot(withDecorView(withClassName(containsString("Popup")))) .inRoot(withDecorView(withClassName(containsString("Popup"))))
.perform(click()); .perform(click());
Espresso.closeSoftKeyboard();
onView(withId(org.chromium.chrome.R.id.editor_dialog_done_button)) onView(withId(org.chromium.chrome.R.id.editor_dialog_done_button))
.perform(scrollTo(), click()); .perform(scrollTo(), click());
// Updating the card does not collapse the card section. // Updating the card does not collapse the card section.
......
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