Chromium Code Reviews| Index: ios/chrome/browser/ui/first_run/first_run_egtest.mm |
| diff --git a/ios/chrome/browser/ui/first_run/first_run_egtest.mm b/ios/chrome/browser/ui/first_run/first_run_egtest.mm |
| index 5476786fb4f243401e53bfd9bdc1040b95b4f84c..99a93c2adb95ffb35d3884ee19a446897177b646 100644 |
| --- a/ios/chrome/browser/ui/first_run/first_run_egtest.mm |
| +++ b/ios/chrome/browser/ui/first_run/first_run_egtest.mm |
| @@ -6,6 +6,7 @@ |
| #import <XCTest/XCTest.h> |
| #include "base/strings/sys_string_conversions.h" |
| +#import "base/test/ios/wait_util.h" |
| #include "components/metrics/metrics_pref_names.h" |
| #include "components/metrics/metrics_reporting_default_state.h" |
| #include "components/prefs/pref_member.h" |
| @@ -28,6 +29,7 @@ |
| #import "ios/chrome/test/earl_grey/chrome_test_case.h" |
| #import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h" |
| #import "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.h" |
| +#import "ios/testing/wait_util.h" |
| #include "ui/base/l10n/l10n_util.h" |
| #if !defined(__has_feature) || !__has_feature(objc_arc) |
| @@ -86,6 +88,19 @@ void AssertAuthenticatedIdentityInActiveProfile(ChromeIdentity* identity) { |
| @"\"%@\", actual = \"%s\"]", |
| identity.gaiaID, info.gaia.c_str()); |
| } |
| + |
| +// Wait until |matcher| is accessible (not nil) |
| +void WaitForMatcher(id<GREYMatcher> matcher) { |
| + ConditionBlock condition = ^{ |
| + NSError* error = nil; |
| + [[EarlGrey selectElementWithMatcher:matcher] assertWithMatcher:grey_notNil() |
| + error:&error]; |
| + return error == nil; |
| + }; |
| + GREYAssert(testing::WaitUntilConditionOrTimeout( |
| + testing::kWaitForUIElementTimeout, condition), |
| + @"Waiting for matcher %@ failed.", matcher); |
| +} |
| } |
| @interface MainController (ExposedForTesting) |
| @@ -215,9 +230,7 @@ void AssertAuthenticatedIdentityInActiveProfile(ChromeIdentity* identity) { |
| AssertAuthenticatedIdentityInActiveProfile(nil); |
| } |
| -// Signs in to an account and then taps the Advanced link to go to settings. |
|
baxley
2017/06/01 17:16:25
This is the test comment, so it should stay.
jlebel
2017/06/02 09:28:26
Done.
|
| -// TODO(crbug.com/718023): Re-enable test. |
| -- (void)DISABLED_testSignInAndTapSettingsLink { |
| +- (void)FLAKY_testSignInAndTapSettingsLink { |
|
baxley
2017/06/01 17:16:25
Could you keep the TODO?
jlebel
2017/06/02 09:28:26
Done.
|
| ChromeIdentity* identity = GetFakeIdentity(); |
| ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity( |
| identity); |
| @@ -234,7 +247,9 @@ void AssertAuthenticatedIdentityInActiveProfile(ChromeIdentity* identity) { |
| // Tap Settings link. |
| id<GREYMatcher> settings_link_matcher = grey_allOf( |
| - grey_accessibilityLabel(@"Settings"), grey_sufficientlyVisible(), nil); |
| + grey_accessibilityLabel(@"Settings"), grey_sufficientlyVisible(), |
| + grey_enabled(), grey_interactable(), nil); |
| + WaitForMatcher(settings_link_matcher); |
|
baxley
2017/06/01 17:16:25
Similar to in the other file, do we need the extra
jlebel
2017/06/02 09:28:26
Done.
|
| [[EarlGrey selectElementWithMatcher:settings_link_matcher] |
| performAction:grey_tap()]; |