Commit b2a33988 authored by Nohemi Fernandez's avatar Nohemi Fernandez Committed by Commit Bot

[iOS] Minimize inconsistencies in SigninEarlGreyUI test APIs.

- Consolidates all button tap actions under 'tap' prefix.
- Consolidates all verification actions under 'verify' prefix.
- Removes single-use methods.

Bug: 1103274
Change-Id: Id398e1c80da233f101a87b9b40eda1b0e45f4bd3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2362700Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Commit-Queue: Nohemi Fernandez <fernandex@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799539}
parent 05d8c11c
...@@ -89,7 +89,7 @@ void ChooseImportOrKeepDataSepareteDialog(id<GREYMatcher> choiceButtonMatcher) { ...@@ -89,7 +89,7 @@ void ChooseImportOrKeepDataSepareteDialog(id<GREYMatcher> choiceButtonMatcher) {
[[EarlGrey selectElementWithMatcher:SecondarySignInButton()] [[EarlGrey selectElementWithMatcher:SecondarySignInButton()]
performAction:grey_tap()]; performAction:grey_tap()];
[SigninEarlGreyUI selectIdentityWithEmail:fakeIdentity2.userEmail]; [SigninEarlGreyUI selectIdentityWithEmail:fakeIdentity2.userEmail];
[SigninEarlGreyUI confirmSigninConfirmationDialog]; [SigninEarlGreyUI tapSigninConfirmationDialog];
// Switch Sync account to |fakeIdentity2| should ask whether date should be // Switch Sync account to |fakeIdentity2| should ask whether date should be
// imported or kept separate. Choose to keep data separate. // imported or kept separate. Choose to keep data separate.
...@@ -250,7 +250,7 @@ void ChooseImportOrKeepDataSepareteDialog(id<GREYMatcher> choiceButtonMatcher) { ...@@ -250,7 +250,7 @@ void ChooseImportOrKeepDataSepareteDialog(id<GREYMatcher> choiceButtonMatcher) {
// The authentication flow is only created when the confirm button is // The authentication flow is only created when the confirm button is
// selected. Note that authentication flow actually blocks as the // selected. Note that authentication flow actually blocks as the
// "Clear Browsing Before Syncing" dialog is presented. // "Clear Browsing Before Syncing" dialog is presented.
[SigninEarlGreyUI confirmSigninConfirmationDialog]; [SigninEarlGreyUI tapSigninConfirmationDialog];
// Waits until the merge/delete data panel is shown. // Waits until the merge/delete data panel is shown.
[[EarlGrey selectElementWithMatcher:SettingsImportDataKeepSeparateButton()] [[EarlGrey selectElementWithMatcher:SettingsImportDataKeepSeparateButton()]
assertWithMatcher:grey_interactable()]; assertWithMatcher:grey_interactable()];
......
...@@ -11,12 +11,6 @@ ...@@ -11,12 +11,6 @@
@class FakeChromeIdentity; @class FakeChromeIdentity;
typedef NS_ENUM(NSInteger, SignOutConfirmation) {
SignOutConfirmationManagedUser,
SignOutConfirmationNonManagedUser,
SignOutConfirmationNonManagedUserWithClearedData,
};
// Test methods that perform sign in actions on Chrome UI. // Test methods that perform sign in actions on Chrome UI.
@interface SigninEarlGreyUI : NSObject @interface SigninEarlGreyUI : NSObject
...@@ -37,44 +31,43 @@ typedef NS_ENUM(NSInteger, SignOutConfirmation) { ...@@ -37,44 +31,43 @@ typedef NS_ENUM(NSInteger, SignOutConfirmation) {
// method or if the account is not successfully signed out. // method or if the account is not successfully signed out.
+ (void)signOutAndClearDataFromDevice; + (void)signOutAndClearDataFromDevice;
// Selects an identity when the identity chooser dialog is presented. The dialog
// is confirmed, but it doesn't validated the user consent page.
+ (void)selectIdentityWithEmail:(NSString*)userEmail;
// Taps on the settings link in the sign-in view. The sign-in view has to be // Taps on the settings link in the sign-in view. The sign-in view has to be
// opened before calling this method. // opened before calling this method.
+ (void)tapSettingsLink; + (void)tapSettingsLink;
// Selects an identity when the identity chooser dialog is presented. The dialog // Deprecated. Use |tapSigninConfirmationDialog|.
// is confirmed, but it doesn't validated the user consent page. + (void)confirmSigninConfirmationDialog;
+ (void)selectIdentityWithEmail:(NSString*)userEmail;
// Confirms the sign in confirmation page, scrolls first to make the OK button // Taps the sign in confirmation page, scrolls first to make the OK button
// visible on short devices (e.g. iPhone 5s). // visible on short devices (e.g. iPhone 5s).
+ (void)confirmSigninConfirmationDialog; + (void)tapSigninConfirmationDialog;
// Taps on the "ADD ACCOUNT" button in the unified consent, to display the // Taps on the "ADD ACCOUNT" button in the unified consent, to display the
// SSO dialog. // SSO dialog.
// This method should only be used with UnifiedConsent flag. // This method should only be used with UnifiedConsent flag.
+ (void)tapAddAccountButton; + (void)tapAddAccountButton;
// Taps "Remove account from this device" button and follow-up confirmation.
// Assumes the user is on the Settings screen.
+ (void)tapRemoveAccountFromDeviceWithFakeIdentity:
(FakeChromeIdentity*)fakeIdentity;
// 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)verifySigninPromoVisibleWithMode:(SigninPromoViewMode)mode;
// Checks that the sign-in promo view is visible using the right mode. If // Checks that the sign-in promo view is visible using the right mode. If
// |closeButton| is set to YES, the close button in the sign-in promo has to be // |closeButton| is set to YES, the close button in the sign-in promo has to be
// visible. // visible.
+ (void)checkSigninPromoVisibleWithMode:(SigninPromoViewMode)mode + (void)verifySigninPromoVisibleWithMode:(SigninPromoViewMode)mode
closeButton:(BOOL)closeButton; closeButton:(BOOL)closeButton;
// Checks that the sign-in promo view is not visible. // Checks that the sign-in promo view is not visible.
+ (void)checkSigninPromoNotVisible; + (void)verifySigninPromoNotVisible;
// Taps the appropriate action label on the sign-out dialog for the given
// |signOutConfirmation| profile and signs out from the current identity.
+ (void)signOutWithSignOutConfirmation:(SignOutConfirmation)signOutConfirmation;
// Taps "Remove account from this device" button and follow-up confirmation.
// Assumes the user is on the Settings screen.
+ (void)tapRemoveAccountFromDeviceWithFakeIdentity:
(FakeChromeIdentity*)fakeIdentity;
@end @end
......
...@@ -40,9 +40,16 @@ using chrome_test_util::SignOutAccountsButton; ...@@ -40,9 +40,16 @@ using chrome_test_util::SignOutAccountsButton;
[ChromeEarlGreyUI [ChromeEarlGreyUI
tapSettingsMenuButton:chrome_test_util::SecondarySignInButton()]; tapSettingsMenuButton:chrome_test_util::SecondarySignInButton()];
[self selectIdentityWithEmail:fakeIdentity.userEmail]; [self selectIdentityWithEmail:fakeIdentity.userEmail];
[self confirmSigninConfirmationDialog]; [self tapSigninConfirmationDialog];
if ([fakeIdentity.userEmail hasSuffix:ios::kManagedIdentityEmailSuffix]) { if ([fakeIdentity.userEmail hasSuffix:ios::kManagedIdentityEmailSuffix]) {
[self confirmSigninWithManagedAccount]; // Synchronization off due to an infinite spinner, in the user consent view,
// under the managed consent dialog. This spinner is started by the sign-in
// process.
ScopedSynchronizationDisabler disabler;
id<GREYMatcher> acceptButton = [ChromeMatchersAppInterface
buttonWithAccessibilityLabelID:IDS_IOS_MANAGED_SIGNIN_ACCEPT_BUTTON];
[ChromeEarlGrey waitForMatcher:acceptButton];
[[EarlGrey selectElementWithMatcher:acceptButton] performAction:grey_tap()];
} }
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()] [[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()]; performAction:grey_tap()];
...@@ -80,18 +87,11 @@ using chrome_test_util::SignOutAccountsButton; ...@@ -80,18 +87,11 @@ using chrome_test_util::SignOutAccountsButton;
performAction:grey_tap()]; performAction:grey_tap()];
} }
+ (void)confirmSigninWithManagedAccount { + (void)confirmSigninConfirmationDialog {
// Synchronization off due to an infinite spinner, in the user consent view, [self tapSigninConfirmationDialog];
// under the managed consent dialog. This spinner is started by the sign-in
// process.
ScopedSynchronizationDisabler disabler;
id<GREYMatcher> acceptButton = [ChromeMatchersAppInterface
buttonWithAccessibilityLabelID:IDS_IOS_MANAGED_SIGNIN_ACCEPT_BUTTON];
[ChromeEarlGrey waitForMatcher:acceptButton];
[[EarlGrey selectElementWithMatcher:acceptButton] performAction:grey_tap()];
} }
+ (void)confirmSigninConfirmationDialog { + (void)tapSigninConfirmationDialog {
// To confirm the dialog, the scroll view content has to be scrolled to the // To confirm the dialog, the scroll view content has to be scrolled to the
// bottom to transform "MORE" button into the validation button. // bottom to transform "MORE" button into the validation button.
// EarlGrey fails to scroll to the bottom, using grey_scrollToContentEdge(), // EarlGrey fails to scroll to the bottom, using grey_scrollToContentEdge(),
...@@ -149,12 +149,12 @@ using chrome_test_util::SignOutAccountsButton; ...@@ -149,12 +149,12 @@ using chrome_test_util::SignOutAccountsButton;
[[EarlGrey selectElementWithMatcher:buttonMatcher] performAction:grey_tap()]; [[EarlGrey selectElementWithMatcher:buttonMatcher] performAction:grey_tap()];
} }
+ (void)checkSigninPromoVisibleWithMode:(SigninPromoViewMode)mode { + (void)verifySigninPromoVisibleWithMode:(SigninPromoViewMode)mode {
[self checkSigninPromoVisibleWithMode:mode closeButton:YES]; [self verifySigninPromoVisibleWithMode:mode closeButton:YES];
} }
+ (void)checkSigninPromoVisibleWithMode:(SigninPromoViewMode)mode + (void)verifySigninPromoVisibleWithMode:(SigninPromoViewMode)mode
closeButton:(BOOL)closeButton { closeButton:(BOOL)closeButton {
[ChromeEarlGreyUI waitForAppToIdle]; [ChromeEarlGreyUI waitForAppToIdle];
[[EarlGrey [[EarlGrey
selectElementWithMatcher:grey_allOf( selectElementWithMatcher:grey_allOf(
...@@ -188,7 +188,7 @@ using chrome_test_util::SignOutAccountsButton; ...@@ -188,7 +188,7 @@ using chrome_test_util::SignOutAccountsButton;
} }
} }
+ (void)checkSigninPromoNotVisible { + (void)verifySigninPromoNotVisible {
[[EarlGrey [[EarlGrey
selectElementWithMatcher:grey_allOf( selectElementWithMatcher:grey_allOf(
grey_accessibilityID(kSigninPromoViewId), grey_accessibilityID(kSigninPromoViewId),
...@@ -204,29 +204,6 @@ using chrome_test_util::SignOutAccountsButton; ...@@ -204,29 +204,6 @@ using chrome_test_util::SignOutAccountsButton;
assertWithMatcher:grey_nil()]; assertWithMatcher:grey_nil()];
} }
+ (void)signOutWithSignOutConfirmation:
(SignOutConfirmation)signOutConfirmation {
[ChromeEarlGreyUI openSettingsMenu];
[ChromeEarlGreyUI tapSettingsMenuButton:SettingsAccountButton()];
id<GREYMatcher> signOutButtonMatcher;
int confirmationLabelID = 0;
switch (signOutConfirmation) {
case SignOutConfirmationNonManagedUser: {
signOutButtonMatcher = SignOutAccountsButton();
confirmationLabelID = IDS_IOS_DISCONNECT_DIALOG_CONTINUE_BUTTON_MOBILE;
break;
}
case SignOutConfirmationManagedUser:
case SignOutConfirmationNonManagedUserWithClearedData: {
signOutButtonMatcher = grey_accessibilityID(
kSettingsAccountsTableViewSignoutAndClearDataCellId);
confirmationLabelID = IDS_IOS_DISCONNECT_DIALOG_CONTINUE_AND_CLEAR_MOBILE;
break;
}
}
}
+ (void)tapRemoveAccountFromDeviceWithFakeIdentity: + (void)tapRemoveAccountFromDeviceWithFakeIdentity:
(FakeChromeIdentity*)fakeIdentity { (FakeChromeIdentity*)fakeIdentity {
[[EarlGrey selectElementWithMatcher:ButtonWithAccessibilityLabel( [[EarlGrey selectElementWithMatcher:ButtonWithAccessibilityLabel(
......
...@@ -66,13 +66,13 @@ using chrome_test_util::SecondarySignInButton; ...@@ -66,13 +66,13 @@ using chrome_test_util::SecondarySignInButton;
// Check that sign-in promo view is visible. // Check that sign-in promo view is visible.
[BookmarkEarlGrey verifyPromoAlreadySeen:NO]; [BookmarkEarlGrey verifyPromoAlreadySeen:NO];
[SigninEarlGreyUI [SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeColdState]; verifySigninPromoVisibleWithMode:SigninPromoViewModeColdState];
// Go to child node. // Go to child node.
[BookmarkEarlGreyUI openMobileBookmarks]; [BookmarkEarlGreyUI openMobileBookmarks];
// Wait until promo is gone. // Wait until promo is gone.
[SigninEarlGreyUI checkSigninPromoNotVisible]; [SigninEarlGreyUI verifySigninPromoNotVisible];
// Check that the promo already seen state is not updated. // Check that the promo already seen state is not updated.
[BookmarkEarlGrey verifyPromoAlreadySeen:NO]; [BookmarkEarlGrey verifyPromoAlreadySeen:NO];
...@@ -99,7 +99,7 @@ using chrome_test_util::SecondarySignInButton; ...@@ -99,7 +99,7 @@ using chrome_test_util::SecondarySignInButton;
// Check that sign-in promo view is visible. // Check that sign-in promo view is visible.
[BookmarkEarlGrey verifyPromoAlreadySeen:NO]; [BookmarkEarlGrey verifyPromoAlreadySeen:NO];
[SigninEarlGreyUI [SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeColdState]; verifySigninPromoVisibleWithMode:SigninPromoViewModeColdState];
// Tap the dismiss button. // Tap the dismiss button.
[[EarlGrey [[EarlGrey
...@@ -109,7 +109,7 @@ using chrome_test_util::SecondarySignInButton; ...@@ -109,7 +109,7 @@ using chrome_test_util::SecondarySignInButton;
performAction:grey_tap()]; performAction:grey_tap()];
// Wait until promo is gone. // Wait until promo is gone.
[SigninEarlGreyUI checkSigninPromoNotVisible]; [SigninEarlGreyUI verifySigninPromoNotVisible];
// Check that the promo already seen state is updated. // Check that the promo already seen state is updated.
[BookmarkEarlGrey verifyPromoAlreadySeen:YES]; [BookmarkEarlGrey verifyPromoAlreadySeen:YES];
...@@ -124,7 +124,7 @@ using chrome_test_util::SecondarySignInButton; ...@@ -124,7 +124,7 @@ using chrome_test_util::SecondarySignInButton;
// Check that sign-in promo view are visible. // Check that sign-in promo view are visible.
[BookmarkEarlGrey verifyPromoAlreadySeen:NO]; [BookmarkEarlGrey verifyPromoAlreadySeen:NO];
[SigninEarlGreyUI [SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeColdState]; verifySigninPromoVisibleWithMode:SigninPromoViewModeColdState];
// Tap the primary button. // Tap the primary button.
[[EarlGrey [[EarlGrey
...@@ -139,7 +139,7 @@ using chrome_test_util::SecondarySignInButton; ...@@ -139,7 +139,7 @@ using chrome_test_util::SecondarySignInButton;
// Check that the bookmarks UI reappeared and the cell is still here. // Check that the bookmarks UI reappeared and the cell is still here.
[BookmarkEarlGrey verifyPromoAlreadySeen:NO]; [BookmarkEarlGrey verifyPromoAlreadySeen:NO];
[SigninEarlGreyUI [SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeColdState]; verifySigninPromoVisibleWithMode:SigninPromoViewModeColdState];
} }
// Tests the tapping on the primary button of sign-in promo view in a warm // Tests the tapping on the primary button of sign-in promo view in a warm
...@@ -155,7 +155,7 @@ using chrome_test_util::SecondarySignInButton; ...@@ -155,7 +155,7 @@ using chrome_test_util::SecondarySignInButton;
// Check that promo is visible. // Check that promo is visible.
[BookmarkEarlGrey verifyPromoAlreadySeen:NO]; [BookmarkEarlGrey verifyPromoAlreadySeen:NO];
[SigninEarlGreyUI [SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeWarmState]; verifySigninPromoVisibleWithMode:SigninPromoViewModeWarmState];
// Tap the primary button. // Tap the primary button.
[[EarlGrey [[EarlGrey
...@@ -170,7 +170,7 @@ using chrome_test_util::SecondarySignInButton; ...@@ -170,7 +170,7 @@ using chrome_test_util::SecondarySignInButton;
// Check that the bookmarks UI reappeared and the cell is still here. // Check that the bookmarks UI reappeared and the cell is still here.
[SigninEarlGreyUI [SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeWarmState]; verifySigninPromoVisibleWithMode:SigninPromoViewModeWarmState];
[BookmarkEarlGrey verifyPromoAlreadySeen:NO]; [BookmarkEarlGrey verifyPromoAlreadySeen:NO];
} }
...@@ -188,7 +188,7 @@ using chrome_test_util::SecondarySignInButton; ...@@ -188,7 +188,7 @@ using chrome_test_util::SecondarySignInButton;
// Check that sign-in promo view are visible. // Check that sign-in promo view are visible.
[BookmarkEarlGrey verifyPromoAlreadySeen:NO]; [BookmarkEarlGrey verifyPromoAlreadySeen:NO];
[SigninEarlGreyUI [SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeWarmState]; verifySigninPromoVisibleWithMode:SigninPromoViewModeWarmState];
// Tap the secondary button. // Tap the secondary button.
[[EarlGrey [[EarlGrey
...@@ -207,7 +207,7 @@ using chrome_test_util::SecondarySignInButton; ...@@ -207,7 +207,7 @@ using chrome_test_util::SecondarySignInButton;
// Check that the bookmarks UI reappeared and the cell is still here. // Check that the bookmarks UI reappeared and the cell is still here.
[BookmarkEarlGrey verifyPromoAlreadySeen:NO]; [BookmarkEarlGrey verifyPromoAlreadySeen:NO];
[SigninEarlGreyUI [SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeWarmState]; verifySigninPromoVisibleWithMode:SigninPromoViewModeWarmState];
} }
// Tests that the sign-in promo should not be shown after been shown 19 times. // Tests that the sign-in promo should not be shown after been shown 19 times.
...@@ -216,7 +216,7 @@ using chrome_test_util::SecondarySignInButton; ...@@ -216,7 +216,7 @@ using chrome_test_util::SecondarySignInButton;
[BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openBookmarks];
// Check the sign-in promo view is visible. // Check the sign-in promo view is visible.
[SigninEarlGreyUI [SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeColdState]; verifySigninPromoVisibleWithMode:SigninPromoViewModeColdState];
// Check the sign-in promo already-seen state didn't change. // Check the sign-in promo already-seen state didn't change.
[BookmarkEarlGrey verifyPromoAlreadySeen:NO]; [BookmarkEarlGrey verifyPromoAlreadySeen:NO];
GREYAssertEqual(20, [BookmarkEarlGrey numberOfTimesPromoAlreadySeen], GREYAssertEqual(20, [BookmarkEarlGrey numberOfTimesPromoAlreadySeen],
...@@ -228,7 +228,7 @@ using chrome_test_util::SecondarySignInButton; ...@@ -228,7 +228,7 @@ using chrome_test_util::SecondarySignInButton;
[BookmarkEarlGreyUI openBookmarks]; [BookmarkEarlGreyUI openBookmarks];
[ChromeEarlGreyUI waitForAppToIdle]; [ChromeEarlGreyUI waitForAppToIdle];
// Check that the sign-in promo is not visible anymore. // Check that the sign-in promo is not visible anymore.
[SigninEarlGreyUI checkSigninPromoNotVisible]; [SigninEarlGreyUI verifySigninPromoNotVisible];
} }
@end @end
...@@ -160,13 +160,15 @@ id<GREYMatcher> TitleOfTestPage() { ...@@ -160,13 +160,15 @@ id<GREYMatcher> TitleOfTestPage() {
- (void)testRecentTabSigninPromoReloaded { - (void)testRecentTabSigninPromoReloaded {
OpenRecentTabsPanel(); OpenRecentTabsPanel();
// Sign-in promo should be visible with cold state. // Sign-in promo should be visible with cold state.
[SigninEarlGreyUI checkSigninPromoVisibleWithMode:SigninPromoViewModeColdState [SigninEarlGreyUI
closeButton:NO]; verifySigninPromoVisibleWithMode:SigninPromoViewModeColdState
closeButton:NO];
FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1]; FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1];
[SigninEarlGrey addFakeIdentity:fakeIdentity]; [SigninEarlGrey addFakeIdentity:fakeIdentity];
// Sign-in promo should be visible with warm state. // Sign-in promo should be visible with warm state.
[SigninEarlGreyUI checkSigninPromoVisibleWithMode:SigninPromoViewModeWarmState [SigninEarlGreyUI
closeButton:NO]; verifySigninPromoVisibleWithMode:SigninPromoViewModeWarmState
closeButton:NO];
[self closeRecentTabs]; [self closeRecentTabs];
[SigninEarlGrey forgetFakeIdentity:fakeIdentity]; [SigninEarlGrey forgetFakeIdentity:fakeIdentity];
} }
...@@ -175,8 +177,9 @@ id<GREYMatcher> TitleOfTestPage() { ...@@ -175,8 +177,9 @@ id<GREYMatcher> TitleOfTestPage() {
// crbug.com/776939 // crbug.com/776939
- (void)testRecentTabSigninPromoReloadedWhileHidden { - (void)testRecentTabSigninPromoReloadedWhileHidden {
OpenRecentTabsPanel(); OpenRecentTabsPanel();
[SigninEarlGreyUI checkSigninPromoVisibleWithMode:SigninPromoViewModeColdState [SigninEarlGreyUI
closeButton:NO]; verifySigninPromoVisibleWithMode:SigninPromoViewModeColdState
closeButton:NO];
// Tap on "Other Devices", to hide the sign-in promo. // Tap on "Other Devices", to hide the sign-in promo.
NSString* otherDevicesLabel = NSString* otherDevicesLabel =
...@@ -186,7 +189,7 @@ id<GREYMatcher> TitleOfTestPage() { ...@@ -186,7 +189,7 @@ id<GREYMatcher> TitleOfTestPage() {
grey_sufficientlyVisible(), nil); grey_sufficientlyVisible(), nil);
[[EarlGrey selectElementWithMatcher:otherDevicesMatcher] [[EarlGrey selectElementWithMatcher:otherDevicesMatcher]
performAction:grey_tap()]; performAction:grey_tap()];
[SigninEarlGreyUI checkSigninPromoNotVisible]; [SigninEarlGreyUI verifySigninPromoNotVisible];
// Add an account. // Add an account.
FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1]; FakeChromeIdentity* fakeIdentity = [SigninEarlGrey fakeIdentity1];
...@@ -195,8 +198,9 @@ id<GREYMatcher> TitleOfTestPage() { ...@@ -195,8 +198,9 @@ id<GREYMatcher> TitleOfTestPage() {
// Tap on "Other Devices", to show the sign-in promo. // Tap on "Other Devices", to show the sign-in promo.
[[EarlGrey selectElementWithMatcher:otherDevicesMatcher] [[EarlGrey selectElementWithMatcher:otherDevicesMatcher]
performAction:grey_tap()]; performAction:grey_tap()];
[SigninEarlGreyUI checkSigninPromoVisibleWithMode:SigninPromoViewModeWarmState [SigninEarlGreyUI
closeButton:NO]; verifySigninPromoVisibleWithMode:SigninPromoViewModeWarmState
closeButton:NO];
[self closeRecentTabs]; [self closeRecentTabs];
[SigninEarlGrey forgetFakeIdentity:fakeIdentity]; [SigninEarlGrey forgetFakeIdentity:fakeIdentity];
} }
...@@ -274,8 +278,9 @@ id<GREYMatcher> TitleOfTestPage() { ...@@ -274,8 +278,9 @@ id<GREYMatcher> TitleOfTestPage() {
[illustratedCell assertWithMatcher:grey_nil()]; [illustratedCell assertWithMatcher:grey_nil()];
} }
[SigninEarlGreyUI checkSigninPromoVisibleWithMode:SigninPromoViewModeColdState [SigninEarlGreyUI
closeButton:NO]; verifySigninPromoVisibleWithMode:SigninPromoViewModeColdState
closeButton:NO];
} }
@end @end
...@@ -42,7 +42,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId; ...@@ -42,7 +42,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId;
- (void)testSignInPromoWithColdStateUsingPrimaryButton { - (void)testSignInPromoWithColdStateUsingPrimaryButton {
[ChromeEarlGreyUI openSettingsMenu]; [ChromeEarlGreyUI openSettingsMenu];
[SigninEarlGreyUI [SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeColdState]; verifySigninPromoVisibleWithMode:SigninPromoViewModeColdState];
[ChromeEarlGreyUI tapSettingsMenuButton:PrimarySignInButton()]; [ChromeEarlGreyUI tapSettingsMenuButton:PrimarySignInButton()];
// Cancel the sign-in operation. // Cancel the sign-in operation.
...@@ -50,7 +50,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId; ...@@ -50,7 +50,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId;
kSkipSigninAccessibilityIdentifier)] kSkipSigninAccessibilityIdentifier)]
performAction:grey_tap()]; performAction:grey_tap()];
[SigninEarlGreyUI [SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeColdState]; verifySigninPromoVisibleWithMode:SigninPromoViewModeColdState];
} }
// Tests signing in, using the primary button with a warm state. // Tests signing in, using the primary button with a warm state.
...@@ -60,13 +60,13 @@ using chrome_test_util::ButtonWithAccessibilityLabelId; ...@@ -60,13 +60,13 @@ using chrome_test_util::ButtonWithAccessibilityLabelId;
[ChromeEarlGreyUI openSettingsMenu]; [ChromeEarlGreyUI openSettingsMenu];
[SigninEarlGreyUI [SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeWarmState]; verifySigninPromoVisibleWithMode:SigninPromoViewModeWarmState];
[ChromeEarlGreyUI tapSettingsMenuButton:PrimarySignInButton()]; [ChromeEarlGreyUI tapSettingsMenuButton:PrimarySignInButton()];
[SigninEarlGreyUI confirmSigninConfirmationDialog]; [SigninEarlGreyUI tapSigninConfirmationDialog];
// User signed in. // User signed in.
[SigninEarlGrey verifySignedInWithFakeIdentity:fakeIdentity]; [SigninEarlGrey verifySignedInWithFakeIdentity:fakeIdentity];
[SigninEarlGreyUI checkSigninPromoNotVisible]; [SigninEarlGreyUI verifySigninPromoNotVisible];
[[EarlGrey selectElementWithMatcher:SettingsAccountButton()] [[EarlGrey selectElementWithMatcher:SettingsAccountButton()]
assertWithMatcher:grey_interactable()]; assertWithMatcher:grey_interactable()];
} }
...@@ -78,14 +78,14 @@ using chrome_test_util::ButtonWithAccessibilityLabelId; ...@@ -78,14 +78,14 @@ using chrome_test_util::ButtonWithAccessibilityLabelId;
[ChromeEarlGreyUI openSettingsMenu]; [ChromeEarlGreyUI openSettingsMenu];
[SigninEarlGreyUI [SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeWarmState]; verifySigninPromoVisibleWithMode:SigninPromoViewModeWarmState];
[ChromeEarlGreyUI tapSettingsMenuButton:SecondarySignInButton()]; [ChromeEarlGreyUI tapSettingsMenuButton:SecondarySignInButton()];
[SigninEarlGreyUI selectIdentityWithEmail:fakeIdentity.userEmail]; [SigninEarlGreyUI selectIdentityWithEmail:fakeIdentity.userEmail];
[SigninEarlGreyUI confirmSigninConfirmationDialog]; [SigninEarlGreyUI tapSigninConfirmationDialog];
// User signed in. // User signed in.
[SigninEarlGrey verifySignedInWithFakeIdentity:fakeIdentity]; [SigninEarlGrey verifySignedInWithFakeIdentity:fakeIdentity];
[SigninEarlGreyUI checkSigninPromoNotVisible]; [SigninEarlGreyUI verifySigninPromoNotVisible];
[[EarlGrey selectElementWithMatcher:SettingsAccountButton()] [[EarlGrey selectElementWithMatcher:SettingsAccountButton()]
assertWithMatcher:grey_interactable()]; assertWithMatcher:grey_interactable()];
} }
...@@ -98,7 +98,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId; ...@@ -98,7 +98,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId;
[ChromeEarlGreyUI openSettingsMenu]; [ChromeEarlGreyUI openSettingsMenu];
// Check the sign-in promo view is visible. // Check the sign-in promo view is visible.
[SigninEarlGreyUI [SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeColdState]; verifySigninPromoVisibleWithMode:SigninPromoViewModeColdState];
// Check the sign-in promo will not be shown anymore. // Check the sign-in promo will not be shown anymore.
int newDisplayedCount = int newDisplayedCount =
[SigninSettingsAppInterface settingsSigninPromoDisplayedCount]; [SigninSettingsAppInterface settingsSigninPromoDisplayedCount];
...@@ -109,7 +109,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId; ...@@ -109,7 +109,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId;
performAction:grey_tap()]; performAction:grey_tap()];
[ChromeEarlGreyUI openSettingsMenu]; [ChromeEarlGreyUI openSettingsMenu];
// Check that the sign-in promo is not visible anymore. // Check that the sign-in promo is not visible anymore.
[SigninEarlGreyUI checkSigninPromoNotVisible]; [SigninEarlGreyUI verifySigninPromoNotVisible];
[[EarlGrey [[EarlGrey
selectElementWithMatcher:grey_allOf( selectElementWithMatcher:grey_allOf(
grey_accessibilityID(kSettingsSignInCellId), grey_accessibilityID(kSettingsSignInCellId),
...@@ -121,7 +121,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId; ...@@ -121,7 +121,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId;
[ChromeEarlGreyUI openSettingsMenu]; [ChromeEarlGreyUI openSettingsMenu];
// Check the sign-in promo view is visible. // Check the sign-in promo view is visible.
[SigninEarlGreyUI [SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeColdState]; verifySigninPromoVisibleWithMode:SigninPromoViewModeColdState];
// Tap on dismiss button. // Tap on dismiss button.
[[EarlGrey [[EarlGrey
selectElementWithMatcher:grey_allOf(grey_accessibilityID( selectElementWithMatcher:grey_allOf(grey_accessibilityID(
...@@ -129,7 +129,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId; ...@@ -129,7 +129,7 @@ using chrome_test_util::ButtonWithAccessibilityLabelId;
grey_sufficientlyVisible(), nil)] grey_sufficientlyVisible(), nil)]
performAction:grey_tap()]; performAction:grey_tap()];
// Check that the sign-in promo is not visible anymore. // Check that the sign-in promo is not visible anymore.
[SigninEarlGreyUI checkSigninPromoNotVisible]; [SigninEarlGreyUI verifySigninPromoNotVisible];
[[EarlGrey [[EarlGrey
selectElementWithMatcher:grey_allOf( selectElementWithMatcher:grey_allOf(
grey_accessibilityID(kSettingsSignInCellId), grey_accessibilityID(kSettingsSignInCellId),
......
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