Commit 583b8ce4 authored by Mihai Sardarescu's avatar Mihai Sardarescu Committed by Commit Bot

Update all sign-in earl grey tests for Unified Consent.

This CL ensures that all tests in theSigninIntegrationTest pass
when the Unified Consent Feature is enabled. In achieves this in
the following steps.

1. It splits the SigninInteractionControllerTestCase class in 3:
a) SigninInteractionControllerTestCase: test cases that pass both when
Unified consent is enabled or disabled;
b) SigninInteractionControllerUnityDisabledTestCase: test cases that require
Unified Consent to be disabled;
c) SigninInteractionControllerUnityEnabledTestCase: test cases that require
Unified Consent to be enabled;

2. It updates all necessary tests in the SigninInteractionControllerTestCase
to pass when the Unified Consent is enabled.

3. It includes SigninInteractionControllerTestCase both in
ios_chrome_ui_egtests (that run with Unified Consent enabled) and
in ios_chrome_unified_consent_ui_tests (that run with Unified Consent disabled).

Bug: 960260

Change-Id: I0be1945ff290bd2fcbba44d64f733658c623b369
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1599009
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarJérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659466}
parent e6e0574c
......@@ -7,6 +7,9 @@
#import <UIKit/UIKit.h>
#include <memory>
#include "base/auto_reset.h"
#include "base/timer/timer.h"
#include "components/signin/core/browser/signin_metrics.h"
#import "ios/chrome/browser/signin/constants.h"
......@@ -122,6 +125,10 @@ using TimerGeneratorBlock = std::unique_ptr<base::OneShotTimer> (^)();
// base::OneShotTimer.
@property(nonatomic, copy) TimerGeneratorBlock timerGenerator;
// Returns an AutoReset object that ensures that all future
// ChromeSigninViewController instances will not present the activity indicator.
+ (std::unique_ptr<base::AutoReset<BOOL>>)hideActivityIndicatorForTesting;
@end
#endif // IOS_CHROME_BROWSER_UI_AUTHENTICATION_CHROME_SIGNIN_VIEW_CONTROLLER_H_
......@@ -65,6 +65,9 @@
namespace {
// Controls whether the activity indicator should be added to the sign-in view.
BOOL gChromeSigninViewControllerShowsActivityIndicator = YES;
// Default animation duration.
const CGFloat kAnimationDuration = 0.5f;
......@@ -939,12 +942,15 @@ enum AuthenticationState {
_secondaryButton.hidden = YES;
[self.view addSubview:_secondaryButton];
_activityIndicator = [[MDCActivityIndicator alloc] initWithFrame:CGRectZero];
[_activityIndicator setDelegate:self];
[_activityIndicator setStrokeWidth:3];
[_activityIndicator
setCycleColors:@[ [[MDCPalette cr_bluePalette] tint500] ]];
[self.view addSubview:_activityIndicator];
if (gChromeSigninViewControllerShowsActivityIndicator) {
_activityIndicator =
[[MDCActivityIndicator alloc] initWithFrame:CGRectZero];
[_activityIndicator setDelegate:self];
[_activityIndicator setStrokeWidth:3];
[_activityIndicator
setCycleColors:@[ [[MDCPalette cr_bluePalette] tint500] ]];
[self.view addSubview:_activityIndicator];
}
_gradientView = [[UIView alloc] initWithFrame:CGRectZero];
_gradientLayer = [CAGradientLayer layer];
......@@ -1253,4 +1259,9 @@ enum AuthenticationState {
_timerGenerator = [timerGenerator copy];
}
+ (std::unique_ptr<base::AutoReset<BOOL>>)hideActivityIndicatorForTesting {
return std::make_unique<base::AutoReset<BOOL>>(
&gChromeSigninViewControllerShowsActivityIndicator, NO);
}
@end
......@@ -61,17 +61,7 @@ using chrome_test_util::SettingsDoneButton;
[ChromeEarlGreyUI openSettingsMenu];
[ChromeEarlGreyUI
tapSettingsMenuButton:chrome_test_util::SecondarySignInButton()];
if (base::FeatureList::IsEnabled(unified_consent::kUnifiedConsent)) {
[[EarlGrey
selectElementWithMatcher:grey_allOf(
grey_accessibilityID(identity.userEmail),
grey_kindOfClass(
[IdentityChooserCell class]),
grey_sufficientlyVisible(), nil)]
performAction:grey_tap()];
} else {
[self selectIdentityWithEmail:identity.userEmail];
}
[self selectIdentityWithEmail:identity.userEmail];
[self confirmSigninConfirmationDialog];
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
......@@ -81,11 +71,21 @@ using chrome_test_util::SettingsDoneButton;
}
+ (void)selectIdentityWithEmail:(NSString*)userEmail {
// Sign in to |userEmail|.
[[EarlGrey selectElementWithMatcher:ButtonWithAccessibilityLabel(userEmail)]
performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:AccountConsistencySetupSigninButton()]
performAction:grey_tap()];
if (base::FeatureList::IsEnabled(unified_consent::kUnifiedConsent)) {
// Assumes that the identity chooser is visible.
[[EarlGrey
selectElementWithMatcher:grey_allOf(grey_accessibilityID(userEmail),
grey_kindOfClass(
[IdentityChooserCell class]),
grey_sufficientlyVisible(), nil)]
performAction:grey_tap()];
} else {
// Sign in to |userEmail|.
[[EarlGrey selectElementWithMatcher:ButtonWithAccessibilityLabel(userEmail)]
performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:AccountConsistencySetupSigninButton()]
performAction:grey_tap()];
}
}
+ (void)tapSettingsLink {
......
......@@ -10,6 +10,12 @@
@class AdvancedSigninSettingsCoordinator;
@protocol ApplicationCommands;
// The accessibility identifier for the navigation "Confirm" button.
extern NSString* const kSyncSettingsConfirmButtonId;
// The accessibility identifier for the navigation "Cancel" button.
extern NSString* const kSyncSettingsCancelButtonId;
// AdvancedSigninSettingsCoordinator delegate.
@protocol AdvancedSigninSettingsCoordinatorDelegate <NSObject>
......
......@@ -31,6 +31,11 @@
using l10n_util::GetNSString;
NSString* const kSyncSettingsConfirmButtonId =
@"kAdvancedSyncSettingsConfirmButtonId";
NSString* const kSyncSettingsCancelButtonId =
@"kAdvancedSyncSettingsCancelButtonId";
// Advanced sign-in settings result.
typedef NS_ENUM(NSInteger, AdvancedSigninSettingsCoordinatorResult) {
// The user confirmed the advanced sync settings.
......@@ -151,6 +156,7 @@ typedef NS_ENUM(NSInteger, AdvancedSigninSettingsCoordinatorResult) {
initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self
action:@selector(navigationCancelButtonAction)];
cancelButton.accessibilityIdentifier = kSyncSettingsCancelButtonId;
return cancelButton;
}
......@@ -162,6 +168,7 @@ typedef NS_ENUM(NSInteger, AdvancedSigninSettingsCoordinatorResult) {
style:UIBarButtonItemStyleDone
target:self
action:@selector(navigationConfirmButtonAction)];
confirmButton.accessibilityIdentifier = kSyncSettingsConfirmButtonId;
return confirmButton;
}
......
......@@ -16,6 +16,9 @@ extern NSString* const kImportDataImportCellId;
// The accessibility identifier of the Keep Data Separate cell.
extern NSString* const kImportDataKeepSeparateCellId;
// The accessiblity identifier of the Continue navigation button.
extern NSString* const kImportDataContinueButtonId;
// Notifies of the user action on the corresponding
// ImportDataTableViewController.
@protocol ImportDataControllerDelegate
......
......@@ -24,6 +24,7 @@ NSString* const kImportDataImportCellId = @"kImportDataImportCellId";
// The accessibility identifier of the Keep Data Separate cell.
NSString* const kImportDataKeepSeparateCellId =
@"kImportDataKeepSeparateCellId";
NSString* const kImportDataContinueButtonId = @"kImportDataContinueButtonId";
namespace {
......@@ -89,7 +90,8 @@ typedef NS_ENUM(NSInteger, ItemType) {
style:UIBarButtonItemStyleDone
target:self
action:@selector(didTapContinue)];
self.navigationItem.rightBarButtonItem.accessibilityIdentifier =
kImportDataContinueButtonId;
[self loadModel];
}
......
......@@ -29,18 +29,43 @@ source_set("signin_interaction") {
]
}
source_set("eg_test_support") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
sources = [
"signin_interaction_controller_egtest_util.h",
"signin_interaction_controller_egtest_util.mm",
]
deps = [
"//base",
"//base/test:test_support",
"//components/unified_consent",
"//ios/chrome/app/strings",
"//ios/chrome/browser/ui/authentication:eg_test_support",
"//ios/chrome/test/app:test_support",
"//ios/chrome/test/earl_grey:test_support",
"//ios/public/provider/chrome/browser/signin:test_support",
"//ios/testing/earl_grey:earl_grey_support",
]
}
source_set("eg_tests") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
sources = [
"signin_interaction_controller_egtest.mm",
"signin_interaction_controller_unity_disabled_egtest.mm",
]
deps = [
":eg_test_support",
"//base",
"//base/test:test_support",
"//components/unified_consent",
"//ios/chrome/app/strings",
"//ios/chrome/browser",
"//ios/chrome/browser/signin",
"//ios/chrome/browser/ui/authentication",
"//ios/chrome/browser/ui/authentication:eg_test_support",
"//ios/chrome/browser/ui/authentication/cells",
"//ios/chrome/browser/ui/commands",
......@@ -60,18 +85,31 @@ source_set("unity_eg_tests") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
sources = [
"signin_interaction_controller_egtest.mm",
"signin_interaction_controller_unity_egtest.mm",
]
deps = [
":eg_test_support",
"//base",
"//base/test:test_support",
"//components/unified_consent",
"//ios/chrome/app/strings",
"//ios/chrome/app/strings:ios_strings_grit",
"//ios/chrome/browser",
"//ios/chrome/browser/signin",
"//ios/chrome/browser/ui/authentication",
"//ios/chrome/browser/ui/authentication:eg_test_support",
"//ios/chrome/browser/ui/authentication/cells",
"//ios/chrome/browser/ui/authentication/unified_consent/identity_chooser:identity_chooser_ui",
"//ios/chrome/browser/ui/commands",
"//ios/chrome/browser/ui/content_suggestions:content_suggestions_constant",
"//ios/chrome/browser/ui/settings",
"//ios/chrome/browser/ui/util",
"//ios/chrome/test/app:test_support",
"//ios/chrome/test/earl_grey:test_support",
"//ios/public/provider/chrome/browser/signin:test_support",
"//ios/testing/earl_grey:earl_grey_support",
"//ios/third_party/earl_grey:earl_grey+link",
"//ui/base",
]
libs = [ "XCTest.framework" ]
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_SIGNIN_INTERACTION_SIGNIN_INTERACTION_CONTROLLER_EGTEST_UTIL_H_
#define IOS_CHROME_BROWSER_UI_SIGNIN_INTERACTION_SIGNIN_INTERACTION_CONTROLLER_EGTEST_UTIL_H_
#import <EarlGrey/EarlGrey.h>
#import <Foundation/Foundation.h>
// Changes the EarlGrey synchronization status to |enabled|.
void SetEarlGreySynchronizationEnabled(BOOL enabled);
// Taps the button with accessibility label |label|.
void TapButtonWithAccessibilityLabel(NSString* label);
// Taps the button with accessibility labelId |message_id|.
void TapButtonWithLabelId(int message_id);
// Verifies that the Chrome sign-in view is visible.
void VerifyChromeSigninViewVisible();
// Wait until |matcher| is accessible (not nil).
void WaitForMatcher(id<GREYMatcher> matcher);
#endif // IOS_CHROME_BROWSER_UI_SIGNIN_INTERACTION_SIGNIN_INTERACTION_CONTROLLER_EGTEST_UTIL_H_
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/signin_interaction/signin_interaction_controller_egtest_util.h"
#import "base/test/ios/wait_util.h"
#include "components/unified_consent/feature.h"
#import "ios/chrome/browser/ui/authentication/signin_earlgrey_utils.h"
#include "ios/chrome/grit/ios_strings.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
#import "ios/chrome/test/earl_grey/chrome_error_util.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
void SetEarlGreySynchronizationEnabled(BOOL enabled) {
[[GREYConfiguration sharedInstance]
setValue:[NSNumber numberWithBool:enabled]
forConfigKey:kGREYConfigKeySynchronizationEnabled];
}
void TapButtonWithAccessibilityLabel(NSString* label) {
id<GREYMatcher> matcher =
chrome_test_util::ButtonWithAccessibilityLabel(label);
[[EarlGrey selectElementWithMatcher:matcher] performAction:grey_tap()];
}
void TapButtonWithLabelId(int message_id) {
id<GREYMatcher> matcher =
chrome_test_util::ButtonWithAccessibilityLabelId(message_id);
[[EarlGrey selectElementWithMatcher:matcher] performAction:grey_tap()];
}
void VerifyChromeSigninViewVisible() {
id<GREYMatcher> signin_matcher =
chrome_test_util::StaticTextWithAccessibilityLabelId(
unified_consent::IsUnifiedConsentFeatureEnabled()
? IDS_IOS_ACCOUNT_UNIFIED_CONSENT_SYNC_SUBTITLE
: IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_DESCRIPTION);
[[EarlGrey selectElementWithMatcher:signin_matcher]
assertWithMatcher:grey_sufficientlyVisible()];
}
void WaitForMatcher(id<GREYMatcher> matcher) {
ConditionBlock condition = ^{
NSError* error = nil;
[[EarlGrey selectElementWithMatcher:matcher] assertWithMatcher:grey_notNil()
error:&error];
return error == nil;
};
GREYAssert(base::test::ios::WaitUntilConditionOrTimeout(
base::test::ios::kWaitForUIElementTimeout, condition),
@"Waiting for matcher %@ failed.", matcher);
}
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import <EarlGrey/EarlGrey.h>
#import <XCTest/XCTest.h>
#include "base/auto_reset.h"
#include "base/strings/sys_string_conversions.h"
#import "base/test/ios/wait_util.h"
#include "base/test/scoped_feature_list.h"
#include "components/unified_consent/feature.h"
#import "ios/chrome/browser/ui/authentication/chrome_signin_view_controller.h"
#import "ios/chrome/browser/ui/authentication/signin_earl_grey_ui.h"
#import "ios/chrome/browser/ui/authentication/signin_earlgrey_utils.h"
#import "ios/chrome/browser/ui/commands/application_commands.h"
#import "ios/chrome/browser/ui/commands/open_new_tab_command.h"
#import "ios/chrome/browser/ui/signin_interaction/signin_interaction_controller_egtest_util.h"
#include "ios/chrome/browser/ui/util/ui_util.h"
#include "ios/chrome/grit/ios_strings.h"
#import "ios/chrome/test/app/chrome_test_util.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
#import "ios/chrome/test/earl_grey/chrome_error_util.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h"
#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
using chrome_test_util::SecondarySignInButton;
using chrome_test_util::SettingsDoneButton;
// Sign-in interaction tests that requires Unified Consent to be disabled.
@interface SigninInteractionControllerUnityDisabledTestCase : ChromeTestCase
@end
@implementation SigninInteractionControllerUnityDisabledTestCase
- (void)setUp {
[super setUp];
CHECK(!unified_consent::IsUnifiedConsentFeatureEnabled())
<< "This test suite must be run with Unified Consent feature disabled.";
}
// Tests that switching from a managed account to a non-managed account works
// correctly and displays the expected warnings.
- (void)testSignInSwitchManagedAccount {
// Set up the fake identities.
ios::FakeChromeIdentityService* identity_service =
ios::FakeChromeIdentityService::GetInstanceFromChromeProvider();
ChromeIdentity* managed_identity = [SigninEarlGreyUtils fakeManagedIdentity];
ChromeIdentity* identity = [SigninEarlGreyUtils fakeIdentity1];
identity_service->AddIdentity(managed_identity);
identity_service->AddIdentity(identity);
[ChromeEarlGreyUI openSettingsMenu];
[ChromeEarlGreyUI tapSettingsMenuButton:SecondarySignInButton()];
[SigninEarlGreyUI selectIdentityWithEmail:managed_identity.userEmail];
// Accept warning for signing into a managed identity, with synchronization
// off due to an infinite spinner.
SetEarlGreySynchronizationEnabled(NO);
WaitForMatcher(chrome_test_util::ButtonWithAccessibilityLabelId(
IDS_IOS_MANAGED_SIGNIN_ACCEPT_BUTTON));
TapButtonWithLabelId(IDS_IOS_MANAGED_SIGNIN_ACCEPT_BUTTON);
SetEarlGreySynchronizationEnabled(YES);
[SigninEarlGreyUI confirmSigninConfirmationDialog];
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:managed_identity]);
// Switch Sync account to |identity|.
[[EarlGrey selectElementWithMatcher:chrome_test_util::SettingsAccountButton()]
performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:chrome_test_util::AccountsSyncButton()]
performAction:grey_tap()];
TapButtonWithAccessibilityLabel(identity.userEmail);
SetEarlGreySynchronizationEnabled(NO);
WaitForMatcher(chrome_test_util::ButtonWithAccessibilityLabelId(
IDS_IOS_MANAGED_SWITCH_ACCEPT_BUTTON));
TapButtonWithLabelId(IDS_IOS_MANAGED_SWITCH_ACCEPT_BUTTON);
SetEarlGreySynchronizationEnabled(YES);
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity]);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
}
// Tests signing in with one account, switching sync account to a second and
// choosing to keep the browsing data separate during the switch.
- (void)testSignInSwitchAccountsAndKeepDataSeparate {
// Set up the fake identities.
ios::FakeChromeIdentityService* identity_service =
ios::FakeChromeIdentityService::GetInstanceFromChromeProvider();
ChromeIdentity* identity1 = [SigninEarlGreyUtils fakeIdentity1];
ChromeIdentity* identity2 = [SigninEarlGreyUtils fakeIdentity2];
identity_service->AddIdentity(identity1);
identity_service->AddIdentity(identity2);
[SigninEarlGreyUI signinWithIdentity:identity1];
[ChromeEarlGreyUI openSettingsMenu];
// Open accounts settings, then sync settings.
[[EarlGrey selectElementWithMatcher:chrome_test_util::SettingsAccountButton()]
performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:chrome_test_util::AccountsSyncButton()]
performAction:grey_tap()];
// Switch Sync account to |identity2|.
TapButtonWithAccessibilityLabel(identity2.userEmail);
[[EarlGrey selectElementWithMatcher:
chrome_test_util::SettingsImportDataKeepSeparateButton()]
performAction:grey_tap()];
id<GREYMatcher> matcher = grey_allOf(
chrome_test_util::ButtonWithAccessibilityLabelId(
IDS_IOS_OPTIONS_IMPORT_DATA_CONTINUE_BUTTON),
grey_not(grey_accessibilityTrait(UIAccessibilityTraitNotEnabled)), nil);
[[EarlGrey selectElementWithMatcher:matcher] performAction:grey_tap()];
// Check the signed-in user did change.
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity2]);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
}
// Tests signing in with one account, switching sync account to a second and
// choosing to import the browsing data during the switch.
- (void)testSignInSwitchAccountsAndImportData {
// Set up the fake identities.
ios::FakeChromeIdentityService* identity_service =
ios::FakeChromeIdentityService::GetInstanceFromChromeProvider();
ChromeIdentity* identity1 = [SigninEarlGreyUtils fakeIdentity1];
ChromeIdentity* identity2 = [SigninEarlGreyUtils fakeIdentity2];
identity_service->AddIdentity(identity1);
identity_service->AddIdentity(identity2);
// Sign in to |identity1|.
[SigninEarlGreyUI signinWithIdentity:identity1];
[ChromeEarlGreyUI openSettingsMenu];
// Open accounts settings, then sync settings.
[[EarlGrey selectElementWithMatcher:chrome_test_util::SettingsAccountButton()]
performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:chrome_test_util::AccountsSyncButton()]
performAction:grey_tap()];
// Switch Sync account to |identity2|.
TapButtonWithAccessibilityLabel(identity2.userEmail);
[[EarlGrey selectElementWithMatcher:chrome_test_util::
SettingsImportDataImportButton()]
performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:
grey_allOf(chrome_test_util::ButtonWithAccessibilityLabelId(
IDS_IOS_OPTIONS_IMPORT_DATA_CONTINUE_BUTTON),
grey_userInteractionEnabled(), nil)]
performAction:grey_tap()];
// Check the signed-in user did change.
CHROME_EG_ASSERT_NO_ERROR(
[SigninEarlGreyUtils checkSignedInWithIdentity:identity2]);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
}
// Opens the add account screen and then cancels it by opening a new tab.
// Ensures that the add account screen is correctly dismissed. crbug.com/462200
- (void)testSignInCancelAddAccount {
// Add an identity to avoid arriving on the Add Account screen when opening
// sign-in.
ChromeIdentity* identity = [SigninEarlGreyUtils fakeIdentity1];
ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity(
identity);
[ChromeEarlGreyUI openSettingsMenu];
[ChromeEarlGreyUI tapSettingsMenuButton:SecondarySignInButton()];
// Open Add Account screen.
id<GREYMatcher> add_account_matcher =
chrome_test_util::StaticTextWithAccessibilityLabelId(
unified_consent::IsUnifiedConsentFeatureEnabled()
? IDS_IOS_ACCOUNT_IDENTITY_CHOOSER_ADD_ACCOUNT
: IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_ADD_ACCOUNT_BUTTON);
[[EarlGrey selectElementWithMatcher:add_account_matcher]
performAction:grey_tap()];
[[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
// Open new tab to cancel sign-in.
OpenNewTabCommand* command =
[OpenNewTabCommand commandWithURLFromChrome:GURL("about:blank")];
[chrome_test_util::DispatcherForActiveBrowserViewController()
openURLInNewTab:command];
// Re-open the sign-in screen. If it wasn't correctly dismissed previously,
// this will fail.
[ChromeEarlGreyUI openSettingsMenu];
[ChromeEarlGreyUI tapSettingsMenuButton:SecondarySignInButton()];
if (unified_consent::IsUnifiedConsentFeatureEnabled())
[SigninEarlGreyUI selectIdentityWithEmail:identity.userEmail];
VerifyChromeSigninViewVisible();
// Close sign-in screen and Settings.
TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON);
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()];
}
@end
......@@ -153,6 +153,10 @@ id<GREYMatcher> SettingsMenuButton();
// Returns matcher for the "Done" button in the settings' navigation bar.
id<GREYMatcher> SettingsDoneButton();
// Returns matcher for the "Confirm" button in the Sync and Google Services
// settings' navigation bar.
id<GREYMatcher> SyncSettingsConfirmButton();
// Returns matcher for the tools menu table view.
id<GREYMatcher> ToolsMenuView();
......@@ -181,6 +185,9 @@ id<GREYMatcher> SettingsImportDataImportButton();
// Returns matcher for the Keep Data Separate cell in switch sync account view.
id<GREYMatcher> SettingsImportDataKeepSeparateButton();
// Returns matcher for the Keep Data Separate cell in switch sync account view.
id<GREYMatcher> SettingsImportDataContinueButton();
// Returns matcher for the Manage Synced Data button in sync setting view.
id<GREYMatcher> SettingsSyncManageSyncedDataButton();
......
......@@ -197,6 +197,10 @@ id<GREYMatcher> SettingsDoneButton() {
return [ChromeMatchersAppInterface settingsDoneButton];
}
id<GREYMatcher> SyncSettingsConfirmButton() {
return [ChromeMatchersAppInterface syncSettingsConfirmButton];
}
id<GREYMatcher> ToolsMenuView() {
return [ChromeMatchersAppInterface toolsMenuView];
}
......@@ -229,6 +233,10 @@ id<GREYMatcher> SettingsImportDataKeepSeparateButton() {
return [ChromeMatchersAppInterface settingsImportDataKeepSeparateButton];
}
id<GREYMatcher> SettingsImportDataContinueButton() {
return [ChromeMatchersAppInterface settingsImportDataContinueButton];
}
id<GREYMatcher> SettingsSyncManageSyncedDataButton() {
return [ChromeMatchersAppInterface settingsSyncManageSyncedDataButton];
}
......
......@@ -154,6 +154,10 @@
// Returns matcher for the "Done" button in the settings' navigation bar.
+ (id<GREYMatcher>)settingsDoneButton;
// Returns matcher for the "Confirm" button in the Sync and Google services
// settings' navigation bar.
+ (id<GREYMatcher>)syncSettingsConfirmButton;
// Returns matcher for the tools menu table view.
+ (id<GREYMatcher>)toolsMenuView;
......@@ -182,6 +186,10 @@
// Returns matcher for the Keep Data Separate cell in switch sync account view.
+ (id<GREYMatcher>)settingsImportDataKeepSeparateButton;
// Returns matcher for the Continue navigation button in switch sync account
// view.
+ (id<GREYMatcher>)settingsImportDataContinueButton;
// Returns matcher for the Manage Synced Data button in sync setting view.
+ (id<GREYMatcher>)settingsSyncManageSyncedDataButton;
......
......@@ -25,6 +25,7 @@
#import "ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_collection_view_controller.h"
#import "ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_ui_constants.h"
#import "ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/google_services/advanced_signin_settings_coordinator.h"
#import "ios/chrome/browser/ui/settings/import_data_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/settings_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/sync/sync_settings_table_view_controller.h"
......@@ -389,6 +390,10 @@ UIView* SubviewWithAccessibilityIdentifier(NSString* accessibility_id,
return grey_accessibilityID(kSettingsDoneButtonId);
}
+ (id<GREYMatcher>)syncSettingsConfirmButton {
return grey_accessibilityID(kSyncSettingsConfirmButtonId);
}
+ (id<GREYMatcher>)toolsMenuView {
return grey_accessibilityID(kPopupMenuToolsMenuTableViewId);
}
......@@ -421,6 +426,10 @@ UIView* SubviewWithAccessibilityIdentifier(NSString* accessibility_id,
return grey_accessibilityID(kImportDataKeepSeparateCellId);
}
+ (id<GREYMatcher>)settingsImportDataContinueButton {
return grey_accessibilityID(kImportDataContinueButtonId);
}
+ (id<GREYMatcher>)settingsSyncManageSyncedDataButton {
return grey_accessibilityID(kSettingsSyncId);
}
......
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