Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: ios/chrome/browser/ui/settings/passwords_settings_egtest.mm

Issue 2860453004: Fix PasswordsSettingsTestCase.testCopyPasswordToast (Closed)
Patch Set: Always close the snackbars Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #include "base/callback.h" 5 #include "base/callback.h"
6 #include "base/mac/foundation_util.h" 6 #include "base/mac/foundation_util.h"
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "components/autofill/core/common/password_form.h" 10 #include "components/autofill/core/common/password_form.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 chrome_test_util::VerifyAccessibilityForCurrentScreen(); 332 chrome_test_util::VerifyAccessibilityForCurrentScreen();
333 [self tapBackArrow]; 333 [self tapBackArrow];
334 334
335 [self tapBackArrow]; 335 [self tapBackArrow];
336 [self tapDone]; 336 [self tapDone];
337 [self clearPasswordStore]; 337 [self clearPasswordStore];
338 } 338 }
339 339
340 // Checks that attempts to copy a password provide appropriate feedback, 340 // Checks that attempts to copy a password provide appropriate feedback,
341 // both when reauthentication succeeds and when it fails. 341 // both when reauthentication succeeds and when it fails.
342 // TODO(crbug.com/718043): Re-enable test. 342 - (void)testCopyPasswordToast {
343 - (void)DISABLED_testCopyPasswordToast {
344 [self scopedEnablePasswordManagementAndViewingUI]; 343 [self scopedEnablePasswordManagementAndViewingUI];
345 344
346 // Saving a form is needed for using the "password details" view. 345 // Saving a form is needed for using the "password details" view.
347 [self saveExamplePasswordForm]; 346 [self saveExamplePasswordForm];
348 347
349 [self openPasswordSettings]; 348 [self openPasswordSettings];
350 349
351 [[EarlGrey selectElementWithMatcher:Entry(@"https://example.com, user")] 350 [[EarlGrey selectElementWithMatcher:Entry(@"https://example.com, user")]
352 performAction:grey_tap()]; 351 performAction:grey_tap()];
353 352
(...skipping 12 matching lines...) Expand all
366 [password_details_collection_view_controller 365 [password_details_collection_view_controller
367 setReauthenticationModule:mock_reauthentication_module]; 366 setReauthenticationModule:mock_reauthentication_module];
368 367
369 // Check the snackbar in case of successful reauthentication. 368 // Check the snackbar in case of successful reauthentication.
370 mock_reauthentication_module.shouldSucceed = YES; 369 mock_reauthentication_module.shouldSucceed = YES;
371 [[EarlGrey selectElementWithMatcher:CopyPasswordButton()] 370 [[EarlGrey selectElementWithMatcher:CopyPasswordButton()]
372 performAction:grey_tap()]; 371 performAction:grey_tap()];
373 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; 372 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
374 NSString* snackbarLabel = 373 NSString* snackbarLabel =
375 l10n_util::GetNSString(IDS_IOS_SETTINGS_PASSWORD_WAS_COPIED_MESSAGE); 374 l10n_util::GetNSString(IDS_IOS_SETTINGS_PASSWORD_WAS_COPIED_MESSAGE);
375 // Tap the snackbar instead of just asserting that it is there, and wait
376 // until the tap causes it to close. Otherwise it will block the copy button
377 // for the rest of the test on small devices, and scrolling to reach the
378 // button won't work when the snackbar is up.
lpromero 2017/05/04 09:21:08 Is this an action item we could solve? Scrolling o
vabr (Chromium) 2017/05/04 11:00:04 When I tried manually with Chrome, I was able to s
lpromero 2017/05/04 11:24:54 To be clear, I am fine as is, I was just wondering
376 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(snackbarLabel)] 379 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(snackbarLabel)]
377 assertWithMatcher:grey_notNil()]; 380 performAction:grey_tap()];
381 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
378 382
379 // Check the snackbar in case of failed reauthentication. 383 // Check the snackbar in case of failed reauthentication.
380 mock_reauthentication_module.shouldSucceed = NO; 384 mock_reauthentication_module.shouldSucceed = NO;
381 [[EarlGrey selectElementWithMatcher:CopyPasswordButton()] 385 [[EarlGrey selectElementWithMatcher:CopyPasswordButton()]
382 performAction:grey_tap()]; 386 performAction:grey_tap()];
383 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; 387 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
384 snackbarLabel = 388 snackbarLabel =
385 l10n_util::GetNSString(IDS_IOS_SETTINGS_PASSWORD_WAS_NOT_COPIED_MESSAGE); 389 l10n_util::GetNSString(IDS_IOS_SETTINGS_PASSWORD_WAS_NOT_COPIED_MESSAGE);
390 // The tap checks the existence of the snackbar and also closes it.
386 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(snackbarLabel)] 391 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(snackbarLabel)]
387 assertWithMatcher:grey_notNil()]; 392 performAction:grey_tap()];
393 // Wait until the fade-out animation completes.
394 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
388 395
389 [self tapBackArrow]; 396 [self tapBackArrow];
390 [self tapBackArrow]; 397 [self tapBackArrow];
391 [self tapDone]; 398 [self tapDone];
392 [self clearPasswordStore]; 399 [self clearPasswordStore];
393 } 400 }
394 401
395 // Checks that attempts to copy a username provide appropriate feedback. 402 // Checks that attempts to copy a username provide appropriate feedback.
396 - (void)testCopyUsernameToast { 403 - (void)testCopyUsernameToast {
397 [self scopedEnablePasswordManagementAndViewingUI]; 404 [self scopedEnablePasswordManagementAndViewingUI];
398 405
399 // Saving a form is needed for using the "password details" view. 406 // Saving a form is needed for using the "password details" view.
400 [self saveExamplePasswordForm]; 407 [self saveExamplePasswordForm];
401 408
402 [self openPasswordSettings]; 409 [self openPasswordSettings];
403 410
404 [[EarlGrey selectElementWithMatcher:Entry(@"https://example.com, user")] 411 [[EarlGrey selectElementWithMatcher:Entry(@"https://example.com, user")]
405 performAction:grey_tap()]; 412 performAction:grey_tap()];
406 413
407 // Check the snackbar. 414 // Check the snackbar.
408 [[EarlGrey selectElementWithMatcher:CopyUsernameButton()] 415 [[EarlGrey selectElementWithMatcher:CopyUsernameButton()]
409 performAction:grey_tap()]; 416 performAction:grey_tap()];
410 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; 417 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
411 NSString* snackbarLabel = 418 NSString* snackbarLabel =
412 l10n_util::GetNSString(IDS_IOS_SETTINGS_USERNAME_WAS_COPIED_MESSAGE); 419 l10n_util::GetNSString(IDS_IOS_SETTINGS_USERNAME_WAS_COPIED_MESSAGE);
420 // The tap checks the existence of the snackbar and also closes it.
413 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(snackbarLabel)] 421 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(snackbarLabel)]
414 assertWithMatcher:grey_notNil()]; 422 performAction:grey_tap()];
423 // Wait until the fade-out animation completes.
424 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
415 425
416 [self tapBackArrow]; 426 [self tapBackArrow];
417 [self tapBackArrow]; 427 [self tapBackArrow];
418 [self tapDone]; 428 [self tapDone];
419 [self clearPasswordStore]; 429 [self clearPasswordStore];
420 } 430 }
421 431
422 // Checks that attempts to copy a site URL provide appropriate feedback. 432 // Checks that attempts to copy a site URL provide appropriate feedback.
423 - (void)testCopySiteToast { 433 - (void)testCopySiteToast {
424 [self scopedEnablePasswordManagementAndViewingUI]; 434 [self scopedEnablePasswordManagementAndViewingUI];
425 435
426 // Saving a form is needed for using the "password details" view. 436 // Saving a form is needed for using the "password details" view.
427 [self saveExamplePasswordForm]; 437 [self saveExamplePasswordForm];
428 438
429 [self openPasswordSettings]; 439 [self openPasswordSettings];
430 440
431 [[EarlGrey selectElementWithMatcher:Entry(@"https://example.com, user")] 441 [[EarlGrey selectElementWithMatcher:Entry(@"https://example.com, user")]
432 performAction:grey_tap()]; 442 performAction:grey_tap()];
433 443
434 // Check the snackbar. 444 // Check the snackbar.
435 [[EarlGrey selectElementWithMatcher:CopySiteButton()] 445 [[EarlGrey selectElementWithMatcher:CopySiteButton()]
436 performAction:grey_tap()]; 446 performAction:grey_tap()];
437 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; 447 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
438 NSString* snackbarLabel = 448 NSString* snackbarLabel =
439 l10n_util::GetNSString(IDS_IOS_SETTINGS_SITE_WAS_COPIED_MESSAGE); 449 l10n_util::GetNSString(IDS_IOS_SETTINGS_SITE_WAS_COPIED_MESSAGE);
450 // The tap checks the existence of the snackbar and also closes it.
440 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(snackbarLabel)] 451 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(snackbarLabel)]
441 assertWithMatcher:grey_notNil()]; 452 performAction:grey_tap()];
453 // Wait until the fade-out animation completes.
454 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
442 455
443 [self tapBackArrow]; 456 [self tapBackArrow];
444 [self tapBackArrow]; 457 [self tapBackArrow];
445 [self tapDone]; 458 [self tapDone];
446 [self clearPasswordStore]; 459 [self clearPasswordStore];
447 } 460 }
448 461
449 @end 462 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698