Commit 58d863b1 authored by Mihai Sardarescu's avatar Mihai Sardarescu Committed by Commit Bot

Run settings earl grey tests on the unified consent enabled bot

This CL updates the setting earl grey test to run with unified consent
feature enabled. It also adds the settings earl grey tests to the list
of tests that are run on the unified consent enabled bot.

Note: There are a significant number of earl grey tests for settings,
so this CL will significantly increase the time it takes to run the tests
on the ios-simulator-full-configs bots. However the unified consent enabled
bot is temporary and the current plan is to remove it once unified
consent feature is enabled by default.

Bug: 960260
Change-Id: If16d2d48f739b3e5e405a8b8976b84f75581e665
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1617443
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Reviewed-by: default avatarJérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661361}
parent 333799d2
......@@ -361,6 +361,7 @@ source_set("eg_tests") {
"//components/search_engines",
"//components/strings",
"//components/ukm/ios:features",
"//components/unified_consent",
"//ios/chrome/app:app_internal",
"//ios/chrome/app/strings",
"//ios/chrome/app/theme",
......
......@@ -90,6 +90,7 @@ source_set("eg_tests") {
"//components/browser_sync",
"//components/strings",
"//components/sync",
"//components/unified_consent",
"//ios/chrome/app/strings",
"//ios/chrome/browser",
"//ios/chrome/browser/browser_state",
......
......@@ -12,6 +12,7 @@
#include "components/sync/driver/sync_service.h"
#include "components/sync/engine/sync_encryption_handler.h"
#include "components/sync/protocol/proto_value_conversions.h"
#include "components/unified_consent/feature.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory.h"
#include "ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory_util.h"
......@@ -38,6 +39,7 @@
using chrome_test_util::AccountsSyncButton;
using chrome_test_util::ButtonWithAccessibilityLabel;
using chrome_test_util::GoogleServicesSettingsButton;
using chrome_test_util::SettingsAccountButton;
using chrome_test_util::SettingsDoneButton;
using chrome_test_util::SignOutAccountsButton;
......@@ -70,7 +72,9 @@ id<GREYMatcher> ButtonWithIdentity(ChromeIdentity* identity) {
[SigninEarlGreyUI signinWithIdentity:identity];
[ChromeEarlGreyUI openSettingsMenu];
[ChromeEarlGreyUI tapSettingsMenuButton:SettingsAccountButton()];
[ChromeEarlGreyUI tapAccountsMenuButton:AccountsSyncButton()];
if (!unified_consent::IsUnifiedConsentFeatureEnabled()) {
[ChromeEarlGreyUI tapAccountsMenuButton:AccountsSyncButton()];
}
// Forget |identity|, screens should be popped back to the Main Settings.
[[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
......@@ -148,6 +152,13 @@ id<GREYMatcher> ButtonWithIdentity(ChromeIdentity* identity) {
// Tests that the Sync Settings screen is correctly reloaded when one of the
// secondary accounts disappears.
- (void)testSignInReloadSyncOnForgetIdentity {
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
EARL_GREY_TEST_DISABLED(
@"Sync section was moved to the Sync and Google services settings "
"screen, so it is no longer present in the account settings screen. "
"This test is now covered by GoogleServicesSettingsTestCase.");
}
ios::FakeChromeIdentityService* identity_service =
ios::FakeChromeIdentityService::GetInstanceFromChromeProvider();
ChromeIdentity* identity1 = [SigninEarlGreyUtils fakeIdentity1];
......@@ -246,6 +257,8 @@ id<GREYMatcher> ButtonWithIdentity(ChromeIdentity* identity) {
- (void)checkSyncCellWithExpectedTextLabelCallback:
(ExpectedTextLabelCallback)callback {
NSAssert(callback, @"Need callback");
NSAssert(!unified_consent::IsUnifiedConsentFeatureEnabled(),
@"Only runs when unified consent is disabled");
ChromeIdentity* identity = [SigninEarlGreyUtils fakeIdentity1];
// Sign In |identity|, then open the Account Settings.
......@@ -272,6 +285,12 @@ id<GREYMatcher> ButtonWithIdentity(ChromeIdentity* identity) {
// Tests the sync cell is correctly configured when having a MDM error.
- (void)testMDMError {
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
EARL_GREY_TEST_DISABLED(
@"Sync section was moved to the Sync and Google services settings "
"screen, so it is no longer present in the account settings screen. "
"This test is now covered by GoogleServicesSettingsTestCase.");
}
ios::FakeChromeIdentityService* fakeChromeIdentityService =
ios::FakeChromeIdentityService::GetInstanceFromChromeProvider();
fakeChromeIdentityService->SetFakeMDMError(true);
......@@ -283,6 +302,13 @@ id<GREYMatcher> ButtonWithIdentity(ChromeIdentity* identity) {
// Tests the sync cell is correctly configured when no error.
- (void)testSyncItemWithSyncingMessage {
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
EARL_GREY_TEST_DISABLED(
@"Sync section was moved to the Sync and Google services settings "
"screen, so it is no longer present in the account settings screen. "
"This test is now covered by GoogleServicesSettingsTestCase.");
}
ExpectedTextLabelCallback callback = ^(NSString* identityEmail) {
return l10n_util::GetNSStringF(IDS_IOS_SIGN_IN_TO_CHROME_SETTING_SYNCING,
base::SysNSStringToUTF16(identityEmail));
......@@ -292,6 +318,13 @@ id<GREYMatcher> ButtonWithIdentity(ChromeIdentity* identity) {
// Tests the sync cell is correctly configured when the passphrase is required.
- (void)testSyncItemWithPassphraseRequired {
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
EARL_GREY_TEST_DISABLED(
@"Sync section was moved to the Sync and Google services settings "
"screen, so it is no longer present in the account settings screen. "
"This test is now covered by GoogleServicesSettingsTestCase.");
}
ExpectedTextLabelCallback callback = ^(NSString* identityEmail) {
ios::ChromeBrowserState* browser_state =
chrome_test_util::GetOriginalBrowserState();
......
......@@ -18,6 +18,7 @@
#include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h"
#include "components/ukm/ios/features.h"
#include "components/unified_consent/feature.h"
#import "ios/chrome/app/main_controller.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/content_settings/host_content_settings_map_factory.h"
......@@ -709,10 +710,20 @@ id<GREYMatcher> BandwidthSettingsButton() {
@"Settings should not register key commands when presented.");
// Dismiss the Sign-in UI.
id<GREYMatcher> cancelButton =
grey_allOf(grey_accessibilityID(@"cancel"),
grey_accessibilityTrait(UIAccessibilityTraitButton), nil);
[[EarlGrey selectElementWithMatcher:cancelButton] performAction:grey_tap()];
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
// Cancel the sign-in operation.
[[EarlGrey selectElementWithMatcher:
grey_buttonTitle([l10n_util::GetNSString(
IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON)
uppercaseString])] performAction:grey_tap()];
} else {
// Cancel the add account operation.
[[EarlGrey
selectElementWithMatcher:grey_allOf(grey_buttonTitle(@"Cancel"),
grey_sufficientlyVisible(), nil)]
performAction:grey_tap()];
}
// Wait for UI to finish closing the Sign-in screen.
[[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
......@@ -723,6 +734,13 @@ id<GREYMatcher> BandwidthSettingsButton() {
// Verifies the UI elements are accessible on the Send Usage Data page.
- (void)testAccessibilityOnSendUsageData {
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
EARL_GREY_TEST_DISABLED(
@"Privacy switch for ContentSuggestion was moved to the Sync and "
"Google services settings screen, so it is no longer present in the "
"privacy section. This test is now covered by "
"-[GoogleServicesSettingsTestCase testOpeningServices].");
}
[ChromeEarlGreyUI openSettingsMenu];
[ChromeEarlGreyUI tapSettingsMenuButton:SettingsMenuPrivacyButton()];
[ChromeEarlGreyUI tapPrivacyMenuButton:SendUsageDataButton()];
......
......@@ -6,6 +6,7 @@
#include "base/strings/sys_string_conversions.h"
#include "components/prefs/pref_service.h"
#include "components/unified_consent/feature.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/pref_names.h"
#import "ios/chrome/browser/ui/authentication/signin_earl_grey_ui.h"
......@@ -19,6 +20,7 @@
#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"
#include "ui/base/l10n/l10n_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
......@@ -42,10 +44,19 @@ using chrome_test_util::ButtonWithAccessibilityLabelId;
checkSigninPromoVisibleWithMode:SigninPromoViewModeColdState];
[ChromeEarlGreyUI tapSettingsMenuButton:PrimarySignInButton()];
[[EarlGrey
selectElementWithMatcher:grey_allOf(grey_buttonTitle(@"Cancel"),
grey_sufficientlyVisible(), nil)]
performAction:grey_tap()];
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
// Cancel the sign-in operation.
[[EarlGrey selectElementWithMatcher:
grey_buttonTitle([l10n_util::GetNSString(
IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON)
uppercaseString])] performAction:grey_tap()];
} else {
// Cancel the add account operation.
[[EarlGrey
selectElementWithMatcher:grey_allOf(grey_buttonTitle(@"Cancel"),
grey_sufficientlyVisible(), nil)]
performAction:grey_tap()];
}
[SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeColdState];
}
......
......@@ -212,6 +212,8 @@ chrome_ios_eg_test("ios_chrome_unified_consent_egtests") {
deps = [
"//ios/chrome/browser/ui/bookmarks:eg_tests",
"//ios/chrome/browser/ui/first_run:eg_tests",
"//ios/chrome/browser/ui/settings:eg_tests",
"//ios/chrome/browser/ui/settings/google_services:eg_tests",
"//ios/chrome/browser/ui/settings/google_services:unified_consent_eg_tests",
"//ios/chrome/browser/ui/signin_interaction:unity_eg_tests",
]
......
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