Commit d777f5d0 authored by Sébastien Séguin-Gagnon's avatar Sébastien Séguin-Gagnon Committed by Commit Bot

Reland "[Empties] Enable the IllustratedEmptyStates field trial testing config."

This is a reland of 74b8ec6f

Original change's description:
> [Empties] Enable the IllustratedEmptyStates field trial testing config.
> 
> Change-Id: I664fa63b5b69369cb69fb4b87463ba3bb4cfc94d
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2386295
> Reviewed-by: Sergio Collazos <sczs@chromium.org>
> Reviewed-by: Steven Holte <holte@chromium.org>
> Commit-Queue: sebsg <sebsg@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#805136}

Change-Id: Ieb3e461efb4c55e7ef601417819cc4470e8fe4cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2401398
Commit-Queue: sebsg <sebsg@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Auto-Submit: sebsg <sebsg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807867}
parent 70ab9853
......@@ -152,11 +152,15 @@ using chrome_test_util::SignOutAccountsButton;
+ (void)verifySigninPromoVisibleWithMode:(SigninPromoViewMode)mode
closeButton:(BOOL)closeButton {
[ChromeEarlGreyUI waitForAppToIdle];
[[EarlGrey
selectElementWithMatcher:grey_allOf(
grey_accessibilityID(kSigninPromoViewId),
grey_sufficientlyVisible(), nil)]
assertWithMatcher:grey_notNil()];
// The sign-in promo is not visible when showing illustrated empty states.
if (![ChromeEarlGrey isIllustratedEmptyStatesEnabled]) {
[[EarlGrey
selectElementWithMatcher:grey_allOf(
grey_accessibilityID(kSigninPromoViewId),
grey_sufficientlyVisible(), nil)]
assertWithMatcher:grey_notNil()];
}
[[EarlGrey
selectElementWithMatcher:grey_allOf(PrimarySignInButton(),
grey_sufficientlyVisible(), nil)]
......@@ -169,10 +173,13 @@ using chrome_test_util::SignOutAccountsButton;
assertWithMatcher:grey_nil()];
break;
case SigninPromoViewModeWarmState:
[[EarlGrey
selectElementWithMatcher:grey_allOf(SecondarySignInButton(),
grey_sufficientlyVisible(), nil)]
assertWithMatcher:grey_notNil()];
if (![ChromeEarlGrey isIllustratedEmptyStatesEnabled]) {
[[EarlGrey
selectElementWithMatcher:grey_allOf(SecondarySignInButton(),
grey_sufficientlyVisible(),
nil)]
assertWithMatcher:grey_notNil()];
}
break;
}
if (closeButton) {
......
......@@ -4,6 +4,7 @@
#import "ios/chrome/browser/ui/bookmarks/bookmark_earl_grey_ui.h"
#include "base/ios/ios_util.h"
#include "base/mac/foundation_util.h"
#import "base/test/ios/wait_util.h"
#include "build/build_config.h"
......@@ -361,12 +362,19 @@ id<GREYMatcher> SearchIconButton() {
}
- (void)verifyEmptyBackgroundAppears {
id<GREYMatcher> emptyBackground =
grey_accessibilityID([ChromeEarlGrey isIllustratedEmptyStatesEnabled]
? kTableViewIllustratedEmptyViewID
: kBookmarkEmptyStateExplanatoryLabelIdentifier);
[[EarlGrey selectElementWithMatcher:emptyBackground]
assertWithMatcher:grey_sufficientlyVisible()];
if ([ChromeEarlGrey isIllustratedEmptyStatesEnabled]) {
[[EarlGrey selectElementWithMatcher:grey_accessibilityID(
kTableViewIllustratedEmptyViewID)]
assertWithMatcher:grey_notNil()];
[[EarlGrey selectElementWithMatcher:grey_text(l10n_util::GetNSString(
IDS_IOS_BOOKMARK_EMPTY_MESSAGE))]
assertWithMatcher:grey_sufficientlyVisible()];
} else {
[[EarlGrey
selectElementWithMatcher:
grey_accessibilityID(kBookmarkEmptyStateExplanatoryLabelIdentifier)]
assertWithMatcher:grey_sufficientlyVisible()];
}
}
- (void)verifyEmptyState {
......@@ -375,10 +383,10 @@ id<GREYMatcher> SearchIconButton() {
id<GREYInteraction> searchBar =
[EarlGrey selectElementWithMatcher:grey_accessibilityTrait(
UIAccessibilityTraitSearchField)];
if ([ChromeEarlGrey isIllustratedEmptyStatesEnabled]) {
// With the illustrated empty state, the search bar should be hidden.
[searchBar assertWithMatcher:grey_nil()];
} else {
// TODO(crbug.com/1126982): Fix the search bar issue on iOS 12.4.
// The search bar should not be visible when the illustrated empty state is
// shown.
if (![ChromeEarlGrey isIllustratedEmptyStatesEnabled]) {
[searchBar assertWithMatcher:grey_notNil()];
}
}
......
......@@ -759,7 +759,7 @@ using chrome_test_util::TappableBookmarkNodeWithLabel;
// Reopen bookmarks.
[BookmarkEarlGreyUI openBookmarks];
if (base::FeatureList::IsEnabled(kIllustratedEmptyStates)) {
if ([ChromeEarlGrey isIllustratedEmptyStatesEnabled]) {
// Ensure the root node is opened, by verifying that there isn't a Back
// button in the navigation bar.
[[EarlGrey selectElementWithMatcher:chrome_test_util::
......@@ -866,7 +866,7 @@ using chrome_test_util::TappableBookmarkNodeWithLabel;
- (void)testRootEmptyState {
[BookmarkEarlGreyUI openBookmarks];
if (base::FeatureList::IsEnabled(kIllustratedEmptyStates)) {
if ([ChromeEarlGrey isIllustratedEmptyStatesEnabled]) {
// When the user has no bookmarks, the root view should be an empty state.
[BookmarkEarlGreyUI verifyEmptyState];
} else {
......@@ -894,7 +894,7 @@ using chrome_test_util::TappableBookmarkNodeWithLabel;
BookmarksNavigationBarBackButton()]
performAction:grey_tap()];
if (base::FeatureList::IsEnabled(kIllustratedEmptyStates)) {
if ([ChromeEarlGrey isIllustratedEmptyStatesEnabled]) {
// When the user has no bookmarks, the root view should be an empty state.
[BookmarkEarlGreyUI verifyEmptyState];
} else {
......
......@@ -164,10 +164,7 @@ void SearchBookmarksForText(NSString* search_text) {
- (void)testEmptyManagedBookmarks {
[BookmarkEarlGreyUI openBookmarks];
// Mobile bookmarks exists.
[[EarlGrey selectElementWithMatcher:TappableBookmarkNodeWithLabel(
@"Mobile Bookmarks")]
assertWithMatcher:grey_notNil()];
[BookmarkEarlGreyUI verifyEmptyState];
// Managed bookmarks folder does not exist.
[[EarlGrey selectElementWithMatcher:TappableBookmarkNodeWithLabel(
......
......@@ -144,8 +144,8 @@ id<GREYMatcher> TitleOfTestPage() {
IDS_HISTORY_TITLE)),
grey_accessibilityTrait(
UIAccessibilityTraitHeader),
nil)]
assertWithMatcher:grey_sufficientlyVisible()];
grey_sufficientlyVisible(), nil)]
assertWithMatcher:grey_notNil()];
// Close History.
id<GREYMatcher> exitMatcher =
......
......@@ -226,11 +226,17 @@ id<GREYMatcher> NoBookmarksLabel() {
// Open the Bookmarks screen on the Tools menu.
[BookmarkEarlGreyUI openBookmarks];
[BookmarkEarlGreyUI openMobileBookmarks];
// Assert that there are no bookmarks.
[[EarlGrey selectElementWithMatcher:NoBookmarksLabel()]
assertWithMatcher:grey_notNil()];
if ([ChromeEarlGrey isIllustratedEmptyStatesEnabled]) {
// The empty background appears in the root directory if the leaf folders
// are empty.
[BookmarkEarlGreyUI verifyEmptyBackgroundAppears];
} else {
[BookmarkEarlGreyUI openMobileBookmarks];
[[EarlGrey selectElementWithMatcher:NoBookmarksLabel()]
assertWithMatcher:grey_notNil()];
}
}
// Tests that signing out from a managed user account clears the user's data.
......@@ -249,11 +255,17 @@ id<GREYMatcher> NoBookmarksLabel() {
// Open the Bookmarks screen on the Tools menu.
[BookmarkEarlGreyUI openBookmarks];
[BookmarkEarlGreyUI openMobileBookmarks];
// Assert that there are no bookmarks.
[[EarlGrey selectElementWithMatcher:NoBookmarksLabel()]
assertWithMatcher:grey_notNil()];
if ([ChromeEarlGrey isIllustratedEmptyStatesEnabled]) {
// The empty background appears in the root directory if the leaf folders
// are empty.
[BookmarkEarlGreyUI verifyEmptyBackgroundAppears];
} else {
[BookmarkEarlGreyUI openMobileBookmarks];
[[EarlGrey selectElementWithMatcher:NoBookmarksLabel()]
assertWithMatcher:grey_notNil()];
}
}
// Tests that given two accounts A and B that are available on the device -
......
......@@ -3562,6 +3562,21 @@
]
}
],
"IllustratedEmptyStates": [
{
"platforms": [
"ios"
],
"experiments": [
{
"name": "Enabled",
"enable_features": [
"IllustratedEmptyStates"
]
}
]
}
],
"IncludeBetaForumMenuItem": [
{
"platforms": [
......
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