Commit 069642b5 authored by Olivier Robin's avatar Olivier Robin Committed by Commit Bot

[eg2] convert AutofillCreditCardSettingsTest

Tbr: eugenebut
Bug: 987646
Change-Id: I659aa88374381c8fc221efcb2287c17314b6cfa8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1892811
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Reviewed-by: default avatarStepan Khapugin <stkhapugin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711350}
parent 4d7962a1
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
+ (void)clearCreditCardStore; + (void)clearCreditCardStore;
// Saves a local credit card that doesn't require CVC to be used. // Saves a local credit card that doesn't require CVC to be used.
+ (void)saveLocalCreditCard; // Returns the |card.NetworkAndLastFourDigits| of the card used in the UIs.
+ (NSString*)saveLocalCreditCard;
// Saves a masked credit card that requires CVC to be used. // Saves a masked credit card that requires CVC to be used.
+ (void)saveMaskedCreditCard; + (void)saveMaskedCreditCard;
......
...@@ -211,7 +211,7 @@ void AddAutofillProfile(autofill::PersonalDataManager* personalDataManager) { ...@@ -211,7 +211,7 @@ void AddAutofillProfile(autofill::PersonalDataManager* personalDataManager) {
} }
} }
+ (void)saveLocalCreditCard { + (NSString*)saveLocalCreditCard {
autofill::PersonalDataManager* personalDataManager = autofill::PersonalDataManager* personalDataManager =
[self personalDataManager]; [self personalDataManager];
autofill::CreditCard card = autofill::test::GetCreditCard(); autofill::CreditCard card = autofill::test::GetCreditCard();
...@@ -225,6 +225,7 @@ void AddAutofillProfile(autofill::PersonalDataManager* personalDataManager) { ...@@ -225,6 +225,7 @@ void AddAutofillProfile(autofill::PersonalDataManager* personalDataManager) {
base::TimeDelta::FromSeconds( base::TimeDelta::FromSeconds(
base::test::ios::kWaitForFileOperationTimeout)); base::test::ios::kWaitForFileOperationTimeout));
personalDataManager->NotifyPersonalDataObserver(); personalDataManager->NotifyPersonalDataObserver();
return base::SysUTF16ToNSString(card.NetworkAndLastFourDigits());
} }
+ (void)saveMaskedCreditCard { + (void)saveMaskedCreditCard {
......
...@@ -140,6 +140,7 @@ source_set("eg2_tests") { ...@@ -140,6 +140,7 @@ source_set("eg2_tests") {
testonly = true testonly = true
sources = [ sources = [
"autofill_add_credit_card_egtest.mm", "autofill_add_credit_card_egtest.mm",
"autofill_credit_card_settings_egtest.mm",
"autofill_profile_settings_egtest.mm", "autofill_profile_settings_egtest.mm",
] ]
deps = [ deps = [
......
...@@ -10,4 +10,9 @@ ...@@ -10,4 +10,9 @@
extern NSString* const kAutofillProfileEditTableViewId; extern NSString* const kAutofillProfileEditTableViewId;
extern NSString* const kAutofillProfileTableViewID; extern NSString* const kAutofillProfileTableViewID;
extern NSString* const kAutofillPaymentMethodsToolbarId;
extern NSString* const kAutofillCreditCardTableViewId;
extern NSString* const kAutofillCreditCardSwitchViewId;
extern NSString* const kSettingsAddPaymentMethodButtonId;
#endif // IOS_CHROME_BROWSER_UI_SETTINGS_AUTOFILL_AUTOFILL_CONSTANTS_H_ #endif // IOS_CHROME_BROWSER_UI_SETTINGS_AUTOFILL_AUTOFILL_CONSTANTS_H_
...@@ -11,3 +11,10 @@ ...@@ -11,3 +11,10 @@
NSString* const kAutofillProfileEditTableViewId = NSString* const kAutofillProfileEditTableViewId =
@"kAutofillProfileEditTableViewId"; @"kAutofillProfileEditTableViewId";
NSString* const kAutofillProfileTableViewID = @"kAutofillProfileTableViewID"; NSString* const kAutofillProfileTableViewID = @"kAutofillProfileTableViewID";
NSString* const kAutofillCreditCardTableViewId = @"kAutofillTableViewId";
NSString* const kAutofillCreditCardSwitchViewId = @"cardItem_switch";
NSString* const kAutofillPaymentMethodsToolbarId =
@"kAutofillPaymentMethodsToolbarId";
NSString* const kSettingsAddPaymentMethodButtonId =
@"kSettingsAddPaymentMethodButtonId";
...@@ -7,11 +7,6 @@ ...@@ -7,11 +7,6 @@
#import "ios/chrome/browser/ui/settings/settings_root_table_view_controller.h" #import "ios/chrome/browser/ui/settings/settings_root_table_view_controller.h"
extern NSString* const kAutofillPaymentMethodsToolbarId;
extern NSString* const kAutofillCreditCardTableViewId;
extern NSString* const kAutofillCreditCardSwitchViewId;
extern NSString* const kSettingsAddPaymentMethodButtonId;
namespace ios { namespace ios {
class ChromeBrowserState; class ChromeBrowserState;
} // namespace ios } // namespace ios
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "ios/chrome/browser/autofill/personal_data_manager_factory.h" #include "ios/chrome/browser/autofill/personal_data_manager_factory.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#import "ios/chrome/browser/ui/settings/autofill/autofill_add_credit_card_coordinator.h" #import "ios/chrome/browser/ui/settings/autofill/autofill_add_credit_card_coordinator.h"
#import "ios/chrome/browser/ui/settings/autofill/autofill_constants.h"
#import "ios/chrome/browser/ui/settings/autofill/autofill_credit_card_edit_table_view_controller.h" #import "ios/chrome/browser/ui/settings/autofill/autofill_credit_card_edit_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/autofill/cells/autofill_data_item.h" #import "ios/chrome/browser/ui/settings/autofill/cells/autofill_data_item.h"
#import "ios/chrome/browser/ui/settings/autofill/features.h" #import "ios/chrome/browser/ui/settings/autofill/features.h"
...@@ -36,13 +37,6 @@ ...@@ -36,13 +37,6 @@
#error "This file requires ARC support." #error "This file requires ARC support."
#endif #endif
NSString* const kAutofillCreditCardTableViewId = @"kAutofillTableViewId";
NSString* const kAutofillCreditCardSwitchViewId = @"cardItem_switch";
NSString* const kAutofillPaymentMethodsToolbarId =
@"kAutofillPaymentMethodsToolbarId";
NSString* const kSettingsAddPaymentMethodButtonId =
@"kSettingsAddPaymentMethodButtonId";
namespace { namespace {
typedef NS_ENUM(NSInteger, SectionIdentifier) { typedef NS_ENUM(NSInteger, SectionIdentifier) {
......
...@@ -260,6 +260,7 @@ source_set("test_support") { ...@@ -260,6 +260,7 @@ source_set("test_support") {
"//ios/chrome/browser/ui/safe_mode", "//ios/chrome/browser/ui/safe_mode",
"//ios/chrome/browser/ui/safe_mode:test_support", "//ios/chrome/browser/ui/safe_mode:test_support",
"//ios/chrome/browser/ui/settings:settings", "//ios/chrome/browser/ui/settings:settings",
"//ios/chrome/browser/ui/settings:settings_root",
"//ios/chrome/browser/ui/settings/autofill", "//ios/chrome/browser/ui/settings/autofill",
"//ios/chrome/browser/ui/settings/autofill:constants", "//ios/chrome/browser/ui/settings/autofill:constants",
"//ios/chrome/browser/ui/settings/autofill:feature_flags", "//ios/chrome/browser/ui/settings/autofill:feature_flags",
...@@ -390,6 +391,7 @@ source_set("eg_app_support+eg2") { ...@@ -390,6 +391,7 @@ source_set("eg_app_support+eg2") {
"//ios/chrome/browser/ui/safe_mode:eg_app_support+eg2", "//ios/chrome/browser/ui/safe_mode:eg_app_support+eg2",
"//ios/chrome/browser/ui/settings:eg_app_support+eg2", "//ios/chrome/browser/ui/settings:eg_app_support+eg2",
"//ios/chrome/browser/ui/settings:settings", "//ios/chrome/browser/ui/settings:settings",
"//ios/chrome/browser/ui/settings:settings_root",
"//ios/chrome/browser/ui/settings/autofill", "//ios/chrome/browser/ui/settings/autofill",
"//ios/chrome/browser/ui/settings/autofill:constants", "//ios/chrome/browser/ui/settings/autofill:constants",
"//ios/chrome/browser/ui/settings/autofill:feature_flags", "//ios/chrome/browser/ui/settings/autofill:feature_flags",
......
...@@ -380,6 +380,10 @@ id<GREYMatcher> SettingsProfileMatcher(); ...@@ -380,6 +380,10 @@ id<GREYMatcher> SettingsProfileMatcher();
// Returns a matcher for the credit card settings collection view. // Returns a matcher for the credit card settings collection view.
id<GREYMatcher> SettingsCreditCardMatcher(); id<GREYMatcher> SettingsCreditCardMatcher();
// Returns a matcher for the delete button at the bottom of settings collection
// views.
id<GREYMatcher> SettingsBottomToolbarDeleteButton();
// Returns a matcher for an autofill suggestion view. // Returns a matcher for an autofill suggestion view.
id<GREYMatcher> AutofillSuggestionViewMatcher(); id<GREYMatcher> AutofillSuggestionViewMatcher();
......
...@@ -475,6 +475,10 @@ id<GREYMatcher> SettingsCreditCardMatcher() { ...@@ -475,6 +475,10 @@ id<GREYMatcher> SettingsCreditCardMatcher() {
return [ChromeMatchersAppInterface settingsCreditCardMatcher]; return [ChromeMatchersAppInterface settingsCreditCardMatcher];
} }
id<GREYMatcher> SettingsBottomToolbarDeleteButton() {
return [ChromeMatchersAppInterface settingsBottomToolbarDeleteButton];
}
id<GREYMatcher> AutofillSuggestionViewMatcher() { id<GREYMatcher> AutofillSuggestionViewMatcher() {
return [ChromeMatchersAppInterface autofillSuggestionViewMatcher]; return [ChromeMatchersAppInterface autofillSuggestionViewMatcher];
} }
......
...@@ -385,6 +385,10 @@ ...@@ -385,6 +385,10 @@
// Returns a matcher for the credit card settings collection view. // Returns a matcher for the credit card settings collection view.
+ (id<GREYMatcher>)settingsCreditCardMatcher; + (id<GREYMatcher>)settingsCreditCardMatcher;
// Returns a matcher for the delete button at the bottom of settings collection
// views.
+ (id<GREYMatcher>)settingsBottomToolbarDeleteButton;
// Returns a matcher for an autofill suggestion view. // Returns a matcher for an autofill suggestion view.
+ (id<GREYMatcher>)autofillSuggestionViewMatcher; + (id<GREYMatcher>)autofillSuggestionViewMatcher;
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#import "ios/chrome/browser/ui/settings/import_data_table_view_controller.h" #import "ios/chrome/browser/ui/settings/import_data_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/password/passwords_table_view_controller.h" #import "ios/chrome/browser/ui/settings/password/passwords_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/privacy_table_view_controller.h" #import "ios/chrome/browser/ui/settings/privacy_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/settings_root_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/settings_table_view_controller.h" #import "ios/chrome/browser/ui/settings/settings_table_view_controller.h"
#import "ios/chrome/browser/ui/static_content/static_html_view_controller.h" #import "ios/chrome/browser/ui/static_content/static_html_view_controller.h"
#import "ios/chrome/browser/ui/tab_grid/grid/grid_constants.h" #import "ios/chrome/browser/ui/tab_grid/grid/grid_constants.h"
...@@ -760,6 +761,10 @@ UIView* SubviewWithAccessibilityIdentifier(NSString* accessibility_id, ...@@ -760,6 +761,10 @@ UIView* SubviewWithAccessibilityIdentifier(NSString* accessibility_id,
return grey_accessibilityID(kFormSuggestionLabelAccessibilityIdentifier); return grey_accessibilityID(kFormSuggestionLabelAccessibilityIdentifier);
} }
+ (id<GREYMatcher>)settingsBottomToolbarDeleteButton {
return grey_accessibilityID(kSettingsToolbarDeleteButtonId);
}
#pragma mark - Manual Fallback #pragma mark - Manual Fallback
+ (id<GREYMatcher>)manualFallbackFormSuggestionViewMatcher { + (id<GREYMatcher>)manualFallbackFormSuggestionViewMatcher {
......
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