Commit f62ebc4f authored by Javier Ernesto Flores Robles's avatar Javier Ernesto Flores Robles Committed by Commit Bot

Reland "[iOS][MF] Fix search in all passwords"

This is a reland of b400d6c7

The reason for the revert was that the test failing on the slimnav bot. This
is a legacy bot and runs with the feature off.

After investigating, it turns out it is a bug in Earl Grey where it is waiting
for a view controller to dismiss.

Since slim-navigation is not related to the failure, this CL disables the
test when slim-navigation is off, and relands the fix.

Original change's description:
> [iOS][MF] Fix search in all passwords
>
> If the password view controller was presenting something, it will stay
> around. This is fixed and a test is added.
>
> Bug: 1008421
> Change-Id: I8248cbbf28be94bc4b84c65ccda42129a192db0b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1826895
> Commit-Queue: Javier Ernesto Flores Robles <javierrobles@chromium.org>
> Reviewed-by: Olivier Robin <olivierrobin@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#702358}

Bug: 1008421
Change-Id: If336b1cc5b4d6427125921d01b636b0726b860f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1844979Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Commit-Queue: Javier Ernesto Flores Robles <javierrobles@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704143}
parent 0a9044e7
......@@ -75,7 +75,8 @@
}
- (void)stop {
[self.passwordViewController dismissViewControllerAnimated:YES
[self.passwordViewController.presentingViewController
dismissViewControllerAnimated:YES
completion:nil];
self.passwordViewController = nil;
self.passwordMediator = nil;
......
......@@ -31,6 +31,7 @@
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/web/public/test/earl_grey/web_view_matchers.h"
#include "ios/web/public/test/element_selector.h"
#import "ios/web/public/web_client.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "url/gurl.h"
......@@ -527,6 +528,45 @@ BOOL WaitForJavaScriptCondition(NSString* java_script_condition) {
}
}
// Test that after searching in "Use Other Password" and selecting an option,
// the screen is dismissed.
- (void)testOtherPasswordsDismissAfterSearch {
// This test is failing on a legacy bot. Return early if running there.
if (![ChromeEarlGrey isSlimNavigationManagerEnabled]) {
EARL_GREY_TEST_SKIPPED(@"Skipped for Slim Navigation off.");
}
// Bring up the keyboard.
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:TapWebElementWithId(kFormElementUsername)];
// Tap the passwords icon.
[[EarlGrey selectElementWithMatcher:PasswordIconMatcher()]
performAction:grey_tap()];
// Tap "Use Other Password...".
[[EarlGrey selectElementWithMatcher:OtherPasswordsMatcher()]
performAction:grey_tap()];
// Verify "Use Other Passwords" opened.
[[EarlGrey selectElementWithMatcher:OtherPasswordsDismissMatcher()]
assertWithMatcher:grey_sufficientlyVisible()];
// Tap the password search bar.
[[EarlGrey selectElementWithMatcher:PasswordSearchBarMatcher()]
performAction:grey_typeText(@"user")];
// Select a username.
[[EarlGrey selectElementWithMatcher:UsernameButtonMatcher()]
performAction:grey_tap()];
// Verify the password list disappears.
[[EarlGrey selectElementWithMatcher:PasswordSearchBarMatcher()]
assertWithMatcher:grey_nil()];
[[EarlGrey selectElementWithMatcher:OtherPasswordsMatcher()]
assertWithMatcher:grey_nil()];
}
// Tests that the Password View Controller is dismissed when tapping the
// keyboard icon.
- (void)testKeyboardIconDismissPasswordController {
......
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