Commit 917cf4f6 authored by Jérôme Lebel's avatar Jérôme Lebel Committed by Commit Bot

[iOS] Fixing EarlGrey helpers for unified consent

+ Earlgrey cannot scroll down a scroll view that doesn't bounce. To work
around the issue, the unified consent is now always bouncing, even when
the content is smaller than the screen.

+ Whlie selecting an identity to sign-in, EarlGrey finds the right label
to find with the right email address, but it also finds the button in
the view behind the modal dialog box, with the right email address.
To fix that, the matcher is now on the cell using the accessibility
identifier.
https://screenshot.googleplex.com/bd7p1JtcE0n

Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I03d77e0e53bf29dec19d13a535cd08ebe46857c5
Reviewed-on: https://chromium-review.googlesource.com/1145279Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577158}
parent 366032e4
......@@ -182,6 +182,7 @@ source_set("eg_test_support") {
"//ios/chrome/browser/browser_state",
"//ios/chrome/browser/signin",
"//ios/chrome/browser/ui/authentication/unified_consent:unified_consent_ui",
"//ios/chrome/browser/ui/authentication/unified_consent/identity_chooser:identity_chooser_ui",
"//ios/chrome/test/app:test_support",
"//ios/chrome/test/earl_grey:test_support",
"//ios/public/provider/chrome/browser/signin",
......
......@@ -9,6 +9,7 @@
#include "components/unified_consent/feature.h"
#include "ios/chrome/browser/ui/authentication/signin_confirmation_view_controller.h"
#import "ios/chrome/browser/ui/authentication/signin_earlgrey_utils.h"
#import "ios/chrome/browser/ui/authentication/unified_consent/identity_chooser/identity_chooser_cell.h"
#import "ios/chrome/browser/ui/authentication/unified_consent/identity_picker_view.h"
#import "ios/chrome/browser/ui/authentication/unified_consent/unified_consent_view_controller.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
......@@ -41,9 +42,11 @@ using chrome_test_util::SettingsDoneButton;
kIdentityPickerViewIdentifier)]
performAction:grey_tap()];
[[EarlGrey
selectElementWithMatcher:grey_allOf(grey_accessibilityLabel(
identity.userEmail),
grey_sufficientlyVisible(), nil)]
selectElementWithMatcher:grey_allOf(
grey_accessibilityID(identity.userEmail),
grey_kindOfClass(
[IdentityChooserCell class]),
grey_sufficientlyVisible(), nil)]
performAction:grey_tap()];
} else {
[self selectIdentityWithEmail:identity.userEmail];
......
......@@ -73,4 +73,9 @@ const CGFloat kCheckmarkMagin = 26.;
}
}
- (void)prepareForReuse {
[super prepareForReuse];
self.accessibilityIdentifier = nil;
}
@end
......@@ -35,6 +35,7 @@
title = subtitle;
subtitle = nil;
}
cell.accessibilityIdentifier = self.email;
[cell configureCellWithTitle:title
subtitle:subtitle
image:self.avatar
......
......@@ -171,6 +171,7 @@ NSString* const kSyncCompleteIconName = @"ic_sync_complete";
self.scrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds];
self.scrollView.translatesAutoresizingMaskIntoConstraints = NO;
self.scrollView.accessibilityIdentifier = kUnifiedConsentScrollViewIdentifier;
self.scrollView.alwaysBounceVertical = YES;
if (@available(iOS 11, *)) {
// The observed behavior was buggy. When the view appears on the screen,
// the scrollvie was not scrolled all the way to the top. Adjusting the
......
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