Commit 883fd8e4 authored by Mihai Sardarescu's avatar Mihai Sardarescu Committed by Commit Bot

Run bookmarks earl grey tests on the unified consent enabled bot

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

This CL also fixes the test testSignInPromoWithWarmStateUsingPrimaryButton
that was actually tapping the secondary sign-in button (not the primary
one), and thus was a duplicate of testSignInPromoWithWarmStateUsingSecondaryButton.

Note: There are a significant number of earl grey tests for bookmarks,
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: I6a998fb29b1dd352c37dcc9ace516a0254b804e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1617513
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661347}
parent fec2080c
...@@ -163,6 +163,7 @@ source_set("eg_tests") { ...@@ -163,6 +163,7 @@ source_set("eg_tests") {
"//components/bookmarks/browser", "//components/bookmarks/browser",
"//components/prefs", "//components/prefs",
"//components/strings", "//components/strings",
"//components/unified_consent",
"//ios/chrome/app/strings", "//ios/chrome/app/strings",
"//ios/chrome/browser", "//ios/chrome/browser",
"//ios/chrome/browser/bookmarks", "//ios/chrome/browser/bookmarks",
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "components/bookmarks/browser/titled_url_match.h" #include "components/bookmarks/browser/titled_url_match.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#include "components/unified_consent/feature.h"
#include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/pref_names.h" #include "ios/chrome/browser/pref_names.h"
...@@ -2805,10 +2806,19 @@ id<GREYMatcher> SearchIconButton() { ...@@ -2805,10 +2806,19 @@ id<GREYMatcher> SearchIconButton() {
selectElementWithMatcher:grey_allOf(PrimarySignInButton(), selectElementWithMatcher:grey_allOf(PrimarySignInButton(),
grey_sufficientlyVisible(), nil)] grey_sufficientlyVisible(), nil)]
performAction:grey_tap()]; performAction:grey_tap()];
[[EarlGrey if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
selectElementWithMatcher:grey_allOf(grey_buttonTitle(@"Cancel"), // Cancel the sign-in operation.
grey_sufficientlyVisible(), nil)] [[EarlGrey selectElementWithMatcher:
performAction:grey_tap()]; 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()];
}
// Check that the bookmarks UI reappeared and the cell is still here. // Check that the bookmarks UI reappeared and the cell is still here.
[BookmarksTestCase verifyPromoAlreadySeen:NO]; [BookmarksTestCase verifyPromoAlreadySeen:NO];
...@@ -2833,18 +2843,25 @@ id<GREYMatcher> SearchIconButton() { ...@@ -2833,18 +2843,25 @@ id<GREYMatcher> SearchIconButton() {
[SigninEarlGreyUI [SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeWarmState]; checkSigninPromoVisibleWithMode:SigninPromoViewModeWarmState];
// Tap the Sign in button. // Tap the primary button.
[[EarlGrey [[EarlGrey
selectElementWithMatcher:grey_allOf(grey_accessibilityID( selectElementWithMatcher:grey_allOf(PrimarySignInButton(),
kSigninPromoSecondaryButtonId),
grey_sufficientlyVisible(), nil)] grey_sufficientlyVisible(), nil)]
performAction:grey_tap()]; performAction:grey_tap()];
// Tap the CANCEL button. if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
[[EarlGrey selectElementWithMatcher: // Cancel the sign-in operation.
grey_buttonTitle([l10n_util::GetNSString( [[EarlGrey selectElementWithMatcher:
IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON) grey_buttonTitle([l10n_util::GetNSString(
uppercaseString])] performAction:grey_tap()]; IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON)
uppercaseString])] performAction:grey_tap()];
} else {
// Undo the sign-in operation.
[[EarlGrey selectElementWithMatcher:
grey_buttonTitle([l10n_util::GetNSString(
IDS_IOS_ACCOUNT_CONSISTENCY_CONFIRMATION_UNDO_BUTTON)
uppercaseString])] performAction:grey_tap()];
}
// 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
...@@ -2875,6 +2892,11 @@ id<GREYMatcher> SearchIconButton() { ...@@ -2875,6 +2892,11 @@ id<GREYMatcher> SearchIconButton() {
grey_sufficientlyVisible(), nil)] grey_sufficientlyVisible(), nil)]
performAction:grey_tap()]; performAction:grey_tap()];
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
// Select the identity to dismiss the identity chooser.
[SigninEarlGreyUI selectIdentityWithEmail:identity.userEmail];
}
// Tap the CANCEL button. // Tap the CANCEL button.
[[EarlGrey selectElementWithMatcher: [[EarlGrey selectElementWithMatcher:
grey_buttonTitle([l10n_util::GetNSString( grey_buttonTitle([l10n_util::GetNSString(
......
...@@ -210,6 +210,7 @@ chrome_ios_eg_test("ios_chrome_external_url_egtests") { ...@@ -210,6 +210,7 @@ chrome_ios_eg_test("ios_chrome_external_url_egtests") {
chrome_ios_eg_test("ios_chrome_unified_consent_egtests") { chrome_ios_eg_test("ios_chrome_unified_consent_egtests") {
deps = [ deps = [
"//ios/chrome/browser/ui/bookmarks:eg_tests",
"//ios/chrome/browser/ui/first_run:eg_tests", "//ios/chrome/browser/ui/first_run:eg_tests",
"//ios/chrome/browser/ui/settings/google_services:unified_consent_eg_tests", "//ios/chrome/browser/ui/settings/google_services:unified_consent_eg_tests",
"//ios/chrome/browser/ui/signin_interaction:unity_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