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

Side by Side Diff: ios/chrome/browser/ui/dialogs/javascript_dialog_egtest.mm

Issue 2733973002: Create shared matcher for navigation bar done button. (Closed)
Patch Set: remove sufficientlyVisible from shared matcher Created 3 years, 9 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
OLDNEW
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 <UIKit/UIKit.h> 6 #import <UIKit/UIKit.h>
7 #import <XCTest/XCTest.h> 7 #import <XCTest/XCTest.h>
8 8
9 #import "base/strings/sys_string_conversions.h" 9 #import "base/strings/sys_string_conversions.h"
10 #include "components/strings/grit/components_strings.h" 10 #include "components/strings/grit/components_strings.h"
(...skipping 12 matching lines...) Expand all
23 #import "ios/web/public/test/http_server_util.h" 23 #import "ios/web/public/test/http_server_util.h"
24 #include "ios/web/public/web_state/web_state.h" 24 #include "ios/web/public/web_state/web_state.h"
25 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
26 #include "ui/base/l10n/l10n_util_mac.h" 26 #include "ui/base/l10n/l10n_util_mac.h"
27 #import "url/gurl.h" 27 #import "url/gurl.h"
28 28
29 #if !defined(__has_feature) || !__has_feature(objc_arc) 29 #if !defined(__has_feature) || !__has_feature(objc_arc)
30 #error "This file requires ARC support." 30 #error "This file requires ARC support."
31 #endif 31 #endif
32 32
33 using chrome_test_util::NavigationBarDoneButton;
34
33 namespace { 35 namespace {
34 36
35 // Enum specifying different types of JavaScript alerts: 37 // Enum specifying different types of JavaScript alerts:
36 // - JavaScriptAlertType::ALERT - Dialog with only one OK button. 38 // - JavaScriptAlertType::ALERT - Dialog with only one OK button.
37 // - JavaScriptAlertType::CONFIRMATION - Dialog with OK and Cancel button. 39 // - JavaScriptAlertType::CONFIRMATION - Dialog with OK and Cancel button.
38 // - JavaScriptAlertType::PROMPT - Dialog with OK button, cancel button, and 40 // - JavaScriptAlertType::PROMPT - Dialog with OK button, cancel button, and
39 // a text field. 41 // a text field.
40 enum class JavaScriptAlertType : NSUInteger { ALERT, CONFIRMATION, PROMPT }; 42 enum class JavaScriptAlertType : NSUInteger { ALERT, CONFIRMATION, PROMPT };
41 43
42 // Script to inject that will show an alert. The document's body will be reset 44 // Script to inject that will show an alert. The document's body will be reset
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 IDS_IOS_SETTINGS_TITLE)] 453 IDS_IOS_SETTINGS_TITLE)]
452 assertWithMatcher:grey_sufficientlyVisible()]; 454 assertWithMatcher:grey_sufficientlyVisible()];
453 455
454 // Show an alert. 456 // Show an alert.
455 DisplayJavaScriptAlert(JavaScriptAlertType::ALERT); 457 DisplayJavaScriptAlert(JavaScriptAlertType::ALERT);
456 458
457 // Make sure the alert is not present. 459 // Make sure the alert is not present.
458 AssertJavaScriptAlertNotPresent(); 460 AssertJavaScriptAlertNotPresent();
459 461
460 // Close the settings. 462 // Close the settings.
461 [[EarlGrey 463 [[EarlGrey selectElementWithMatcher:NavigationBarDoneButton()]
462 selectElementWithMatcher:chrome_test_util::ButtonWithAccessibilityLabelId(
463 IDS_IOS_NAVIGATION_BAR_DONE_BUTTON)]
464 performAction:grey_tap()]; 464 performAction:grey_tap()];
465 465
466 // Make sure the alert is present. 466 // Make sure the alert is present.
467 WaitForJavaScripDialogToBeShown(); 467 WaitForJavaScripDialogToBeShown();
468 468
469 // Tap the OK button. 469 // Tap the OK button.
470 TapOK(); 470 TapOK();
471 471
472 // Wait for the html body to be reset to the correct value. 472 // Wait for the html body to be reset to the correct value.
473 WaitForWebDisplay(kAlertResultBody); 473 WaitForWebDisplay(kAlertResultBody);
(...skipping 20 matching lines...) Expand all
494 ShowJavaScriptDialog(JavaScriptAlertType::ALERT); 494 ShowJavaScriptDialog(JavaScriptAlertType::ALERT);
495 495
496 // Tap the OK button. 496 // Tap the OK button.
497 TapOK(); 497 TapOK();
498 498
499 // Wait for the html body to be reset to the correct value. 499 // Wait for the html body to be reset to the correct value.
500 WaitForWebDisplay(kAlertResultBody); 500 WaitForWebDisplay(kAlertResultBody);
501 } 501 }
502 502
503 @end 503 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/metrics/tab_usage_recorder_egtest.mm ('k') | ios/chrome/browser/ui/history/history_ui_egtest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698