Chromium Code Reviews| 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 <EarlGrey/EarlGrey.h> | 5 #import <EarlGrey/EarlGrey.h> |
| 6 #import <UIKit/UIKit.h> | 6 #import <UIKit/UIKit.h> |
| 7 #import <XCTest/XCTest.h> | 7 #import <XCTest/XCTest.h> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 id<GREYMatcher> googleChromeButton() { | 138 id<GREYMatcher> googleChromeButton() { |
| 139 return buttonWithAccessibilityLabelId(IDS_IOS_PRODUCT_NAME); | 139 return buttonWithAccessibilityLabelId(IDS_IOS_PRODUCT_NAME); |
| 140 } | 140 } |
| 141 | 141 |
| 142 // Matcher for the Google Chrome cell on the main Settings screen. | 142 // Matcher for the Google Chrome cell on the main Settings screen. |
| 143 id<GREYMatcher> voiceSearchButton() { | 143 id<GREYMatcher> voiceSearchButton() { |
| 144 return grey_allOf(grey_accessibilityID(kSettingsVoiceSearchCellId), | 144 return grey_allOf(grey_accessibilityID(kSettingsVoiceSearchCellId), |
| 145 grey_accessibilityTrait(UIAccessibilityTraitButton), nil); | 145 grey_accessibilityTrait(UIAccessibilityTraitButton), nil); |
| 146 } | 146 } |
| 147 | 147 |
| 148 // Matcher for the Preload Webpages button on the bandwidth UI. | |
| 149 id<GREYMatcher> bandwidthPreloadWebpagesButton() { | |
|
baxley
2017/01/20 23:24:58
Would you mind making these 4 matchers start with
lindsayw
2017/01/24 18:46:57
Done.
| |
| 150 return grey_allOf( | |
| 151 buttonWithAccessibilityLabelId(IDS_IOS_OPTIONS_PRELOAD_WEBPAGES), | |
| 152 grey_not(grey_accessibilityTrait(UIAccessibilityTraitKeyboardKey)), nil); | |
|
baxley
2017/01/20 23:24:58
do we need the matcher for not UIAccessibilityTrai
lindsayw
2017/01/24 18:46:57
Good point, updated.
| |
| 153 } | |
| 154 | |
| 155 // Matcher for the Privacy Handoff button on the privacy UI. | |
| 156 id<GREYMatcher> privacyHandoffButton() { | |
| 157 return grey_allOf( | |
| 158 buttonWithAccessibilityLabelId( | |
| 159 IDS_IOS_OPTIONS_ENABLE_HANDOFF_TO_OTHER_DEVICES), | |
| 160 grey_not(grey_accessibilityTrait(UIAccessibilityTraitKeyboardKey)), nil); | |
| 161 } | |
| 162 | |
| 163 // Matcher for the Privacy Block Popups button on the privacy UI. | |
| 164 id<GREYMatcher> blockPopupsButton() { | |
| 165 return grey_allOf( | |
| 166 buttonWithAccessibilityLabelId(IDS_IOS_BLOCK_POPUPS), | |
| 167 grey_not(grey_accessibilityTrait(UIAccessibilityTraitKeyboardKey)), nil); | |
| 168 } | |
| 169 | |
| 170 // Matcher for the Privacy Translate Settings button on the privacy UI. | |
| 171 id<GREYMatcher> translateSettingsButton() { | |
| 172 return grey_allOf( | |
| 173 buttonWithAccessibilityLabelId(IDS_IOS_TRANSLATE_SETTING), | |
| 174 grey_not(grey_accessibilityTrait(UIAccessibilityTraitKeyboardKey)), nil); | |
| 175 } | |
| 176 | |
| 148 // Asserts that there is no cookie in current web state. | 177 // Asserts that there is no cookie in current web state. |
| 149 void AssertNoCookieExists() { | 178 void AssertNoCookieExists() { |
| 150 NSError* error = nil; | 179 NSError* error = nil; |
| 151 chrome_test_util::ExecuteJavaScript( | 180 chrome_test_util::ExecuteJavaScript( |
| 152 base::SysUTF8ToNSString(kJavaScriptGetCookies), &error); | 181 base::SysUTF8ToNSString(kJavaScriptGetCookies), &error); |
| 153 [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText( | 182 [[EarlGrey selectElementWithMatcher:chrome_test_util::webViewContainingText( |
| 154 kNoCookieText)] | 183 kNoCookieText)] |
| 155 assertWithMatcher:grey_notNil()]; | 184 assertWithMatcher:grey_notNil()]; |
| 156 } | 185 } |
| 157 | 186 |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 783 } | 812 } |
| 784 | 813 |
| 785 // Verifies the UI elements are accessibile on the Content Settings page. | 814 // Verifies the UI elements are accessibile on the Content Settings page. |
| 786 - (void)testAccessibilityOnContentSettingsPage { | 815 - (void)testAccessibilityOnContentSettingsPage { |
| 787 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( | 816 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( |
| 788 IDS_IOS_CONTENT_SETTINGS_TITLE)]; | 817 IDS_IOS_CONTENT_SETTINGS_TITLE)]; |
| 789 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 818 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 790 [self closeSubSettingsMenu]; | 819 [self closeSubSettingsMenu]; |
| 791 } | 820 } |
| 792 | 821 |
| 822 // Verifies the UI elements are accessibile on the Content Settings | |
|
rohitrao (ping after 24h)
2017/01/23 12:55:30
"Accessible", here and below.
lindsayw
2017/01/24 18:46:57
accessibile->accessible - Done.
| |
| 823 // Block Popups page. | |
| 824 - (void)testAccessibilityOnContentSettingsBlockPopupsPage { | |
| 825 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( | |
| 826 IDS_IOS_CONTENT_SETTINGS_TITLE)]; | |
| 827 [[EarlGrey selectElementWithMatcher:blockPopupsButton()] | |
| 828 performAction:grey_tap()]; | |
| 829 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | |
| 830 [self closeSubSettingsMenu]; | |
| 831 } | |
| 832 | |
| 833 // Verifies the UI elements are accessibile on the Content Translations Settings | |
| 834 // page. | |
| 835 - (void)testAccessibilityOnContentSettingsTranslatePage { | |
| 836 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( | |
| 837 IDS_IOS_CONTENT_SETTINGS_TITLE)]; | |
| 838 [[EarlGrey selectElementWithMatcher:translateSettingsButton()] | |
| 839 performAction:grey_tap()]; | |
| 840 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | |
| 841 [self closeSubSettingsMenu]; | |
| 842 } | |
| 843 | |
| 793 // Verifies the UI elements are accessibile on the Privacy Settings page. | 844 // Verifies the UI elements are accessibile on the Privacy Settings page. |
| 794 - (void)testAccessibilityOnPrivacySettingsPage { | 845 - (void)testAccessibilityOnPrivacySettingsPage { |
| 795 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( | 846 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( |
| 796 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY)]; | 847 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY)]; |
| 797 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 848 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 798 [self closeSubSettingsMenu]; | 849 [self closeSubSettingsMenu]; |
| 799 } | 850 } |
| 800 | 851 |
| 852 // Verifies the UI elements are accessibile on the Privacy Handoff Settings | |
| 853 // page. | |
| 854 - (void)testAccessibilityOnPrivacyHandoffSettingsPage { | |
| 855 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( | |
| 856 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY)]; | |
| 857 [[EarlGrey selectElementWithMatcher:privacyHandoffButton()] | |
| 858 performAction:grey_tap()]; | |
| 859 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | |
| 860 [self closeSubSettingsMenu]; | |
| 861 } | |
| 862 | |
| 863 // Verifies the UI elements are accessibile on the Privacy Clear Browsing Data | |
| 864 // Settings page. | |
| 865 - (void)testAccessibilityOnPrivacyClearBrowsingHistoryPage { | |
| 866 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( | |
| 867 IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY)]; | |
| 868 [[EarlGrey selectElementWithMatcher:clearBrowsingDataButton()] | |
|
rohitrao (ping after 24h)
2017/01/23 13:07:36
Have you tried running this test on a 5S in landsc
lindsayw
2017/01/24 18:46:57
All of these tests fail, not only mine, in 5s land
| |
| 869 performAction:grey_tap()]; | |
| 870 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | |
| 871 [self closeSubSettingsMenu]; | |
| 872 } | |
| 873 | |
| 801 // Verifies the UI elements are accessibile on the Bandwidth Management Settings | 874 // Verifies the UI elements are accessibile on the Bandwidth Management Settings |
| 802 // page. | 875 // page. |
| 803 - (void)testAccessibilityOnBandwidthManagementSettingsPage { | 876 - (void)testAccessibilityOnBandwidthManagementSettingsPage { |
| 804 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( | 877 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( |
| 805 IDS_IOS_BANDWIDTH_MANAGEMENT_SETTINGS)]; | 878 IDS_IOS_BANDWIDTH_MANAGEMENT_SETTINGS)]; |
| 806 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 879 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 807 [self closeSubSettingsMenu]; | 880 [self closeSubSettingsMenu]; |
| 808 } | 881 } |
| 809 | 882 |
| 883 // Verifies the UI elements are accessibile on the Bandwidth Preload Webpages | |
| 884 // Settings page. | |
| 885 - (void)testAccessibilityOnBandwidthPreloadWebpagesSettingsPage { | |
| 886 [self openSubSettingMenu:chrome_test_util::buttonWithAccessibilityLabelId( | |
| 887 IDS_IOS_BANDWIDTH_MANAGEMENT_SETTINGS)]; | |
| 888 [[EarlGrey selectElementWithMatcher:bandwidthPreloadWebpagesButton()] | |
| 889 performAction:grey_tap()]; | |
| 890 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | |
| 891 [self closeSubSettingsMenu]; | |
| 892 } | |
| 893 | |
| 810 // Verifies the UI elements are accessible on the Save Passwords page. | 894 // Verifies the UI elements are accessible on the Save Passwords page. |
| 811 - (void)testAccessibilityOnSavePasswords { | 895 - (void)testAccessibilityOnSavePasswords { |
| 812 [ChromeEarlGreyUI openToolsMenu]; | 896 [ChromeEarlGreyUI openToolsMenu]; |
| 813 [[EarlGrey selectElementWithMatcher:settingsButton()] | 897 [[EarlGrey selectElementWithMatcher:settingsButton()] |
| 814 performAction:grey_tap()]; | 898 performAction:grey_tap()]; |
| 815 [[EarlGrey selectElementWithMatcher:passwordsButton()] | 899 [[EarlGrey selectElementWithMatcher:passwordsButton()] |
| 816 performAction:grey_tap()]; | 900 performAction:grey_tap()]; |
| 817 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 901 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 818 [self closeSubSettingsMenu]; | 902 [self closeSubSettingsMenu]; |
| 819 } | 903 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 859 } | 943 } |
| 860 | 944 |
| 861 // Verifies the UI elements are accessible on the Voice Search page. | 945 // Verifies the UI elements are accessible on the Voice Search page. |
| 862 - (void)testAccessibilityOnVoiceSearch { | 946 - (void)testAccessibilityOnVoiceSearch { |
| 863 [self openSubSettingMenu:voiceSearchButton()]; | 947 [self openSubSettingMenu:voiceSearchButton()]; |
| 864 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 948 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 865 [self closeSubSettingsMenu]; | 949 [self closeSubSettingsMenu]; |
| 866 } | 950 } |
| 867 | 951 |
| 868 @end | 952 @end |
| OLD | NEW |