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

Unified Diff: ios/chrome/browser/ui/settings/settings_egtest.mm

Issue 2867553002: Make settings_egtest.mm work in landscape on small phones. (Closed)
Patch Set: comment cleanup 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 | « no previous file | ios/chrome/test/earl_grey/BUILD.gn » ('j') | ios/chrome/test/earl_grey/chrome_earl_grey_ui.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/settings/settings_egtest.mm
diff --git a/ios/chrome/browser/ui/settings/settings_egtest.mm b/ios/chrome/browser/ui/settings/settings_egtest.mm
index 3ffc458fbbacc273ff49768d03922eb7886f5d44..2edfd3953066350f617e5520a54e72349bde4ec1 100644
--- a/ios/chrome/browser/ui/settings/settings_egtest.mm
+++ b/ios/chrome/browser/ui/settings/settings_egtest.mm
@@ -162,6 +162,14 @@ id<GREYMatcher> TranslateSettingsButton() {
id<GREYMatcher> SavePasswordButton() {
return ButtonWithAccessibilityLabelId(IDS_IOS_PASSWORD_MANAGER_SAVE_BUTTON);
}
+// Matcher for the Content Settings button on the main Settings screen.
+id<GREYMatcher> ContentSettingsButton() {
+ return ButtonWithAccessibilityLabelId(IDS_IOS_CONTENT_SETTINGS_TITLE);
+}
+// Matcher for the Bandwidth Settings button on the main Settings screen.
+id<GREYMatcher> BandwidthSettingsButton() {
+ return ButtonWithAccessibilityLabelId(IDS_IOS_BANDWIDTH_MANAGEMENT_SETTINGS);
+}
// Run as a task to check if a certificate has been added to the ChannelIDStore.
// Signals the given |semaphore| if the cert was added, or reposts itself
@@ -244,22 +252,6 @@ bool IsCertificateCleared() {
@implementation SettingsTestCase
-// Opens the a submenu from the settings page. Must be called from the NTP.
-// TODO(crbug.com/684619): Investigate why usingSearchAction doesn't scroll
-// until the bottom.
-- (void)openSubSettingMenu:(id<GREYMatcher>)settingToTap {
- const CGFloat kScrollDisplacement = 150.0;
- id<GREYMatcher> settingsCollectionViewMatcher =
- grey_accessibilityID(kSettingsCollectionViewId);
-
- [ChromeEarlGreyUI openSettingsMenu];
- [[[EarlGrey selectElementWithMatcher:settingToTap]
- usingSearchAction:grey_scrollInDirection(kGREYDirectionDown,
- kScrollDisplacement)
- onElementWithMatcher:settingsCollectionViewMatcher]
- performAction:grey_tap()];
-}
-
// Closes a sub-settings menu, and then the general Settings menu.
- (void)closeSubSettingsMenu {
[[EarlGrey
@@ -276,10 +268,16 @@ bool IsCertificateCleared() {
// Clear Browsing Data settings screen, after having selected the data types
// scheduled for removal.
- (void)clearBrowsingData {
- [[EarlGrey selectElementWithMatcher:ClearBrowsingDataButton()]
- performAction:grey_tap()];
+ [ChromeEarlGreyUI tapButtonInClearBrowsingDataMenu:ClearBrowsingDataButton()];
[[EarlGrey selectElementWithMatcher:ConfirmClearBrowsingDataButton()]
performAction:grey_tap()];
+
+ // Before returning, make sure that the top of the Clear Browsing Data
+ // settings screen is visible to match the state at the start of the method.
+ id<GREYMatcher> clearBrowsingDataViewMatcher =
Eugene But (OOO till 7-30) 2017/05/09 00:15:03 nit: Do you want to create a function for this mat
baxley 2017/05/09 18:39:19 Good idea. It's used in a few files so I put it in
+ grey_accessibilityID(kClearBrowsingDataCollectionViewId);
+ [[EarlGrey selectElementWithMatcher:clearBrowsingDataViewMatcher]
+ performAction:grey_scrollToContentEdge(kGREYContentEdgeTop)];
}
// Exits Settings by clicking on the Done button.
@@ -295,10 +293,8 @@ bool IsCertificateCleared() {
// From the NTP, clears the cookies and site data via the UI.
- (void)clearCookiesAndSiteData {
[ChromeEarlGreyUI openSettingsMenu];
- [[EarlGrey selectElementWithMatcher:PrivacyButton()]
- performAction:grey_tap()];
- [[EarlGrey selectElementWithMatcher:ClearBrowsingDataCell()]
- performAction:grey_tap()];
+ [ChromeEarlGreyUI tapButtonInSettingsMenu:PrivacyButton()];
+ [ChromeEarlGreyUI tapButtonInPrivacyMenu:ClearBrowsingDataCell()];
// "Browsing history", "Cookies, Site Data" and "Cached Images and Files"
// are the default checked options when the prefs are registered. Uncheck
@@ -316,10 +312,8 @@ bool IsCertificateCleared() {
// From the NTP, clears the saved passwords via the UI.
- (void)clearPasswords {
[ChromeEarlGreyUI openSettingsMenu];
- [[EarlGrey selectElementWithMatcher:PrivacyButton()]
- performAction:grey_tap()];
- [[EarlGrey selectElementWithMatcher:ClearBrowsingDataCell()]
- performAction:grey_tap()];
+ [ChromeEarlGreyUI tapButtonInSettingsMenu:PrivacyButton()];
+ [ChromeEarlGreyUI tapButtonInPrivacyMenu:ClearBrowsingDataCell()];
// "Browsing history", "Cookies, Site Data" and "Cached Images and Files"
// are the default checked options when the prefs are registered. Unckeck all
@@ -394,8 +388,7 @@ bool IsCertificateCleared() {
// If |saved| is NO, it checks that there is no Saved Passwords section.
- (void)checkIfPasswordsSaved:(BOOL)saved {
[ChromeEarlGreyUI openSettingsMenu];
- [[EarlGrey selectElementWithMatcher:PasswordsButton()]
- performAction:grey_tap()];
+ [ChromeEarlGreyUI tapButtonInSettingsMenu:PasswordsButton()];
id<GREYMatcher> visibilityMatcher =
saved ? grey_sufficientlyVisible() : grey_notVisible();
@@ -775,8 +768,8 @@ bool IsCertificateCleared() {
// Verifies the UI elements are accessible on the Content Settings page.
- (void)testAccessibilityOnContentSettingsPage {
- [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId(
- IDS_IOS_CONTENT_SETTINGS_TITLE)];
+ [ChromeEarlGreyUI openSettingsMenu];
+ [ChromeEarlGreyUI tapButtonInSettingsMenu:ContentSettingsButton()];
chrome_test_util::VerifyAccessibilityForCurrentScreen();
[self closeSubSettingsMenu];
}
@@ -784,8 +777,8 @@ bool IsCertificateCleared() {
// Verifies the UI elements are accessible on the Content Settings
// Block Popups page.
- (void)testAccessibilityOnContentSettingsBlockPopupsPage {
- [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId(
- IDS_IOS_CONTENT_SETTINGS_TITLE)];
+ [ChromeEarlGreyUI openSettingsMenu];
+ [ChromeEarlGreyUI tapButtonInSettingsMenu:ContentSettingsButton()];
[[EarlGrey selectElementWithMatcher:BlockPopupsButton()]
performAction:grey_tap()];
chrome_test_util::VerifyAccessibilityForCurrentScreen();
@@ -795,8 +788,8 @@ bool IsCertificateCleared() {
// Verifies the UI elements are accessible on the Content Translations Settings
// page.
- (void)testAccessibilityOnContentSettingsTranslatePage {
- [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId(
- IDS_IOS_CONTENT_SETTINGS_TITLE)];
+ [ChromeEarlGreyUI openSettingsMenu];
+ [ChromeEarlGreyUI tapButtonInSettingsMenu:ContentSettingsButton()];
[[EarlGrey selectElementWithMatcher:TranslateSettingsButton()]
performAction:grey_tap()];
chrome_test_util::VerifyAccessibilityForCurrentScreen();
@@ -805,8 +798,8 @@ bool IsCertificateCleared() {
// Verifies the UI elements are accessible on the Privacy Settings page.
- (void)testAccessibilityOnPrivacySettingsPage {
- [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId(
- IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY)];
+ [ChromeEarlGreyUI openSettingsMenu];
+ [ChromeEarlGreyUI tapButtonInSettingsMenu:PrivacyButton()];
chrome_test_util::VerifyAccessibilityForCurrentScreen();
[self closeSubSettingsMenu];
}
@@ -814,8 +807,8 @@ bool IsCertificateCleared() {
// Verifies the UI elements are accessible on the Privacy Handoff Settings
// page.
- (void)testAccessibilityOnPrivacyHandoffSettingsPage {
- [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId(
- IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY)];
+ [ChromeEarlGreyUI openSettingsMenu];
+ [ChromeEarlGreyUI tapButtonInSettingsMenu:PrivacyButton()];
[[EarlGrey selectElementWithMatcher:PrivacyHandoffButton()]
performAction:grey_tap()];
chrome_test_util::VerifyAccessibilityForCurrentScreen();
@@ -825,10 +818,9 @@ bool IsCertificateCleared() {
// Verifies the UI elements are accessible on the Privacy Clear Browsing Data
// Settings page.
- (void)testAccessibilityOnPrivacyClearBrowsingHistoryPage {
- [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId(
- IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY)];
- [[EarlGrey selectElementWithMatcher:ClearBrowsingDataButton()]
- performAction:grey_tap()];
+ [ChromeEarlGreyUI openSettingsMenu];
+ [ChromeEarlGreyUI tapButtonInSettingsMenu:PrivacyButton()];
+ [ChromeEarlGreyUI tapButtonInPrivacyMenu:ClearBrowsingDataButton()];
chrome_test_util::VerifyAccessibilityForCurrentScreen();
[self closeSubSettingsMenu];
}
@@ -836,8 +828,8 @@ bool IsCertificateCleared() {
// Verifies the UI elements are accessible on the Bandwidth Management Settings
// page.
- (void)testAccessibilityOnBandwidthManagementSettingsPage {
- [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId(
- IDS_IOS_BANDWIDTH_MANAGEMENT_SETTINGS)];
+ [ChromeEarlGreyUI openSettingsMenu];
+ [ChromeEarlGreyUI tapButtonInSettingsMenu:BandwidthSettingsButton()];
chrome_test_util::VerifyAccessibilityForCurrentScreen();
[self closeSubSettingsMenu];
}
@@ -845,8 +837,8 @@ bool IsCertificateCleared() {
// Verifies the UI elements are accessible on the Bandwidth Preload Webpages
// Settings page.
- (void)testAccessibilityOnBandwidthPreloadWebpagesSettingsPage {
- [self openSubSettingMenu:chrome_test_util::ButtonWithAccessibilityLabelId(
- IDS_IOS_BANDWIDTH_MANAGEMENT_SETTINGS)];
+ [ChromeEarlGreyUI openSettingsMenu];
+ [ChromeEarlGreyUI tapButtonInSettingsMenu:BandwidthSettingsButton()];
[[EarlGrey selectElementWithMatcher:BandwidthPreloadWebpagesButton()]
performAction:grey_tap()];
chrome_test_util::VerifyAccessibilityForCurrentScreen();
@@ -874,8 +866,7 @@ bool IsCertificateCleared() {
// Verifies the UI elements are accessible on the Autofill Forms page.
- (void)testAccessibilityOnAutofillForms {
[ChromeEarlGreyUI openSettingsMenu];
- [[EarlGrey selectElementWithMatcher:AutofillButton()]
- performAction:grey_tap()];
+ [ChromeEarlGreyUI tapButtonInSettingsMenu:AutofillButton()];
chrome_test_util::VerifyAccessibilityForCurrentScreen();
[self closeSubSettingsMenu];
}
@@ -885,21 +876,24 @@ bool IsCertificateCleared() {
// TODO(crbug/711511): Remove when Native App Launcher is full deprecated.
if (!experimental_flags::IsNativeAppLauncherEnabled())
return;
- [self openSubSettingMenu:GoogleAppsButton()];
+ [ChromeEarlGreyUI openSettingsMenu];
+ [ChromeEarlGreyUI tapButtonInSettingsMenu:GoogleAppsButton()];
chrome_test_util::VerifyAccessibilityForCurrentScreen();
[self closeSubSettingsMenu];
}
// Verifies the UI elements are accessible on the About Chrome page.
- (void)testAccessibilityOnGoogleChrome {
- [self openSubSettingMenu:GoogleChromeButton()];
+ [ChromeEarlGreyUI openSettingsMenu];
+ [ChromeEarlGreyUI tapButtonInSettingsMenu:GoogleChromeButton()];
chrome_test_util::VerifyAccessibilityForCurrentScreen();
[self closeSubSettingsMenu];
}
// Verifies the UI elements are accessible on the Voice Search page.
- (void)testAccessibilityOnVoiceSearch {
- [self openSubSettingMenu:VoiceSearchButton()];
+ [ChromeEarlGreyUI openSettingsMenu];
+ [ChromeEarlGreyUI tapButtonInSettingsMenu:VoiceSearchButton()];
chrome_test_util::VerifyAccessibilityForCurrentScreen();
[self closeSubSettingsMenu];
}
@@ -993,10 +987,8 @@ bool IsCertificateCleared() {
// Verifies the UI elements are accessible on the Send Usage Data page.
- (void)testAccessibilityOnSendUsageData {
[ChromeEarlGreyUI openSettingsMenu];
- [[EarlGrey selectElementWithMatcher:PrivacyButton()]
- performAction:grey_tap()];
- [[EarlGrey selectElementWithMatcher:SendUsageDataButton()]
- performAction:grey_tap()];
+ [ChromeEarlGreyUI tapButtonInSettingsMenu:PrivacyButton()];
+ [ChromeEarlGreyUI tapButtonInPrivacyMenu:SendUsageDataButton()];
chrome_test_util::VerifyAccessibilityForCurrentScreen();
[self closeSubSettingsMenu];
}
« no previous file with comments | « no previous file | ios/chrome/test/earl_grey/BUILD.gn » ('j') | ios/chrome/test/earl_grey/chrome_earl_grey_ui.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698