| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import <EarlGrey/EarlGrey.h> | 5 #import <EarlGrey/EarlGrey.h> |
| 6 #import <XCTest/XCTest.h> | 6 #import <XCTest/XCTest.h> |
| 7 | 7 |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #import "base/test/ios/wait_util.h" | 9 #import "base/test/ios/wait_util.h" |
| 10 #include "components/signin/core/browser/signin_manager.h" | 10 #include "components/signin/core/browser/signin_manager.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // collection view might duplicate it (with the old one being hidden but | 62 // collection view might duplicate it (with the old one being hidden but |
| 63 // EarlGrey can find it). | 63 // EarlGrey can find it). |
| 64 id<GREYMatcher> matcher = grey_allOf(grey_accessibilityID(accessiblity_id), | 64 id<GREYMatcher> matcher = grey_allOf(grey_accessibilityID(accessiblity_id), |
| 65 grey_sufficientlyVisible(), nil); | 65 grey_sufficientlyVisible(), nil); |
| 66 [[EarlGrey selectElementWithMatcher:matcher] performAction:grey_tap()]; | 66 [[EarlGrey selectElementWithMatcher:matcher] performAction:grey_tap()]; |
| 67 } | 67 } |
| 68 | 68 |
| 69 // Taps the button with accessibility label |label|. | 69 // Taps the button with accessibility label |label|. |
| 70 void TapButtonWithAccessibilityLabel(NSString* label) { | 70 void TapButtonWithAccessibilityLabel(NSString* label) { |
| 71 id<GREYMatcher> matcher = | 71 id<GREYMatcher> matcher = |
| 72 chrome_test_util::buttonWithAccessibilityLabel(label); | 72 chrome_test_util::ButtonWithAccessibilityLabel(label); |
| 73 [[EarlGrey selectElementWithMatcher:matcher] performAction:grey_tap()]; | 73 [[EarlGrey selectElementWithMatcher:matcher] performAction:grey_tap()]; |
| 74 } | 74 } |
| 75 | 75 |
| 76 // Taps the button with accessibility labelId |message_id|. | 76 // Taps the button with accessibility labelId |message_id|. |
| 77 void TapButtonWithLabelId(int message_id) { | 77 void TapButtonWithLabelId(int message_id) { |
| 78 id<GREYMatcher> matcher = | 78 id<GREYMatcher> matcher = |
| 79 chrome_test_util::buttonWithAccessibilityLabelId(message_id); | 79 chrome_test_util::ButtonWithAccessibilityLabelId(message_id); |
| 80 [[EarlGrey selectElementWithMatcher:matcher] performAction:grey_tap()]; | 80 [[EarlGrey selectElementWithMatcher:matcher] performAction:grey_tap()]; |
| 81 } | 81 } |
| 82 | 82 |
| 83 // Opens the signin screen from the settings page. Must be called from the NTP. | 83 // Opens the signin screen from the settings page. Must be called from the NTP. |
| 84 // User must not be signed in. | 84 // User must not be signed in. |
| 85 void OpenSignInFromSettings() { | 85 void OpenSignInFromSettings() { |
| 86 const CGFloat scroll_displacement = 50.0; | 86 const CGFloat scroll_displacement = 50.0; |
| 87 | 87 |
| 88 [ChromeEarlGreyUI openToolsMenu]; | 88 [ChromeEarlGreyUI openToolsMenu]; |
| 89 [[[EarlGrey | 89 [[[EarlGrey |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 identity_service->AddIdentity(identity); | 251 identity_service->AddIdentity(identity); |
| 252 | 252 |
| 253 // Sign in to |managed_identity|. | 253 // Sign in to |managed_identity|. |
| 254 OpenSignInFromSettings(); | 254 OpenSignInFromSettings(); |
| 255 TapButtonWithAccessibilityLabel(managed_identity.userEmail); | 255 TapButtonWithAccessibilityLabel(managed_identity.userEmail); |
| 256 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SIGNIN_BUTTON); | 256 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SIGNIN_BUTTON); |
| 257 | 257 |
| 258 // Accept warning for signing into a managed identity, with synchronization | 258 // Accept warning for signing into a managed identity, with synchronization |
| 259 // off due to an infinite spinner. | 259 // off due to an infinite spinner. |
| 260 SetEarlGreySynchronizationEnabled(NO); | 260 SetEarlGreySynchronizationEnabled(NO); |
| 261 WaitForMatcher(chrome_test_util::buttonWithAccessibilityLabelId( | 261 WaitForMatcher(chrome_test_util::ButtonWithAccessibilityLabelId( |
| 262 IDS_IOS_MANAGED_SIGNIN_ACCEPT_BUTTON)); | 262 IDS_IOS_MANAGED_SIGNIN_ACCEPT_BUTTON)); |
| 263 TapButtonWithLabelId(IDS_IOS_MANAGED_SIGNIN_ACCEPT_BUTTON); | 263 TapButtonWithLabelId(IDS_IOS_MANAGED_SIGNIN_ACCEPT_BUTTON); |
| 264 SetEarlGreySynchronizationEnabled(YES); | 264 SetEarlGreySynchronizationEnabled(YES); |
| 265 | 265 |
| 266 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_CONFIRMATION_OK_BUTTON); | 266 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_CONFIRMATION_OK_BUTTON); |
| 267 AssertAuthenticatedIdentityInActiveProfile(managed_identity); | 267 AssertAuthenticatedIdentityInActiveProfile(managed_identity); |
| 268 | 268 |
| 269 // Switch Sync account to |identity|. | 269 // Switch Sync account to |identity|. |
| 270 TapViewWithAccessibilityId(kSettingsAccountCellId); | 270 TapViewWithAccessibilityId(kSettingsAccountCellId); |
| 271 TapViewWithAccessibilityId(kSettingsAccountsSyncCellId); | 271 TapViewWithAccessibilityId(kSettingsAccountsSyncCellId); |
| 272 TapButtonWithAccessibilityLabel(identity.userEmail); | 272 TapButtonWithAccessibilityLabel(identity.userEmail); |
| 273 | 273 |
| 274 // Accept warning for signout out of a managed identity, with synchronization | 274 // Accept warning for signout out of a managed identity, with synchronization |
| 275 // off due to an infinite spinner. | 275 // off due to an infinite spinner. |
| 276 SetEarlGreySynchronizationEnabled(NO); | 276 SetEarlGreySynchronizationEnabled(NO); |
| 277 WaitForMatcher(chrome_test_util::buttonWithAccessibilityLabelId( | 277 WaitForMatcher(chrome_test_util::ButtonWithAccessibilityLabelId( |
| 278 IDS_IOS_MANAGED_SWITCH_ACCEPT_BUTTON)); | 278 IDS_IOS_MANAGED_SWITCH_ACCEPT_BUTTON)); |
| 279 TapButtonWithLabelId(IDS_IOS_MANAGED_SWITCH_ACCEPT_BUTTON); | 279 TapButtonWithLabelId(IDS_IOS_MANAGED_SWITCH_ACCEPT_BUTTON); |
| 280 SetEarlGreySynchronizationEnabled(YES); | 280 SetEarlGreySynchronizationEnabled(YES); |
| 281 | 281 |
| 282 AssertAuthenticatedIdentityInActiveProfile(identity); | 282 AssertAuthenticatedIdentityInActiveProfile(identity); |
| 283 | 283 |
| 284 // Close Settings. | 284 // Close Settings. |
| 285 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); | 285 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); |
| 286 } | 286 } |
| 287 | 287 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 ChromeIdentity* identity = GetFakeManagedIdentity(); | 329 ChromeIdentity* identity = GetFakeManagedIdentity(); |
| 330 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity( | 330 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity( |
| 331 identity); | 331 identity); |
| 332 | 332 |
| 333 // Sign in to |identity|. | 333 // Sign in to |identity|. |
| 334 OpenSignInFromSettings(); | 334 OpenSignInFromSettings(); |
| 335 TapButtonWithAccessibilityLabel(identity.userEmail); | 335 TapButtonWithAccessibilityLabel(identity.userEmail); |
| 336 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SIGNIN_BUTTON); | 336 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SIGNIN_BUTTON); |
| 337 // Synchronization off due to an infinite spinner. | 337 // Synchronization off due to an infinite spinner. |
| 338 SetEarlGreySynchronizationEnabled(NO); | 338 SetEarlGreySynchronizationEnabled(NO); |
| 339 WaitForMatcher(chrome_test_util::buttonWithAccessibilityLabelId( | 339 WaitForMatcher(chrome_test_util::ButtonWithAccessibilityLabelId( |
| 340 IDS_IOS_MANAGED_SIGNIN_ACCEPT_BUTTON)); | 340 IDS_IOS_MANAGED_SIGNIN_ACCEPT_BUTTON)); |
| 341 TapButtonWithLabelId(IDS_IOS_MANAGED_SIGNIN_ACCEPT_BUTTON); | 341 TapButtonWithLabelId(IDS_IOS_MANAGED_SIGNIN_ACCEPT_BUTTON); |
| 342 SetEarlGreySynchronizationEnabled(YES); | 342 SetEarlGreySynchronizationEnabled(YES); |
| 343 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_CONFIRMATION_OK_BUTTON); | 343 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_CONFIRMATION_OK_BUTTON); |
| 344 AssertAuthenticatedIdentityInActiveProfile(identity); | 344 AssertAuthenticatedIdentityInActiveProfile(identity); |
| 345 | 345 |
| 346 // Go to Accounts Settings and tap the sign out button. | 346 // Go to Accounts Settings and tap the sign out button. |
| 347 TapViewWithAccessibilityId(kSettingsAccountCellId); | 347 TapViewWithAccessibilityId(kSettingsAccountCellId); |
| 348 const CGFloat scroll_displacement = 100.0; | 348 const CGFloat scroll_displacement = 100.0; |
| 349 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID( | 349 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 id<GREYMatcher> settings_link_matcher = grey_allOf( | 381 id<GREYMatcher> settings_link_matcher = grey_allOf( |
| 382 grey_accessibilityLabel(@"Settings"), grey_sufficientlyVisible(), nil); | 382 grey_accessibilityLabel(@"Settings"), grey_sufficientlyVisible(), nil); |
| 383 [[EarlGrey selectElementWithMatcher:settings_link_matcher] | 383 [[EarlGrey selectElementWithMatcher:settings_link_matcher] |
| 384 performAction:grey_tap()]; | 384 performAction:grey_tap()]; |
| 385 | 385 |
| 386 // Close Settings. | 386 // Close Settings. |
| 387 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); | 387 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); |
| 388 | 388 |
| 389 // All Settings should be gone and user signed in. | 389 // All Settings should be gone and user signed in. |
| 390 id<GREYMatcher> settings_matcher = | 390 id<GREYMatcher> settings_matcher = |
| 391 chrome_test_util::staticTextWithAccessibilityLabelId( | 391 chrome_test_util::StaticTextWithAccessibilityLabelId( |
| 392 IDS_IOS_SETTINGS_TITLE); | 392 IDS_IOS_SETTINGS_TITLE); |
| 393 [[EarlGrey selectElementWithMatcher:settings_matcher] | 393 [[EarlGrey selectElementWithMatcher:settings_matcher] |
| 394 assertWithMatcher:grey_notVisible()]; | 394 assertWithMatcher:grey_notVisible()]; |
| 395 AssertAuthenticatedIdentityInActiveProfile(identity); | 395 AssertAuthenticatedIdentityInActiveProfile(identity); |
| 396 } | 396 } |
| 397 | 397 |
| 398 // Opens the sign in screen and then cancel it by opening a new tab. Ensures | 398 // Opens the sign in screen and then cancel it by opening a new tab. Ensures |
| 399 // that the sign in screen is correctly dismissed. crbug.com/462200 | 399 // that the sign in screen is correctly dismissed. crbug.com/462200 |
| 400 - (void)testSignInCancelIdentityPicker { | 400 - (void)testSignInCancelIdentityPicker { |
| 401 // Add an identity to avoid arriving on the Add Account screen when opening | 401 // Add an identity to avoid arriving on the Add Account screen when opening |
| 402 // sign-in. | 402 // sign-in. |
| 403 ChromeIdentity* identity = GetFakeIdentity1(); | 403 ChromeIdentity* identity = GetFakeIdentity1(); |
| 404 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity( | 404 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity( |
| 405 identity); | 405 identity); |
| 406 | 406 |
| 407 OpenSignInFromSettings(); | 407 OpenSignInFromSettings(); |
| 408 | 408 |
| 409 // Open new tab to cancel sign-in. | 409 // Open new tab to cancel sign-in. |
| 410 base::scoped_nsobject<OpenUrlCommand> command( | 410 base::scoped_nsobject<OpenUrlCommand> command( |
| 411 [[OpenUrlCommand alloc] initWithURLFromChrome:GURL("about:blank")]); | 411 [[OpenUrlCommand alloc] initWithURLFromChrome:GURL("about:blank")]); |
| 412 chrome_test_util::RunCommandWithActiveViewController(command); | 412 chrome_test_util::RunCommandWithActiveViewController(command); |
| 413 | 413 |
| 414 // Re-open the sign-in screen. If it wasn't correctly dismissed previously, | 414 // Re-open the sign-in screen. If it wasn't correctly dismissed previously, |
| 415 // this will fail. | 415 // this will fail. |
| 416 OpenSignInFromSettings(); | 416 OpenSignInFromSettings(); |
| 417 id<GREYMatcher> signin_matcher = | 417 id<GREYMatcher> signin_matcher = |
| 418 chrome_test_util::staticTextWithAccessibilityLabelId( | 418 chrome_test_util::StaticTextWithAccessibilityLabelId( |
| 419 IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_DESCRIPTION); | 419 IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_DESCRIPTION); |
| 420 [[EarlGrey selectElementWithMatcher:signin_matcher] | 420 [[EarlGrey selectElementWithMatcher:signin_matcher] |
| 421 assertWithMatcher:grey_sufficientlyVisible()]; | 421 assertWithMatcher:grey_sufficientlyVisible()]; |
| 422 | 422 |
| 423 // Close sign-in screen and Settings. | 423 // Close sign-in screen and Settings. |
| 424 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON); | 424 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON); |
| 425 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); | 425 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); |
| 426 } | 426 } |
| 427 | 427 |
| 428 // Opens the add account screen and then cancels it by opening a new tab. | 428 // Opens the add account screen and then cancels it by opening a new tab. |
| 429 // Ensures that the add account screen is correctly dismissed. crbug.com/462200 | 429 // Ensures that the add account screen is correctly dismissed. crbug.com/462200 |
| 430 - (void)testSignInCancelAddAccount { | 430 - (void)testSignInCancelAddAccount { |
| 431 // Add an identity to avoid arriving on the Add Account screen when opening | 431 // Add an identity to avoid arriving on the Add Account screen when opening |
| 432 // sign-in. | 432 // sign-in. |
| 433 ChromeIdentity* identity = GetFakeIdentity1(); | 433 ChromeIdentity* identity = GetFakeIdentity1(); |
| 434 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity( | 434 ios::FakeChromeIdentityService::GetInstanceFromChromeProvider()->AddIdentity( |
| 435 identity); | 435 identity); |
| 436 | 436 |
| 437 OpenSignInFromSettings(); | 437 OpenSignInFromSettings(); |
| 438 | 438 |
| 439 // Open Add Account screen. | 439 // Open Add Account screen. |
| 440 id<GREYMatcher> add_account_matcher = | 440 id<GREYMatcher> add_account_matcher = |
| 441 chrome_test_util::staticTextWithAccessibilityLabelId( | 441 chrome_test_util::StaticTextWithAccessibilityLabelId( |
| 442 IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_ADD_ACCOUNT_BUTTON); | 442 IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_ADD_ACCOUNT_BUTTON); |
| 443 [[EarlGrey selectElementWithMatcher:add_account_matcher] | 443 [[EarlGrey selectElementWithMatcher:add_account_matcher] |
| 444 performAction:grey_tap()]; | 444 performAction:grey_tap()]; |
| 445 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; | 445 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; |
| 446 | 446 |
| 447 // Open new tab to cancel sign-in. | 447 // Open new tab to cancel sign-in. |
| 448 base::scoped_nsobject<OpenUrlCommand> command( | 448 base::scoped_nsobject<OpenUrlCommand> command( |
| 449 [[OpenUrlCommand alloc] initWithURLFromChrome:GURL("about:blank")]); | 449 [[OpenUrlCommand alloc] initWithURLFromChrome:GURL("about:blank")]); |
| 450 chrome_test_util::RunCommandWithActiveViewController(command); | 450 chrome_test_util::RunCommandWithActiveViewController(command); |
| 451 | 451 |
| 452 // Re-open the sign-in screen. If it wasn't correctly dismissed previously, | 452 // Re-open the sign-in screen. If it wasn't correctly dismissed previously, |
| 453 // this will fail. | 453 // this will fail. |
| 454 OpenSignInFromSettings(); | 454 OpenSignInFromSettings(); |
| 455 id<GREYMatcher> signin_matcher = | 455 id<GREYMatcher> signin_matcher = |
| 456 chrome_test_util::staticTextWithAccessibilityLabelId( | 456 chrome_test_util::StaticTextWithAccessibilityLabelId( |
| 457 IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_DESCRIPTION); | 457 IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_DESCRIPTION); |
| 458 [[EarlGrey selectElementWithMatcher:signin_matcher] | 458 [[EarlGrey selectElementWithMatcher:signin_matcher] |
| 459 assertWithMatcher:grey_sufficientlyVisible()]; | 459 assertWithMatcher:grey_sufficientlyVisible()]; |
| 460 | 460 |
| 461 // Close sign-in screen and Settings. | 461 // Close sign-in screen and Settings. |
| 462 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON); | 462 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON); |
| 463 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); | 463 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); |
| 464 } | 464 } |
| 465 | 465 |
| 466 // Starts an authentication flow and cancel it by opening a new tab. Ensures | 466 // Starts an authentication flow and cancel it by opening a new tab. Ensures |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 505 |
| 506 // Open new tab to cancel sign-in. | 506 // Open new tab to cancel sign-in. |
| 507 base::scoped_nsobject<OpenUrlCommand> command( | 507 base::scoped_nsobject<OpenUrlCommand> command( |
| 508 [[OpenUrlCommand alloc] initWithURLFromChrome:GURL("about:blank")]); | 508 [[OpenUrlCommand alloc] initWithURLFromChrome:GURL("about:blank")]); |
| 509 chrome_test_util::RunCommandWithActiveViewController(command); | 509 chrome_test_util::RunCommandWithActiveViewController(command); |
| 510 | 510 |
| 511 // Re-open the sign-in screen. If it wasn't correctly dismissed previously, | 511 // Re-open the sign-in screen. If it wasn't correctly dismissed previously, |
| 512 // this will fail. | 512 // this will fail. |
| 513 OpenSignInFromSettings(); | 513 OpenSignInFromSettings(); |
| 514 id<GREYMatcher> signin_matcher = | 514 id<GREYMatcher> signin_matcher = |
| 515 chrome_test_util::staticTextWithAccessibilityLabelId( | 515 chrome_test_util::StaticTextWithAccessibilityLabelId( |
| 516 IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_DESCRIPTION); | 516 IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_DESCRIPTION); |
| 517 [[EarlGrey selectElementWithMatcher:signin_matcher] | 517 [[EarlGrey selectElementWithMatcher:signin_matcher] |
| 518 assertWithMatcher:grey_sufficientlyVisible()]; | 518 assertWithMatcher:grey_sufficientlyVisible()]; |
| 519 | 519 |
| 520 // Close sign-in screen and Settings. | 520 // Close sign-in screen and Settings. |
| 521 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON); | 521 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON); |
| 522 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); | 522 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); |
| 523 AssertAuthenticatedIdentityInActiveProfile(nil); | 523 AssertAuthenticatedIdentityInActiveProfile(nil); |
| 524 } | 524 } |
| 525 | 525 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 554 id<GREYMatcher> all_bookmarks_matcher = | 554 id<GREYMatcher> all_bookmarks_matcher = |
| 555 grey_allOf(grey_kindOfClass(NSClassFromString(@"BookmarkMenuCell")), | 555 grey_allOf(grey_kindOfClass(NSClassFromString(@"BookmarkMenuCell")), |
| 556 grey_descendant(grey_text(topLevelFolderTitle)), nil); | 556 grey_descendant(grey_text(topLevelFolderTitle)), nil); |
| 557 [[EarlGrey selectElementWithMatcher:all_bookmarks_matcher] | 557 [[EarlGrey selectElementWithMatcher:all_bookmarks_matcher] |
| 558 performAction:grey_tap()]; | 558 performAction:grey_tap()]; |
| 559 | 559 |
| 560 TapButtonWithLabelId(IDS_IOS_BOOKMARK_PROMO_SIGN_IN_BUTTON); | 560 TapButtonWithLabelId(IDS_IOS_BOOKMARK_PROMO_SIGN_IN_BUTTON); |
| 561 | 561 |
| 562 // Assert sign-in screen was shown. | 562 // Assert sign-in screen was shown. |
| 563 id<GREYMatcher> signin_matcher = | 563 id<GREYMatcher> signin_matcher = |
| 564 chrome_test_util::staticTextWithAccessibilityLabelId( | 564 chrome_test_util::StaticTextWithAccessibilityLabelId( |
| 565 IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_DESCRIPTION); | 565 IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_DESCRIPTION); |
| 566 [[EarlGrey selectElementWithMatcher:signin_matcher] | 566 [[EarlGrey selectElementWithMatcher:signin_matcher] |
| 567 assertWithMatcher:grey_sufficientlyVisible()]; | 567 assertWithMatcher:grey_sufficientlyVisible()]; |
| 568 | 568 |
| 569 // Open new tab to cancel sign-in. | 569 // Open new tab to cancel sign-in. |
| 570 base::scoped_nsobject<OpenUrlCommand> command( | 570 base::scoped_nsobject<OpenUrlCommand> command( |
| 571 [[OpenUrlCommand alloc] initWithURLFromChrome:GURL("about:blank")]); | 571 [[OpenUrlCommand alloc] initWithURLFromChrome:GURL("about:blank")]); |
| 572 chrome_test_util::RunCommandWithActiveViewController(command); | 572 chrome_test_util::RunCommandWithActiveViewController(command); |
| 573 | 573 |
| 574 // Re-open the sign-in screen. If it wasn't correctly dismissed previously, | 574 // Re-open the sign-in screen. If it wasn't correctly dismissed previously, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 591 assertWithMatcher:grey_sufficientlyVisible()]; | 591 assertWithMatcher:grey_sufficientlyVisible()]; |
| 592 | 592 |
| 593 // Close sign-in screen and Bookmarks. | 593 // Close sign-in screen and Bookmarks. |
| 594 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON); | 594 TapButtonWithLabelId(IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON); |
| 595 if (!IsIPadIdiom()) { | 595 if (!IsIPadIdiom()) { |
| 596 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); | 596 TapButtonWithLabelId(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON); |
| 597 } | 597 } |
| 598 } | 598 } |
| 599 | 599 |
| 600 @end | 600 @end |
| OLD | NEW |