Commit 967b8020 authored by Mike Dougherty's avatar Mike Dougherty Committed by Commit Bot

[iOS] Fix failing Payment Method tests

A scroll search action needs to be used in order to find the Payment
Methods button in settings on small devices.

AutofillEditCreditCardTestCase/testValidNickname is failing on
https://ci.chromium.org/p/chrome/builders/ci/iphone-simulator/14177
and these other tests have been disabled due to this same problem.

Bug: 1108809
Change-Id: I37716c9db5d96d856039aab4496305e027ac9348
Fixed: 1106734, 1106766
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2414558Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Commit-Queue: Mike Dougherty <michaeldo@chromium.org>
Auto-Submit: Mike Dougherty <michaeldo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807658}
parent ffade2a8
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
using chrome_test_util::ButtonWithAccessibilityLabel; using chrome_test_util::ButtonWithAccessibilityLabel;
using chrome_test_util::ButtonWithAccessibilityLabelId; using chrome_test_util::ButtonWithAccessibilityLabelId;
using chrome_test_util::NavigationBarDoneButton; using chrome_test_util::NavigationBarDoneButton;
using chrome_test_util::PaymentMethodsButton;
using chrome_test_util::SettingsMenuBackButton; using chrome_test_util::SettingsMenuBackButton;
using chrome_test_util::SettingsDoneButton; using chrome_test_util::SettingsDoneButton;
...@@ -93,12 +94,7 @@ id<GREYMatcher> BottomToolbar() { ...@@ -93,12 +94,7 @@ id<GREYMatcher> BottomToolbar() {
// Helper to open the settings page for Autofill credit cards. // Helper to open the settings page for Autofill credit cards.
- (void)openCreditCardsSettings { - (void)openCreditCardsSettings {
[ChromeEarlGreyUI openSettingsMenu]; [ChromeEarlGreyUI openSettingsMenu];
[[[EarlGrey selectElementWithMatcher:ButtonWithAccessibilityLabel( [ChromeEarlGreyUI tapSettingsMenuButton:PaymentMethodsButton()];
l10n_util::GetNSString(
IDS_AUTOFILL_PAYMENT_METHODS))]
usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, 200)
onElementWithMatcher:chrome_test_util::SettingsCollectionView()]
performAction:grey_tap()];
} }
// Helper to open the settings page for the Autofill credit card with |label|. // Helper to open the settings page for the Autofill credit card with |label|.
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
using chrome_test_util::ButtonWithAccessibilityLabel; using chrome_test_util::ButtonWithAccessibilityLabel;
using chrome_test_util::ButtonWithAccessibilityLabelId; using chrome_test_util::ButtonWithAccessibilityLabelId;
using chrome_test_util::NavigationBarDoneButton; using chrome_test_util::NavigationBarDoneButton;
using chrome_test_util::PaymentMethodsButton;
using chrome_test_util::TextFieldForCellWithLabelId; using chrome_test_util::TextFieldForCellWithLabelId;
// Tests for Settings Autofill edit credit cards screen. // Tests for Settings Autofill edit credit cards screen.
...@@ -32,12 +33,6 @@ using chrome_test_util::TextFieldForCellWithLabelId; ...@@ -32,12 +33,6 @@ using chrome_test_util::TextFieldForCellWithLabelId;
namespace { namespace {
// Matcher for 'Payment Methods' in the settings menu.
id<GREYMatcher> SettingsPaymentMethodsButton() {
return ButtonWithAccessibilityLabel(
l10n_util::GetNSString(IDS_AUTOFILL_PAYMENT_METHODS));
}
// Matcher for the 'Nickname' text field in the add credit card view. // Matcher for the 'Nickname' text field in the add credit card view.
id<GREYMatcher> NicknameTextField() { id<GREYMatcher> NicknameTextField() {
return TextFieldForCellWithLabelId(IDS_IOS_AUTOFILL_NICKNAME); return TextFieldForCellWithLabelId(IDS_IOS_AUTOFILL_NICKNAME);
...@@ -69,8 +64,8 @@ id<GREYMatcher> NavigationBarEditButton() { ...@@ -69,8 +64,8 @@ id<GREYMatcher> NavigationBarEditButton() {
NSString* lastDigits = [AutofillAppInterface saveLocalCreditCard]; NSString* lastDigits = [AutofillAppInterface saveLocalCreditCard];
[ChromeEarlGreyUI openSettingsMenu]; [ChromeEarlGreyUI openSettingsMenu];
[[EarlGrey selectElementWithMatcher:SettingsPaymentMethodsButton()] [ChromeEarlGreyUI tapSettingsMenuButton:PaymentMethodsButton()];
performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(lastDigits)] [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(lastDigits)]
performAction:grey_tap()]; performAction:grey_tap()];
[[EarlGrey selectElementWithMatcher:NavigationBarEditButton()] [[EarlGrey selectElementWithMatcher:NavigationBarEditButton()]
...@@ -98,8 +93,7 @@ id<GREYMatcher> NavigationBarEditButton() { ...@@ -98,8 +93,7 @@ id<GREYMatcher> NavigationBarEditButton() {
} }
// Tests that invalid nicknames are not allowed when editing a card. // Tests that invalid nicknames are not allowed when editing a card.
// TODO(crbug.com/1108809): Re-enable the test. - (void)testInvalidNickname {
- (void)DISABLED_testInvalidNickname {
[[EarlGrey selectElementWithMatcher:NicknameTextField()] [[EarlGrey selectElementWithMatcher:NicknameTextField()]
performAction:grey_typeText(@"1233")]; performAction:grey_typeText(@"1233")];
...@@ -109,8 +103,7 @@ id<GREYMatcher> NavigationBarEditButton() { ...@@ -109,8 +103,7 @@ id<GREYMatcher> NavigationBarEditButton() {
} }
// Tests that clearing a nickname is allowed. // Tests that clearing a nickname is allowed.
// Disabled due to: crbug.com/1106766 - (void)testEmptyNickname {
- (void)DISABLED_testEmptyNickname {
[[EarlGrey selectElementWithMatcher:NicknameTextField()] [[EarlGrey selectElementWithMatcher:NicknameTextField()]
performAction:grey_typeText(@"To be removed")]; performAction:grey_typeText(@"To be removed")];
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
using chrome_test_util::ButtonWithAccessibilityLabelId; using chrome_test_util::ButtonWithAccessibilityLabelId;
using chrome_test_util::ContentSettingsButton; using chrome_test_util::ContentSettingsButton;
using chrome_test_util::PaymentMethodsButton;
using chrome_test_util::SettingsCollectionView; using chrome_test_util::SettingsCollectionView;
using chrome_test_util::SettingsDoneButton; using chrome_test_util::SettingsDoneButton;
using chrome_test_util::SettingsMenuBackButton; using chrome_test_util::SettingsMenuBackButton;
...@@ -34,10 +35,6 @@ id<GREYMatcher> ClearBrowsingDataCell() { ...@@ -34,10 +35,6 @@ id<GREYMatcher> ClearBrowsingDataCell() {
id<GREYMatcher> SearchEngineButton() { id<GREYMatcher> SearchEngineButton() {
return ButtonWithAccessibilityLabelId(IDS_IOS_SEARCH_ENGINE_SETTING_TITLE); return ButtonWithAccessibilityLabelId(IDS_IOS_SEARCH_ENGINE_SETTING_TITLE);
} }
// Matcher for the payment methods cell on the main Settings screen.
id<GREYMatcher> PaymentMethodsButton() {
return ButtonWithAccessibilityLabelId(IDS_AUTOFILL_PAYMENT_METHODS);
}
// Matcher for the addresses cell on the main Settings screen. // Matcher for the addresses cell on the main Settings screen.
id<GREYMatcher> AddressesButton() { id<GREYMatcher> AddressesButton() {
return ButtonWithAccessibilityLabelId(IDS_AUTOFILL_ADDRESSES_SETTINGS_TITLE); return ButtonWithAccessibilityLabelId(IDS_AUTOFILL_ADDRESSES_SETTINGS_TITLE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment