Commit 9a8ec8bd authored by Jérôme Lebel's avatar Jérôme Lebel Committed by Commit Bot

[iOS] Adding +[SigninEarlGreyUI tapAddAccountButton] helper

Adding:
  +[SigninEarlGreyUI tapAddAccountButton] helper
  chrome_test_util::UnifiedConsentAddAccountButton()

Needed for:
  crrev.com/i/1148950
  crrev.com/i/1366448

Bug: 944180
Change-Id: Ifc321fb59a86a89111a3c32be62665da4d1e45ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1649155
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#667365}
parent ff8b40b7
...@@ -29,6 +29,11 @@ ...@@ -29,6 +29,11 @@
// visible on short devices (e.g. iPhone 5s). // visible on short devices (e.g. iPhone 5s).
+ (void)confirmSigninConfirmationDialog; + (void)confirmSigninConfirmationDialog;
// Taps on the "ADD ACCOUNT" button in the unified consent, to display the
// SSO dialog.
// This method should only be used with UnifiedConsent flag.
+ (void)tapAddAccountButton;
// Checks that the sign-in promo view (with a close button) is visible using the // Checks that the sign-in promo view (with a close button) is visible using the
// right mode. // right mode.
+ (void)checkSigninPromoVisibleWithMode:(SigninPromoViewMode)mode; + (void)checkSigninPromoVisibleWithMode:(SigninPromoViewMode)mode;
......
...@@ -51,6 +51,7 @@ using chrome_test_util::ButtonWithAccessibilityLabel; ...@@ -51,6 +51,7 @@ using chrome_test_util::ButtonWithAccessibilityLabel;
using chrome_test_util::PrimarySignInButton; using chrome_test_util::PrimarySignInButton;
using chrome_test_util::SecondarySignInButton; using chrome_test_util::SecondarySignInButton;
using chrome_test_util::SettingsDoneButton; using chrome_test_util::SettingsDoneButton;
using chrome_test_util::UnifiedConsentAddAccountButton;
@implementation SigninEarlGreyUI @implementation SigninEarlGreyUI
...@@ -137,6 +138,31 @@ using chrome_test_util::SettingsDoneButton; ...@@ -137,6 +138,31 @@ using chrome_test_util::SettingsDoneButton;
performAction:grey_tap()]; performAction:grey_tap()];
} }
+ (void)tapAddAccountButton {
GREYAssertTrue(unified_consent::IsUnifiedConsentFeatureEnabled(),
@"-[SigninEarlGreyUI tapAddAccountButton] is not available "
@"without UnifiedConsent flag");
id<GREYMatcher> confirmationScrollViewMatcher =
grey_accessibilityID(kUnifiedConsentScrollViewIdentifier);
[[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
NSError* error = nil;
[[EarlGrey selectElementWithMatcher:confirmationScrollViewMatcher]
assertWithMatcher:ContentViewSmallerThanScrollView()
error:&error];
if (error) {
// If the consent is bigger than the scroll view, the primary button should
// be "MORE".
[[EarlGrey selectElementWithMatcher:
chrome_test_util::ButtonWithAccessibilityLabelId(
IDS_IOS_ACCOUNT_CONSISTENCY_CONFIRMATION_SCROLL_BUTTON)]
assertWithMatcher:grey_notNil()];
[[EarlGrey selectElementWithMatcher:confirmationScrollViewMatcher]
performAction:grey_scrollToContentEdge(kGREYContentEdgeBottom)];
}
[[EarlGrey selectElementWithMatcher:UnifiedConsentAddAccountButton()]
performAction:grey_tap()];
}
+ (void)checkSigninPromoVisibleWithMode:(SigninPromoViewMode)mode { + (void)checkSigninPromoVisibleWithMode:(SigninPromoViewMode)mode {
[self checkSigninPromoVisibleWithMode:mode closeButton:YES]; [self checkSigninPromoVisibleWithMode:mode closeButton:YES];
} }
......
...@@ -46,13 +46,6 @@ id<GREYMatcher> identityChooserButtonMatcherWithEmail(NSString* userEmail) { ...@@ -46,13 +46,6 @@ id<GREYMatcher> identityChooserButtonMatcherWithEmail(NSString* userEmail) {
grey_sufficientlyVisible(), nil); grey_sufficientlyVisible(), nil);
} }
// Returns a matcher for "ADD ACCOUNT" in IdentityChooserViewController.
id<GREYMatcher> addIdentityButtonInIdentityChooser() {
return chrome_test_util::ButtonWithAccessibilityLabel(
l10n_util::GetNSStringWithFixup(
IDS_IOS_ACCOUNT_UNIFIED_CONSENT_ADD_ACCOUNT));
}
// Opens Accounts Settings and tap the sign out button. Assumes that the main // Opens Accounts Settings and tap the sign out button. Assumes that the main
// settings page is visible. // settings page is visible.
void SignOutFromSettings() { void SignOutFromSettings() {
...@@ -93,8 +86,7 @@ void SignOutFromSettings() { ...@@ -93,8 +86,7 @@ void SignOutFromSettings() {
[ChromeEarlGreyUI tapSettingsMenuButton:PrimarySignInButton()]; [ChromeEarlGreyUI tapSettingsMenuButton:PrimarySignInButton()];
[[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; [[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
// Tap on "ADD ACCOUNT". // Tap on "ADD ACCOUNT".
[[EarlGrey selectElementWithMatcher:addIdentityButtonInIdentityChooser()] [SigninEarlGreyUI tapAddAccountButton];
performAction:grey_tap()];
// Check for the fake SSO screen. // Check for the fake SSO screen.
WaitForMatcher(grey_accessibilityID(kFakeAddAccountViewIdentifier)); WaitForMatcher(grey_accessibilityID(kFakeAddAccountViewIdentifier));
// Close the SSO view controller. // Close the SSO view controller.
......
...@@ -128,6 +128,9 @@ id<GREYMatcher> AccountConsistencySetupSigninButton(); ...@@ -128,6 +128,9 @@ id<GREYMatcher> AccountConsistencySetupSigninButton();
// Returns matcher for the account consistency confirmation button. // Returns matcher for the account consistency confirmation button.
id<GREYMatcher> AccountConsistencyConfirmationOkButton(); id<GREYMatcher> AccountConsistencyConfirmationOkButton();
// Returns matcher for "ADD ACCOUNT" button in unified consent dialog.
id<GREYMatcher> UnifiedConsentAddAccountButton();
// Returns matcher for the add account accounts button. // Returns matcher for the add account accounts button.
id<GREYMatcher> AddAccountButton(); id<GREYMatcher> AddAccountButton();
......
...@@ -165,6 +165,10 @@ id<GREYMatcher> AccountConsistencyConfirmationOkButton() { ...@@ -165,6 +165,10 @@ id<GREYMatcher> AccountConsistencyConfirmationOkButton() {
return [ChromeMatchersAppInterface accountConsistencyConfirmationOKButton]; return [ChromeMatchersAppInterface accountConsistencyConfirmationOKButton];
} }
id<GREYMatcher> UnifiedConsentAddAccountButton() {
return [ChromeMatchersAppInterface unifiedConsentAddAccountButton];
}
id<GREYMatcher> AddAccountButton() { id<GREYMatcher> AddAccountButton() {
return [ChromeMatchersAppInterface addAccountButton]; return [ChromeMatchersAppInterface addAccountButton];
} }
......
...@@ -129,6 +129,9 @@ ...@@ -129,6 +129,9 @@
// Returns matcher for the account consistency confirmation button. // Returns matcher for the account consistency confirmation button.
+ (id<GREYMatcher>)accountConsistencyConfirmationOKButton; + (id<GREYMatcher>)accountConsistencyConfirmationOKButton;
// Returns matcher for "ADD ACCOUNT" button in unified consent dialog.
+ (id<GREYMatcher>)unifiedConsentAddAccountButton;
// Returns matcher for the add account accounts button. // Returns matcher for the add account accounts button.
+ (id<GREYMatcher>)addAccountButton; + (id<GREYMatcher>)addAccountButton;
......
...@@ -355,6 +355,12 @@ UIView* SubviewWithAccessibilityIdentifier(NSString* accessibility_id, ...@@ -355,6 +355,12 @@ UIView* SubviewWithAccessibilityIdentifier(NSString* accessibility_id,
return [ChromeMatchersAppInterface buttonWithAccessibilityLabelID:(labelID)]; return [ChromeMatchersAppInterface buttonWithAccessibilityLabelID:(labelID)];
} }
+ (id<GREYMatcher>)unifiedConsentAddAccountButton {
return [ChromeMatchersAppInterface
buttonWithAccessibilityLabelID:
(IDS_IOS_ACCOUNT_UNIFIED_CONSENT_ADD_ACCOUNT)];
}
+ (id<GREYMatcher>)addAccountButton { + (id<GREYMatcher>)addAccountButton {
return grey_accessibilityID(kSettingsAccountsTableViewAddAccountCellId); return grey_accessibilityID(kSettingsAccountsTableViewAddAccountCellId);
} }
......
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