Commit b27f6c3c authored by Stephen McGruer's avatar Stephen McGruer Committed by Commit Bot

Revert "[iOS][MF][EG2] Migrate credit card tests"

This reverts commit 919aab84.

Reason for revert: Suspected of breaking compile for xcode-ios-bots - https://ci.chromium.org/p/chromium/builders/ci/ios-device-xcode-clang/113639

Original change's description:
> [iOS][MF][EG2] Migrate credit card tests
> 
> Consolidate Manual Fallback matchers in one place.
> Consolidate credit card Autofill helpers in the respective app
> interface.
> 
> TBR= eugenebut@chromium.org
> 
> Bug: 1017685, 1016367
> Change-Id: Ib91e2baba9e72f6e065e8ebf08fdd5f5d3c0c9bb
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1878197
> Commit-Queue: Javier Ernesto Flores Robles <javierrobles@chromium.org>
> Reviewed-by: Stepan Khapugin <stkhapugin@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#709020}

TBR=stkhapugin@chromium.org,javierrobles@chromium.org

Change-Id: I644e9e91acab68e69d7cba86af2037fd43603b36
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1017685, 1016367
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1878911Reviewed-by: default avatarStephen McGruer <smcgruer@chromium.org>
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709028}
parent a36e4c75
......@@ -30,15 +30,6 @@
// Resturns the name of the sample profile.
+ (NSString*)exampleProfileName;
// Removes the stored credit cards.
+ (void)clearCreditCardStore;
// Saves a local credit card that doesn't require CVC to be used.
+ (void)saveLocalCreditCard;
// Saves a masked credit card that requires CVC to be used.
+ (void)saveMaskedCreditCard;
@end
#endif // IOS_CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_APP_INTERFACE_H_
......@@ -189,41 +189,6 @@ void AddAutofillProfile(autofill::PersonalDataManager* personalDataManager) {
return base::SysUTF16ToNSString(name);
}
+ (void)clearCreditCardStore {
autofill::PersonalDataManager* personalDataManager =
[self personalDataManager];
for (const auto* creditCard : personalDataManager->GetCreditCards()) {
personalDataManager->RemoveByGUID(creditCard->guid());
}
}
+ (void)saveLocalCreditCard {
autofill::PersonalDataManager* personalDataManager =
[self personalDataManager];
autofill::CreditCard card = autofill::test::GetCreditCard();
size_t card_count = personalDataManager->GetCreditCards().size();
personalDataManager->AddCreditCard(card);
ConditionBlock conditionBlock = ^bool {
return card_count < personalDataManager->GetCreditCards().size();
};
base::test::ios::TimeUntilCondition(
nil, conditionBlock, false,
base::TimeDelta::FromSeconds(
base::test::ios::kWaitForFileOperationTimeout));
personalDataManager->NotifyPersonalDataObserver();
}
+ (void)saveMaskedCreditCard {
autofill::PersonalDataManager* personalDataManager =
[self personalDataManager];
autofill::CreditCard card = autofill::test::GetMaskedServerCard();
DCHECK(card.record_type() != autofill::CreditCard::LOCAL_CARD);
personalDataManager->AddServerCreditCardForTest(
std::make_unique<autofill::CreditCard>(card));
personalDataManager->NotifyPersonalDataObserver();
}
#pragma mark - Private
// The PersonalDataManager instance for the current browser state.
......
......@@ -236,7 +236,6 @@ source_set("eg2_tests") {
]
testonly = true
sources = [
"card_view_controller_egtest.mm",
"fallback_coordinator_egtest.mm",
"password_view_controller_egtest.mm",
]
......@@ -245,7 +244,6 @@ source_set("eg2_tests") {
"//base/test:test_support",
"//ios/chrome/app/strings:ios_strings_grit",
"//ios/chrome/browser/ui/autofill:eg_test_support+eg2",
"//ios/chrome/browser/ui/settings/autofill:feature_flags",
"//ios/chrome/test/earl_grey:eg_test_support+eg2",
"//ios/testing/earl_grey:eg_test_support+eg2",
"//ios/third_party/earl_grey2:test_lib",
......
......@@ -134,7 +134,6 @@ source_set("eg2_tests") {
":feature_flags",
"//base",
"//ios/chrome/app/strings",
"//ios/chrome/browser/ui/autofill:eg_test_support+eg2",
"//ios/chrome/test/earl_grey:eg_test_support+eg2",
"//ios/testing/earl_grey:eg_test_support+eg2",
"//ios/third_party/earl_grey2:test_lib",
......
......@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "base/ios/ios_util.h"
#import "ios/chrome/browser/ui/autofill/autofill_app_interface.h"
#import "ios/chrome/browser/ui/settings/autofill/features.h"
#include "ios/chrome/grit/ios_strings.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
......@@ -108,7 +107,7 @@ id<GREYMatcher> CardNumberIconView(NSString* icon_type) {
}
- (void)tearDown {
[AutofillAppInterface clearCreditCardStore];
[ChromeEarlGrey clearCreditCards];
[super tearDown];
}
......@@ -231,7 +230,7 @@ id<GREYMatcher> CardNumberIconView(NSString* icon_type) {
// and the new card number appears on the Autofill Credit Card 'Payment Methods'
// screen.
- (void)testAddButtonOnValidNumber {
[AutofillAppInterface clearCreditCardStore];
[ChromeEarlGrey clearCreditCards];
[[EarlGrey selectElementWithMatcher:CardNumberTextField()]
performAction:grey_typeText(@"4111111111111111")];
[[EarlGrey selectElementWithMatcher:MonthOfExpiryTextField()]
......
......@@ -370,6 +370,11 @@ id ExecuteJavaScript(NSString* javascript, NSError* __autoreleasing* out_error);
// doesn't specify a title.
- (NSString*)displayTitleForURL:(const GURL&)URL;
#pragma mark - Autofill Utilities (EG2)
// Removes the stored credit cards.
- (void)clearCreditCards;
#pragma mark - JavaScript Utilities (EG2)
// Executes JavaScript on current WebState, and waits for either the completion
......
......@@ -669,6 +669,12 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeEarlGreyAppInterface)
return [ChromeEarlGreyAppInterface displayTitleForURL:spec];
}
#pragma mark - Autofill Utilities (EG2)
- (void)clearCreditCards {
[ChromeEarlGreyAppInterface clearCreditCards];
}
#pragma mark - Accessibility Utilities (EG2)
- (void)verifyAccessibilityForCurrentScreen {
......
......@@ -219,6 +219,11 @@
// doesn't specify a title.
+ (NSString*)displayTitleForURL:(NSString*)URL;
#pragma mark - Autofill Utilities (EG2)
// Removes the stored credit cards.
+ (void)clearCreditCards;
#pragma mark - Sync Utilities (EG2)
// Clears fake sync server data.
......
......@@ -376,6 +376,17 @@ using chrome_test_util::BrowserCommandDispatcherForMainBVC;
web::GetDisplayTitleForUrl(GURL(base::SysNSStringToUTF8(URL))));
}
#pragma mark - Autofill Utilities (EG2)
+ (void)clearCreditCards {
autofill::PersonalDataManager* personalDataManager =
autofill::PersonalDataManagerFactory::GetForBrowserState(
chrome_test_util::GetOriginalBrowserState());
for (const auto* creditCard : personalDataManager->GetCreditCards()) {
personalDataManager->RemoveByGUID(creditCard->guid());
}
}
#pragma mark - Sync Utilities (EG2)
+ (int)numberOfSyncEntitiesWithType:(syncer::ModelType)type {
......
......@@ -377,9 +377,6 @@ id<GREYMatcher> SettingsPasswordSearchMatcher();
// Returns a matcher for the profiles settings collection view.
id<GREYMatcher> SettingsProfileMatcher();
// Returns a matcher for the credit card settings collection view.
id<GREYMatcher> SettingsCreditCardMatcher();
// Returns a matcher for an autofill suggestion view.
id<GREYMatcher> AutofillSuggestionViewMatcher();
......@@ -431,23 +428,6 @@ id<GREYMatcher> SettingsProfileMatcher();
// Returns a matcher for the ProfileTableView window.
id<GREYMatcher> ManualFallbackProfileTableViewWindowMatcher();
// Returns a matcher for the credit card icon in the keyboard accessory bar.
id<GREYMatcher> ManualFallbackCreditCardIconMatcher();
// Returns a matcher for the credit card table view in manual fallback.
id<GREYMatcher> ManualFallbackCreditCardTableViewMatcher();
// Returns a matcher for the button to open password settings in manual
// fallback.
id<GREYMatcher> ManualFallbackManageCreditCardsMatcher();
// Returns a matcher for the button to add credit cards settings in manual
// fallback.
id<GREYMatcher> ManualFallbackAddCreditCardsMatcher();
// Returns a matcher for the CreditCardTableView window.
id<GREYMatcher> ManualFallbackCreditCardTableViewWindowMatcher();
} // namespace chrome_test_util
#endif // IOS_CHROME_TEST_EARL_GREY_CHROME_MATCHERS_H_
......@@ -471,10 +471,6 @@ id<GREYMatcher> SettingsProfileMatcher() {
return [ChromeMatchersAppInterface settingsProfileMatcher];
}
id<GREYMatcher> SettingsCreditCardMatcher() {
return [ChromeMatchersAppInterface settingsCreditCardMatcher];
}
id<GREYMatcher> AutofillSuggestionViewMatcher() {
return [ChromeMatchersAppInterface autofillSuggestionViewMatcher];
}
......@@ -540,27 +536,4 @@ id<GREYMatcher> ManualFallbackProfileTableViewWindowMatcher() {
[ChromeMatchersAppInterface manualFallbackProfileTableViewWindowMatcher];
}
id<GREYMatcher> ManualFallbackCreditCardIconMatcher() {
return [ChromeMatchersAppInterface manualFallbackCreditCardIconMatcher];
}
id<GREYMatcher> ManualFallbackCreditCardTableViewMatcher() {
return [ChromeMatchersAppInterface manualFallbackCreditCardTableViewMatcher];
}
// Returns a matcher for the button to open password settings in manual
id<GREYMatcher> ManualFallbackManageCreditCardsMatcher() {
return [ChromeMatchersAppInterface manualFallbackManageCreditCardsMatcher];
}
// Returns a matcher for the button to add credit cards settings in manual
id<GREYMatcher> ManualFallbackAddCreditCardsMatcher() {
return [ChromeMatchersAppInterface manualFallbackAddCreditCardsMatcher];
}
id<GREYMatcher> ManualFallbackCreditCardTableViewWindowMatcher() {
return [ChromeMatchersAppInterface
manualFallbackCreditCardTableViewWindowMatcher];
}
} // namespace chrome_test_util
......@@ -382,9 +382,6 @@
// Returns a matcher for the profiles settings collection view.
+ (id<GREYMatcher>)settingsProfileMatcher;
// Returns a matcher for the credit card settings collection view.
+ (id<GREYMatcher>)settingsCreditCardMatcher;
// Returns a matcher for an autofill suggestion view.
+ (id<GREYMatcher>)autofillSuggestionViewMatcher;
......@@ -433,23 +430,6 @@
// Returns a matcher for the ProfileTableView window.
+ (id<GREYMatcher>)manualFallbackProfileTableViewWindowMatcher;
// Returns a matcher for the credit card icon in the keyboard accessory bar.
+ (id<GREYMatcher>)manualFallbackCreditCardIconMatcher;
// Returns a matcher for the credit card table view in manual fallback.
+ (id<GREYMatcher>)manualFallbackCreditCardTableViewMatcher;
// Returns a matcher for the button to open password settings in manual
// fallback.
+ (id<GREYMatcher>)manualFallbackManageCreditCardsMatcher;
// Returns a matcher for the button to add credit cards settings in manual
// fallback.
+ (id<GREYMatcher>)manualFallbackAddCreditCardsMatcher;
// Returns a matcher for the CreditCardTableView window.
+ (id<GREYMatcher>)manualFallbackCreditCardTableViewWindowMatcher;
@end
#endif // IOS_CHROME_TEST_EARL_GREY_CHROME_MATCHERS_APP_INTERFACE_H_
......@@ -11,9 +11,6 @@
#import "ios/chrome/browser/ui/authentication/cells/signin_promo_view.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/address_mediator.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/address_view_controller.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/card_coordinator.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/card_mediator.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/card_view_controller.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/manual_fill_accessory_view_controller.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/manual_fill_password_cell.h"
#import "ios/chrome/browser/ui/autofill/manual_fill/manual_fill_password_mediator.h"
......@@ -751,10 +748,6 @@ UIView* SubviewWithAccessibilityIdentifier(NSString* accessibility_id,
return grey_accessibilityID(kAutofillProfileTableViewID);
}
+ (id<GREYMatcher>)settingsCreditCardMatcher {
return grey_accessibilityID(kAutofillCreditCardTableViewId);
}
+ (id<GREYMatcher>)autofillSuggestionViewMatcher {
return grey_accessibilityID(kFormSuggestionLabelAccessibilityIdentifier);
}
......@@ -832,31 +825,4 @@ UIView* SubviewWithAccessibilityIdentifier(NSString* accessibility_id,
grey_descendant([self manualFallbackProfilesTableViewMatcher]);
return grey_allOf(classMatcher, parentMatcher, nil);
}
+ (id<GREYMatcher>)manualFallbackCreditCardIconMatcher {
return grey_accessibilityID(
manual_fill::AccessoryCreditCardAccessibilityIdentifier);
}
+ (id<GREYMatcher>)manualFallbackCreditCardTableViewMatcher {
return grey_accessibilityID(
manual_fill::CardTableViewAccessibilityIdentifier);
}
+ (id<GREYMatcher>)manualFallbackManageCreditCardsMatcher {
return grey_accessibilityID(manual_fill::ManageCardsAccessibilityIdentifier);
}
+ (id<GREYMatcher>)manualFallbackAddCreditCardsMatcher {
return grey_accessibilityID(
manual_fill::kAddCreditCardsAccessibilityIdentifier);
}
+ (id<GREYMatcher>)manualFallbackCreditCardTableViewWindowMatcher {
id<GREYMatcher> classMatcher = grey_kindOfClass([UIWindow class]);
id<GREYMatcher> parentMatcher =
grey_descendant([self manualFallbackCreditCardTableViewMatcher]);
return grey_allOf(classMatcher, parentMatcher, nil);
}
@end
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