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

Unified Diff: ios/chrome/test/earl_grey/chrome_earl_grey_ui.mm

Issue 2867553002: Make settings_egtest.mm work in landscape on small phones. (Closed)
Patch Set: revert extra history_ui_egtest change Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/test/earl_grey/chrome_earl_grey_ui.h ('k') | ios/chrome/test/earl_grey/chrome_matchers.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/test/earl_grey/chrome_earl_grey_ui.mm
diff --git a/ios/chrome/test/earl_grey/chrome_earl_grey_ui.mm b/ios/chrome/test/earl_grey/chrome_earl_grey_ui.mm
index ef0722b5e2401a44b886c718d8783f9e9507b8b1..80be416519de31523169e96132582a09be389ef0 100644
--- a/ios/chrome/test/earl_grey/chrome_earl_grey_ui.mm
+++ b/ios/chrome/test/earl_grey/chrome_earl_grey_ui.mm
@@ -4,6 +4,8 @@
#import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
+#import "ios/chrome/browser/ui/settings/privacy_collection_view_controller.h"
+#import "ios/chrome/browser/ui/settings/settings_collection_view_controller.h"
#import "ios/chrome/browser/ui/tools_menu/tools_menu_constants.h"
#import "ios/chrome/browser/ui/tools_menu/tools_popup_controller.h"
#import "ios/chrome/browser/ui/uikit_ui_util.h"
@@ -18,9 +20,25 @@
#error "This file requires ARC support."
#endif
+using chrome_test_util::ButtonWithAccessibilityLabel;
+using chrome_test_util::ClearBrowsingDataCollectionView;
+using chrome_test_util::SettingsMenuButton;
using testing::WaitUntilConditionOrTimeout;
using testing::kWaitForPageLoadTimeout;
+namespace {
+
+// Returns a GREYAction to scroll down (swipe up) for a reasonably small amount.
+id<GREYAction> ScrollDown() {
+ // 150 is a reasonable value to ensure all menu items are seen, without too
+ // much delay. With a larger value, some menu items could be skipped while
+ // searching. A smaller value increses the area that is searched, but slows
+ // down the scroll.
+ CGFloat const kMenuScrollDisplacement = 150;
+ return grey_scrollInDirection(kGREYDirectionDown, kMenuScrollDisplacement);
+}
+} // namespace
+
@implementation ChromeEarlGreyUI
+ (void)openToolsMenu {
@@ -47,12 +65,39 @@ using testing::kWaitForPageLoadTimeout;
+ (void)openSettingsMenu {
[ChromeEarlGreyUI openToolsMenu];
- id<GREYMatcher> toolsMenuTableViewMatcher =
- grey_accessibilityID(kToolsMenuTableViewId);
- [[[EarlGrey
- selectElementWithMatcher:grey_accessibilityID(kToolsMenuSettingsId)]
- usingSearchAction:grey_scrollToContentEdge(kGREYContentEdgeBottom)
- onElementWithMatcher:toolsMenuTableViewMatcher] performAction:grey_tap()];
+ id<GREYMatcher> interactableSettingsButton =
+ grey_allOf(SettingsMenuButton(), grey_interactable(), nil);
+ [[[EarlGrey selectElementWithMatcher:interactableSettingsButton]
+ usingSearchAction:ScrollDown()
+ onElementWithMatcher:grey_accessibilityID(kToolsMenuTableViewId)]
+ performAction:grey_tap()];
+}
+
++ (void)tapSettingsMenuButton:(id<GREYMatcher>)buttonMatcher {
+ id<GREYMatcher> interactableButtonMatcher =
+ grey_allOf(buttonMatcher, grey_interactable(), nil);
+ [[[EarlGrey selectElementWithMatcher:interactableButtonMatcher]
+ usingSearchAction:ScrollDown()
+ onElementWithMatcher:grey_accessibilityID(kSettingsCollectionViewId)]
+ performAction:grey_tap()];
+}
+
++ (void)tapClearBrowsingDataMenuButton:(id<GREYMatcher>)buttonMatcher {
+ id<GREYMatcher> interactableButtonMatcher =
+ grey_allOf(buttonMatcher, grey_interactable(), nil);
+ [[[EarlGrey selectElementWithMatcher:interactableButtonMatcher]
+ usingSearchAction:ScrollDown()
+ onElementWithMatcher:ClearBrowsingDataCollectionView()]
+ performAction:grey_tap()];
+}
+
++ (void)tapPrivacyMenuButton:(id<GREYMatcher>)buttonMatcher {
+ id<GREYMatcher> interactableButtonMatcher =
+ grey_allOf(buttonMatcher, grey_interactable(), nil);
+ [[[EarlGrey selectElementWithMatcher:interactableButtonMatcher]
+ usingSearchAction:ScrollDown()
+ onElementWithMatcher:grey_accessibilityID(kPrivacyCollectionViewId)]
+ performAction:grey_tap()];
}
+ (void)openNewTab {
« no previous file with comments | « ios/chrome/test/earl_grey/chrome_earl_grey_ui.h ('k') | ios/chrome/test/earl_grey/chrome_matchers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698