Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: ios/chrome/browser/ui/bookmarks/bookmarks_egtest.mm

Issue 2662473003: Removing "All Bookmarks" (Closed)
Patch Set: feedback Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <vector> 5 #include <vector>
6 6
7 #import <EarlGrey/EarlGrey.h> 7 #import <EarlGrey/EarlGrey.h>
8 #import <UIKit/UIKit.h> 8 #import <UIKit/UIKit.h>
9 #import <XCTest/XCTest.h> 9 #import <XCTest/XCTest.h>
10 10
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 [[self class] setupStandardBookmarks]; 998 [[self class] setupStandardBookmarks];
999 [[self class] openBookmarkFolder:@"Folder 1"]; 999 [[self class] openBookmarkFolder:@"Folder 1"];
1000 [[EarlGrey selectElementWithMatcher:grey_text(@"Folder 2")] 1000 [[EarlGrey selectElementWithMatcher:grey_text(@"Folder 2")]
1001 performAction:grey_tap()]; 1001 performAction:grey_tap()];
1002 [[EarlGrey selectElementWithMatcher:grey_text(@"Folder 3")] 1002 [[EarlGrey selectElementWithMatcher:grey_text(@"Folder 3")]
1003 performAction:grey_tap()]; 1003 performAction:grey_tap()];
1004 1004
1005 [[self class] removeBookmarkWithTitle:@"Folder 1"]; 1005 [[self class] removeBookmarkWithTitle:@"Folder 1"];
1006 1006
1007 NSString* rootFolderTitle = nil; 1007 NSString* rootFolderTitle = nil;
1008 if (experimental_flags::IsAllBookmarksEnabled()) { 1008 rootFolderTitle = @"Mobile Bookmarks";
1009 rootFolderTitle = @"Bookmarks";
1010 } else {
1011 rootFolderTitle = @"Mobile Bookmarks";
1012 }
1013 1009
1014 // Folder 2 and 3 are now deleted, UI should have moved to top level folder. 1010 // Folder 2 and 3 are now deleted, UI should have moved to top level folder.
1015 [[EarlGrey 1011 [[EarlGrey
1016 selectElementWithMatcher:grey_allOf( 1012 selectElementWithMatcher:grey_allOf(
1017 grey_kindOfClass(NSClassFromString( 1013 grey_kindOfClass(NSClassFromString(
1018 @"BookmarkNavigationBar")), 1014 @"BookmarkNavigationBar")),
1019 grey_descendant(grey_text(rootFolderTitle)), 1015 grey_descendant(grey_text(rootFolderTitle)),
1020 nil)] assertWithMatcher:grey_notNil()]; 1016 nil)] assertWithMatcher:grey_notNil()];
1021 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Folder 1")] 1017 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Folder 1")]
1022 assertWithMatcher:grey_notVisible()]; 1018 assertWithMatcher:grey_notVisible()];
1023 1019
1024 if (IsCompact()) { 1020 if (IsCompact()) {
1025 // Opens the bookmark manager sidebar on handsets. 1021 // Opens the bookmark manager sidebar on handsets.
1026 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Menu")] 1022 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Menu")]
1027 performAction:grey_tap()]; 1023 performAction:grey_tap()];
1028 1024
1029 // Test that the root folder is selected in the menu. This is only the case 1025 // Test that the root folder is selected in the menu. This is only the case
1030 // on iPhone. 1026 // on iPhone.
1031 if (experimental_flags::IsAllBookmarksEnabled()) {
1032 rootFolderTitle = @"All Bookmarks";
1033 }
1034
1035 GREYElementMatcherBlock* selectedMatcher = 1027 GREYElementMatcherBlock* selectedMatcher =
1036 [GREYElementMatcherBlock matcherWithMatchesBlock:^BOOL(id element) { 1028 [GREYElementMatcherBlock matcherWithMatchesBlock:^BOOL(id element) {
1037 UITableViewCell* cell = (UITableViewCell*)element; 1029 UITableViewCell* cell = (UITableViewCell*)element;
1038 return [cell isSelected]; 1030 return [cell isSelected];
1039 } 1031 }
1040 descriptionBlock:^void(id<GREYDescription> description) { 1032 descriptionBlock:^void(id<GREYDescription> description) {
1041 [description appendText:@"Selected UI element."]; 1033 [description appendText:@"Selected UI element."];
1042 }]; 1034 }];
1043 [[EarlGrey 1035 [[EarlGrey
1044 selectElementWithMatcher:grey_allOf(grey_kindOfClass(NSClassFromString( 1036 selectElementWithMatcher:grey_allOf(grey_kindOfClass(NSClassFromString(
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 [[EarlGrey 1286 [[EarlGrey
1295 selectElementWithMatcher:grey_allOf( 1287 selectElementWithMatcher:grey_allOf(
1296 grey_kindOfClass( 1288 grey_kindOfClass(
1297 NSClassFromString(@"BookmarkMenuCell")), 1289 NSClassFromString(@"BookmarkMenuCell")),
1298 grey_descendant(grey_text(bookmarkFolder)), 1290 grey_descendant(grey_text(bookmarkFolder)),
1299 nil)] performAction:grey_tap()]; 1291 nil)] performAction:grey_tap()];
1300 } 1292 }
1301 1293
1302 // Navigates to the bookmark manager UI, and selects the top level folder. 1294 // Navigates to the bookmark manager UI, and selects the top level folder.
1303 + (void)openTopLevelBookmarksFolder { 1295 + (void)openTopLevelBookmarksFolder {
1304 if (experimental_flags::IsAllBookmarksEnabled()) { 1296 [BookmarksTestCase openMobileBookmarks];
1305 [BookmarksTestCase openBookmarkFolder:@"All Bookmarks"];
1306 } else {
1307 [BookmarksTestCase openMobileBookmarks];
1308 }
1309 } 1297 }
1310 1298
1311 // Navigates to the bookmark manager UI, and selects MobileBookmarks. 1299 // Navigates to the bookmark manager UI, and selects MobileBookmarks.
1312 + (void)openMobileBookmarks { 1300 + (void)openMobileBookmarks {
1313 [BookmarksTestCase openBookmarkFolder:@"Mobile Bookmarks"]; 1301 [BookmarksTestCase openBookmarkFolder:@"Mobile Bookmarks"];
1314 } 1302 }
1315 1303
1316 // Adds a bookmark, then navigates to the bookmark manager UI, and 1304 // Adds a bookmark, then navigates to the bookmark manager UI, and
1317 // selects MobileBookmarks. 1305 // selects MobileBookmarks.
1318 + (void)openMobileBookmarksPrepopulatedWithOneBookmark { 1306 + (void)openMobileBookmarksPrepopulatedWithOneBookmark {
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 if (!IsCompact()) { 1680 if (!IsCompact()) {
1693 [[EarlGrey selectElementWithMatcher:StarButton()] performAction:grey_tap()]; 1681 [[EarlGrey selectElementWithMatcher:StarButton()] performAction:grey_tap()];
1694 } else { 1682 } else {
1695 [ChromeEarlGreyUI openToolsMenu]; 1683 [ChromeEarlGreyUI openToolsMenu];
1696 [[EarlGrey selectElementWithMatcher:AddBookmarkButton()] 1684 [[EarlGrey selectElementWithMatcher:AddBookmarkButton()]
1697 performAction:grey_tap()]; 1685 performAction:grey_tap()];
1698 } 1686 }
1699 } 1687 }
1700 1688
1701 @end 1689 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698