OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import <EarlGrey/EarlGrey.h> |
| 6 #import <XCTest/XCTest.h> |
| 7 |
| 8 #import "ios/chrome/browser/ui/settings/settings_collection_view_controller.h" |
| 9 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h" |
| 10 #import "ios/chrome/browser/ui/tools_menu/tools_popup_controller.h" |
| 11 #include "ios/chrome/grit/ios_strings.h" |
| 12 #import "ios/chrome/test/earl_grey/accessibility_util.h" |
| 13 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" |
| 14 #import "ios/chrome/test/earl_grey/chrome_matchers.h" |
| 15 #import "ios/chrome/test/earl_grey/chrome_test_case.h" |
| 16 |
| 17 namespace { |
| 18 // Displacement for scroll action. |
| 19 const CGFloat kScrollDisplacement = 50.0; |
| 20 } // namespace |
| 21 @interface TranslateUITestCase : ChromeTestCase |
| 22 @end |
| 23 |
| 24 @implementation TranslateUITestCase |
| 25 |
| 26 // Opens the translate settings page and verifies that accessibility is set up |
| 27 // properly. |
| 28 - (void)testAccessibilityOfTranslateSettings { |
| 29 // Open translate settings. |
| 30 // TODO(crbug.com/606815): This and close settings is mostly shared with block |
| 31 // popups settings tests, and others. See if this can move to shared code. |
| 32 [ChromeEarlGreyUI openToolsMenu]; |
| 33 [[[EarlGrey |
| 34 selectElementWithMatcher:grey_accessibilityID(kToolsMenuSettingsId)] |
| 35 usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, |
| 36 kScrollDisplacement) |
| 37 onElementWithMatcher:grey_accessibilityID(kToolsMenuTableViewId)] |
| 38 performAction:grey_tap()]; |
| 39 [[[EarlGrey |
| 40 selectElementWithMatcher:chrome_test_util::buttonWithAccessibilityLabelId( |
| 41 IDS_IOS_CONTENT_SETTINGS_TITLE)] |
| 42 usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, |
| 43 kScrollDisplacement) |
| 44 onElementWithMatcher:grey_accessibilityID(kSettingsCollectionViewId)] |
| 45 performAction:grey_tap()]; |
| 46 [[EarlGrey |
| 47 selectElementWithMatcher:chrome_test_util::buttonWithAccessibilityLabelId( |
| 48 IDS_IOS_TRANSLATE_SETTING)] |
| 49 performAction:grey_tap()]; |
| 50 |
| 51 // Assert title and accessibility. |
| 52 [[EarlGrey |
| 53 selectElementWithMatcher:grey_accessibilityID( |
| 54 @"translate_settings_view_controller")] |
| 55 assertWithMatcher:grey_notNil()]; |
| 56 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 57 |
| 58 // Close settings. |
| 59 [[EarlGrey |
| 60 selectElementWithMatcher:grey_allOf( |
| 61 grey_accessibilityID(@"back_bar_button"), |
| 62 grey_accessibilityTrait( |
| 63 UIAccessibilityTraitButton), |
| 64 nil)] performAction:grey_tap()]; |
| 65 [[EarlGrey |
| 66 selectElementWithMatcher:grey_allOf( |
| 67 grey_accessibilityID(@"back_bar_button"), |
| 68 grey_accessibilityTrait( |
| 69 UIAccessibilityTraitButton), |
| 70 nil)] performAction:grey_tap()]; |
| 71 [[EarlGrey |
| 72 selectElementWithMatcher:chrome_test_util::buttonWithAccessibilityLabelId( |
| 73 IDS_IOS_NAVIGATION_BAR_DONE_BUTTON)] |
| 74 performAction:grey_tap()]; |
| 75 } |
| 76 |
| 77 @end |
OLD | NEW |