Use BackButton()/ForwardButton() shared matchers.
Use shared matchers instead of chrome_test_util::ButtonWithAccessibilityLabelId(IDS_ACCNAME_BACK) Bug: 666500 Change-Id: I9abff4c3e2df2755e54a1cebf025ef7333ca4059 Reviewed-on: https://chromium-review.googlesource.com/668083 Commit-Queue: Eugene But <eugenebut@chromium.org> Reviewed-by: Mike Baxley <baxley@chromium.org> Cr-Commit-Position: refs/heads/master@{#502313}
This commit is contained in:
ios/chrome/browser/ui
history_popup
qr_scanner
toolbar
@ -5,7 +5,6 @@
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "components/strings/grit/components_strings.h"
|
||||
#import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
|
||||
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
|
||||
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
|
||||
@ -52,9 +51,7 @@
|
||||
[ChromeEarlGrey loadURL:URL4];
|
||||
|
||||
// Long press on back button.
|
||||
[[EarlGrey
|
||||
selectElementWithMatcher:chrome_test_util::ButtonWithAccessibilityLabelId(
|
||||
IDS_ACCNAME_BACK)]
|
||||
[[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()]
|
||||
performAction:grey_longPress()];
|
||||
|
||||
// Check that the first four entries are shown the back tab history menu.
|
||||
@ -75,9 +72,7 @@
|
||||
assertWithMatcher:grey_notNil()];
|
||||
|
||||
// Long press forward button.
|
||||
[[EarlGrey
|
||||
selectElementWithMatcher:chrome_test_util::ButtonWithAccessibilityLabelId(
|
||||
IDS_ACCNAME_FORWARD)]
|
||||
[[EarlGrey selectElementWithMatcher:chrome_test_util::ForwardButton()]
|
||||
performAction:grey_longPress()];
|
||||
|
||||
// Check that entries 2, 3, and 4 are in the forward tab history menu.
|
||||
|
@ -98,11 +98,6 @@ id<GREYMatcher> QrScannerViewportCaption() {
|
||||
IDS_IOS_QR_SCANNER_VIEWPORT_CAPTION);
|
||||
}
|
||||
|
||||
// Returns the GREYMatcher for the back button in the web toolbar.
|
||||
id<GREYMatcher> WebToolbarBackButton() {
|
||||
return ButtonWithAccessibilityLabelId(IDS_ACCNAME_BACK);
|
||||
}
|
||||
|
||||
// Returns the GREYMatcher for the Cancel button to dismiss a UIAlertController.
|
||||
id<GREYMatcher> DialogCancelButton() {
|
||||
return grey_allOf(
|
||||
@ -772,7 +767,8 @@ void TapKeyboardReturnKeyInOmniboxWithText(std::string text) {
|
||||
[ChromeEarlGrey waitForWebViewContainingText:response];
|
||||
|
||||
// Press the back button to get back to the NTP.
|
||||
TapButton(WebToolbarBackButton());
|
||||
[[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()]
|
||||
performAction:grey_tap()];
|
||||
[self assertModalOfClass:[QRScannerViewController class]
|
||||
isNotPresentedBy:[self currentBVC]];
|
||||
}
|
||||
|
@ -190,10 +190,6 @@ void SelectNewTabPagePanel(ntp_home::PanelIdentifier panel_type) {
|
||||
|
||||
// Verifies the existence and state of toolbar UI elements.
|
||||
- (void)testToolbarUI {
|
||||
id<GREYMatcher> backButton =
|
||||
chrome_test_util::ButtonWithAccessibilityLabelId(IDS_ACCNAME_BACK);
|
||||
id<GREYMatcher> forwardButton =
|
||||
chrome_test_util::ButtonWithAccessibilityLabelId(IDS_ACCNAME_FORWARD);
|
||||
id<GREYMatcher> reloadButton =
|
||||
chrome_test_util::ButtonWithAccessibilityLabelId(IDS_IOS_ACCNAME_RELOAD);
|
||||
id<GREYMatcher> bookmarkButton =
|
||||
@ -214,9 +210,9 @@ void SelectNewTabPagePanel(ntp_home::PanelIdentifier panel_type) {
|
||||
assertWithMatcher:grey_sufficientlyVisible()];
|
||||
|
||||
if (IsIPadIdiom()) {
|
||||
[[EarlGrey selectElementWithMatcher:backButton]
|
||||
[[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()]
|
||||
assertWithMatcher:grey_sufficientlyVisible()];
|
||||
[[EarlGrey selectElementWithMatcher:forwardButton]
|
||||
[[EarlGrey selectElementWithMatcher:chrome_test_util::ForwardButton()]
|
||||
assertWithMatcher:grey_sufficientlyVisible()];
|
||||
[[EarlGrey selectElementWithMatcher:reloadButton]
|
||||
assertWithMatcher:grey_sufficientlyVisible()];
|
||||
@ -233,7 +229,7 @@ void SelectNewTabPagePanel(ntp_home::PanelIdentifier panel_type) {
|
||||
|
||||
// Navigate to a page and verify the back button is enabled.
|
||||
[ChromeEarlGrey loadURL:GURL("chrome://version")];
|
||||
[[EarlGrey selectElementWithMatcher:backButton]
|
||||
[[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()]
|
||||
assertWithMatcher:grey_interactable()];
|
||||
}
|
||||
|
||||
@ -255,9 +251,8 @@ void SelectNewTabPagePanel(ntp_home::PanelIdentifier panel_type) {
|
||||
[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Typing Shield")]
|
||||
assertWithMatcher:grey_notNil()];
|
||||
|
||||
id<GREYMatcher> backButton =
|
||||
chrome_test_util::ButtonWithAccessibilityLabelId(IDS_ACCNAME_BACK);
|
||||
[[EarlGrey selectElementWithMatcher:backButton] performAction:grey_tap()];
|
||||
[[EarlGrey selectElementWithMatcher:chrome_test_util::BackButton()]
|
||||
performAction:grey_tap()];
|
||||
[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Typing Shield")]
|
||||
assertWithMatcher:grey_notVisible()];
|
||||
|
||||
|
Reference in New Issue
Block a user