| OLD | NEW |
| 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 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" | 5 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" |
| 6 | 6 |
| 7 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h" | 7 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h" |
| 8 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 8 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| 9 #import "ios/chrome/test/app/chrome_test_util.h" | 9 #import "ios/chrome/test/app/chrome_test_util.h" |
| 10 #include "ios/chrome/test/app/navigation_test_util.h" | 10 #include "ios/chrome/test/app/navigation_test_util.h" |
| 11 #import "ios/chrome/test/earl_grey/chrome_matchers.h" | 11 #import "ios/chrome/test/earl_grey/chrome_matchers.h" |
| 12 #import "ios/testing/wait_util.h" | 12 #import "ios/testing/wait_util.h" |
| 13 #import "ios/web/public/test/earl_grey/js_test_util.h" | 13 #import "ios/web/public/test/earl_grey/js_test_util.h" |
| 14 #import "ios/web/public/test/earl_grey/web_view_matchers.h" | 14 #import "ios/web/public/test/earl_grey/web_view_matchers.h" |
| 15 | 15 |
| 16 using testing::WaitUntilConditionOrTimeout; | 16 using testing::WaitUntilConditionOrTimeout; |
| 17 using testing::kWaitForPageLoadTimeout; | 17 using testing::kWaitForPageLoadTimeout; |
| 18 | 18 |
| 19 @implementation ChromeEarlGreyUI | 19 @implementation ChromeEarlGreyUI |
| 20 | 20 |
| 21 + (void)openToolsMenu { | 21 + (void)openToolsMenu { |
| 22 // TODO(crbug.com/685570): Fix the tap instead of adding a delay. |
| 23 GREYCondition* myCondition = [GREYCondition |
| 24 conditionWithName:@"Delay to ensure the toolbar menu can be opened" |
| 25 block:^BOOL { |
| 26 return NO; |
| 27 }]; |
| 28 [myCondition waitWithTimeout:0.5]; |
| 29 |
| 22 // TODO(crbug.com/639524): Add logic to ensure the app is in the correct | 30 // TODO(crbug.com/639524): Add logic to ensure the app is in the correct |
| 23 // state, for example DCHECK if no tabs are displayed. | 31 // state, for example DCHECK if no tabs are displayed. |
| 24 [[[EarlGrey | 32 [[[EarlGrey |
| 25 selectElementWithMatcher:grey_allOf(chrome_test_util::ToolsMenuButton(), | 33 selectElementWithMatcher:grey_allOf(chrome_test_util::ToolsMenuButton(), |
| 26 grey_sufficientlyVisible(), nil)] | 34 grey_sufficientlyVisible(), nil)] |
| 27 usingSearchAction:grey_swipeSlowInDirection(kGREYDirectionDown) | 35 usingSearchAction:grey_swipeSlowInDirection(kGREYDirectionDown) |
| 28 onElementWithMatcher:web::WebViewScrollView( | 36 onElementWithMatcher:web::WebViewScrollView( |
| 29 chrome_test_util::GetCurrentWebState())] | 37 chrome_test_util::GetCurrentWebState())] |
| 30 performAction:grey_tap()]; | 38 performAction:grey_tap()]; |
| 31 // TODO(crbug.com/639517): Add webViewScrollView matcher so we don't have | 39 // TODO(crbug.com/639517): Add webViewScrollView matcher so we don't have |
| (...skipping 29 matching lines...) Expand all Loading... |
| 61 | 69 |
| 62 + (void)openShareMenu { | 70 + (void)openShareMenu { |
| 63 if (IsCompact()) { | 71 if (IsCompact()) { |
| 64 [ChromeEarlGreyUI openToolsMenu]; | 72 [ChromeEarlGreyUI openToolsMenu]; |
| 65 } | 73 } |
| 66 [[EarlGrey selectElementWithMatcher:chrome_test_util::ShareButton()] | 74 [[EarlGrey selectElementWithMatcher:chrome_test_util::ShareButton()] |
| 67 performAction:grey_tap()]; | 75 performAction:grey_tap()]; |
| 68 } | 76 } |
| 69 | 77 |
| 70 @end | 78 @end |
| OLD | NEW |