Commit bee7a087 authored by Olivier Robin's avatar Olivier Robin Committed by Commit Bot

Fix testAutofillProfileViewPage

Company name is not on the settings page anymore (but country is)

Change-Id: Ia6dc7ffc22e6d7cab9ecfc935031bf1c571e83f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1890078Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Reviewed-by: default avatarDominic Battré <battre@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Reviewed-by: default avatarVadym Doroshenko <dvadym@chromium.org>
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713429}
parent fb38cf96
......@@ -45,6 +45,7 @@ const DisplayStringIDToExpectedResult kExpectedFields[] = {
{IDS_IOS_AUTOFILL_CITY, @"Elysium"},
{IDS_IOS_AUTOFILL_STATE, @"CA"},
{IDS_IOS_AUTOFILL_ZIP, @"91111"},
{IDS_IOS_AUTOFILL_COUNTRY, @"United States"},
{IDS_IOS_AUTOFILL_PHONE, @"16502111111"},
{IDS_IOS_AUTOFILL_EMAIL, @"johndoe@hades.com"}};
......@@ -136,8 +137,7 @@ id<GREYMatcher> NavigationBarEditButton() {
}
// Test that the page for viewing Autofill profile details is as expected.
// TODO(crbug.com/922117): Reenable test.
- (void)FLAKY_testAutofillProfileViewPage {
- (void)testAutofillProfileViewPage {
[AutofillAppInterface saveExampleProfile];
[self openEditProfile:kProfileLabel];
......@@ -147,13 +147,18 @@ id<GREYMatcher> NavigationBarEditButton() {
stringWithFormat:@"%@, %@",
l10n_util::GetNSString(expectation.display_string_id),
expectation.expected_result]);
BOOL mustBePresent = YES;
if (expectation.display_string_id == IDS_IOS_AUTOFILL_COMPANY_NAME &&
![ChromeEarlGrey isAutofillCompanyNameEnabled]) {
mustBePresent = NO;
}
[[[EarlGrey
selectElementWithMatcher:grey_allOf(elementMatcher,
grey_sufficientlyVisible(), nil)]
usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, 150)
onElementWithMatcher:grey_accessibilityID(
kAutofillProfileEditTableViewId)]
assertWithMatcher:grey_notNil()];
assertWithMatcher:mustBePresent ? grey_notNil() : grey_nil()];
}
// Go back to the list view page.
......
......@@ -6,6 +6,7 @@ specific_include_rules = {
],
# To compile base::Feature under EG2
"chrome_earl_grey_app_interface\.mm":[
"+components/autofill/core/common/autofill_features.h",
"+components/payments/core/features.h",
"+components/ukm/ios/features.h",
"+services/metrics/public/cpp/ukm_recorder.h",
......
......@@ -429,6 +429,9 @@ id ExecuteJavaScript(NSString* javascript, NSError* __autoreleasing* out_error);
// Returns YES if CreditCardScanner feature is enabled.
- (BOOL)isCreditCardScannerEnabled WARN_UNUSED_RESULT;
// Returns YES if AutofillEnableCompanyName feature is enabled.
- (BOOL)isAutofillCompanyNameEnabled WARN_UNUSED_RESULT;
// Returns YES if custom WebKit frameworks were properly loaded, rather than
// system frameworks. Always returns YES if the app was not requested to run
// with custom WebKit frameworks.
......
......@@ -740,6 +740,10 @@ GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(ChromeEarlGreyAppInterface)
return [ChromeEarlGreyAppInterface isCreditCardScannerEnabled];
}
- (BOOL)isAutofillCompanyNameEnabled {
return [ChromeEarlGreyAppInterface isAutofillCompanyNameEnabled];
}
- (BOOL)isCustomWebKitLoadedIfRequested {
return [ChromeEarlGreyAppInterface isCustomWebKitLoadedIfRequested];
}
......
......@@ -338,6 +338,9 @@
// Returns YES if CreditCardScanner feature is enabled.
+ (BOOL)isCreditCardScannerEnabled WARN_UNUSED_RESULT;
// Returns YES if AutofillEnableCompanyName feature is enabled.
+ (BOOL)isAutofillCompanyNameEnabled WARN_UNUSED_RESULT;
// Returns YES if custom WebKit frameworks were properly loaded, rather than
// system frameworks. Always returns YES if the app was not requested to run
// with custom WebKit frameworks.
......
......@@ -7,6 +7,7 @@
#include "base/strings/sys_string_conversions.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#import "components/payments/core/features.h"
#import "components/ukm/ios/features.h"
......@@ -584,6 +585,11 @@ using chrome_test_util::BrowserCommandDispatcherForMainBVC;
return base::FeatureList::IsEnabled(kCreditCardScanner);
}
+ (BOOL)isAutofillCompanyNameEnabled {
return base::FeatureList::IsEnabled(
autofill::features::kAutofillEnableCompanyName);
}
+ (BOOL)isCustomWebKitLoadedIfRequested {
return IsCustomWebKitLoadedIfRequested();
}
......
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