Commit ca83da12 authored by Ioana Pandele's avatar Ioana Pandele Committed by Commit Bot

[Android] Fix password generation integration tests

The manual generation tests were broken because the tab view in the keyboard
accessory could not be found. This CL changes the matcher used.

All tests used to depend on server predictions for filling, which marked
the field as eligible for generation or not. This broke when the predictions
where not as expected.

Bug: 1010540, 1010344

Change-Id: I8ca5392d80b81a67d414eec33cc7a7a2e282d725
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1995273
Commit-Queue: Ioana Pandele <ioanap@chromium.org>
Reviewed-by: default avatarFriedrich [CET] <fhorschig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732423}
parent 2cbdd2c0
...@@ -15,6 +15,8 @@ import static org.hamcrest.core.AllOf.allOf; ...@@ -15,6 +15,8 @@ import static org.hamcrest.core.AllOf.allOf;
import static org.chromium.chrome.R.id.password_generation_dialog; import static org.chromium.chrome.R.id.password_generation_dialog;
import static org.chromium.chrome.browser.keyboard_accessory.ManualFillingTestHelper.selectTabAtPosition; import static org.chromium.chrome.browser.keyboard_accessory.ManualFillingTestHelper.selectTabAtPosition;
import static org.chromium.chrome.browser.keyboard_accessory.ManualFillingTestHelper.whenDisplayed;
import static org.chromium.chrome.browser.keyboard_accessory.tab_layout_component.KeyboardAccessoryTabTestHelper.isKeyboardAccessoryTabLayout;
import android.view.Window; import android.view.Window;
import android.widget.TextView; import android.widget.TextView;
...@@ -27,7 +29,6 @@ import org.junit.Test; ...@@ -27,7 +29,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.base.test.util.IntegrationTest; import org.chromium.base.test.util.IntegrationTest;
import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.infobar.InfoBarContainer; import org.chromium.chrome.browser.infobar.InfoBarContainer;
...@@ -66,6 +67,7 @@ public class PasswordGenerationIntegrationTest { ...@@ -66,6 +67,7 @@ public class PasswordGenerationIntegrationTest {
@Before @Before
public void setUp() throws InterruptedException { public void setUp() throws InterruptedException {
mSyncTestRule.setUpTestAccountAndSignIn(); mSyncTestRule.setUpTestAccountAndSignIn();
ManualFillingTestHelper.disableServerPredictions();
mHelper.loadTestPage(FORM_URL, false); mHelper.loadTestPage(FORM_URL, false);
} }
...@@ -94,7 +96,6 @@ public class PasswordGenerationIntegrationTest { ...@@ -94,7 +96,6 @@ public class PasswordGenerationIntegrationTest {
@Test @Test
@IntegrationTest @IntegrationTest
@DisabledTest(message = "crbug.com/1010540")
public void testManualGenerationCancel() throws InterruptedException, TimeoutException { public void testManualGenerationCancel() throws InterruptedException, TimeoutException {
waitForGenerationLabel(); waitForGenerationLabel();
focusField(PASSWORD_NODE_ID_MANUAL); focusField(PASSWORD_NODE_ID_MANUAL);
...@@ -109,7 +110,6 @@ public class PasswordGenerationIntegrationTest { ...@@ -109,7 +110,6 @@ public class PasswordGenerationIntegrationTest {
@Test @Test
@IntegrationTest @IntegrationTest
@DisabledTest(message = "crbug.com/1010344")
public void testAutomaticGenerationUsePassword() throws InterruptedException, TimeoutException { public void testAutomaticGenerationUsePassword() throws InterruptedException, TimeoutException {
waitForGenerationLabel(); waitForGenerationLabel();
focusField(PASSWORD_NODE_ID); focusField(PASSWORD_NODE_ID);
...@@ -131,7 +131,6 @@ public class PasswordGenerationIntegrationTest { ...@@ -131,7 +131,6 @@ public class PasswordGenerationIntegrationTest {
@Test @Test
@IntegrationTest @IntegrationTest
@DisabledTest(message = "crbug.com/1010540")
public void testManualGenerationUsePassword() throws InterruptedException, TimeoutException { public void testManualGenerationUsePassword() throws InterruptedException, TimeoutException {
waitForGenerationLabel(); waitForGenerationLabel();
focusField(PASSWORD_NODE_ID_MANUAL); focusField(PASSWORD_NODE_ID_MANUAL);
...@@ -148,13 +147,14 @@ public class PasswordGenerationIntegrationTest { ...@@ -148,13 +147,14 @@ public class PasswordGenerationIntegrationTest {
} }
public void pressManualGenerationSuggestion() { public void pressManualGenerationSuggestion() {
onView(allOf(isDescendantOfA(withId(R.id.passwords_sheet)), whenDisplayed(allOf(isDescendantOfA(withId(R.id.passwords_sheet)),
withText(R.string.password_generation_accessory_button))) withText(R.string.password_generation_accessory_button)))
.perform(click()); .perform(click());
} }
public void toggleAccessorySheet() { public void toggleAccessorySheet() {
mHelper.waitForViewOnActivityRoot(withId(R.id.tabs)).perform(selectTabAtPosition(0)); mHelper.waitForViewOnActivityRoot(isKeyboardAccessoryTabLayout())
.perform(selectTabAtPosition(0));
} }
public void focusField(String node) throws TimeoutException, InterruptedException { public void focusField(String node) throws TimeoutException, InterruptedException {
......
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