| 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/ios/ios_util.h" | 8 #include "base/ios/ios_util.h" |
| 9 #include "components/strings/grit/components_strings.h" | 9 #include "components/strings/grit/components_strings.h" |
| 10 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" | 10 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 | 346 |
| 347 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Go")] | 347 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Go")] |
| 348 performAction:grey_tap()]; | 348 performAction:grey_tap()]; |
| 349 | 349 |
| 350 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Hello")] | 350 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Hello")] |
| 351 assertWithMatcher:grey_notNil()]; | 351 assertWithMatcher:grey_notNil()]; |
| 352 } | 352 } |
| 353 | 353 |
| 354 // Tests typing in the omnibox. | 354 // Tests typing in the omnibox. |
| 355 - (void)testToolbarOmniboxTyping { | 355 - (void)testToolbarOmniboxTyping { |
| 356 // TODO(crbug.com/642559): Enable this test for iPad when typing bug is fixed. |
| 357 if (IsIPadIdiom()) { |
| 358 EARL_GREY_TEST_DISABLED(@"Disabled for iPad due to a simulator bug."); |
| 359 } |
| 356 SelectNewTabPagePanel(NewTabPage::kMostVisitedPanel); | 360 SelectNewTabPagePanel(NewTabPage::kMostVisitedPanel); |
| 357 | 361 |
| 358 id<GREYMatcher> locationbarButton = grey_allOf( | 362 id<GREYMatcher> locationbarButton = grey_allOf( |
| 359 grey_accessibilityLabel(l10n_util::GetNSString(IDS_OMNIBOX_EMPTY_HINT)), | 363 grey_accessibilityLabel(l10n_util::GetNSString(IDS_OMNIBOX_EMPTY_HINT)), |
| 360 grey_minimumVisiblePercent(0.2), nil); | 364 grey_minimumVisiblePercent(0.2), nil); |
| 361 [[EarlGrey selectElementWithMatcher:locationbarButton] | 365 [[EarlGrey selectElementWithMatcher:locationbarButton] |
| 362 assertWithMatcher:grey_text(@"Search or type URL")]; | 366 assertWithMatcher:grey_text(@"Search or type URL")]; |
| 363 | 367 |
| 364 [[EarlGrey selectElementWithMatcher:locationbarButton] | 368 [[EarlGrey selectElementWithMatcher:locationbarButton] |
| 365 performAction:grey_typeText(@"a")]; | 369 performAction:grey_typeText(@"a")]; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 | 430 |
| 427 [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()] | 431 [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()] |
| 428 performAction:grey_typeText(@"#")]; | 432 performAction:grey_typeText(@"#")]; |
| 429 [[EarlGrey | 433 [[EarlGrey |
| 430 selectElementWithMatcher:grey_allOf(grey_accessibilityLabel(@"abC12@{#"), | 434 selectElementWithMatcher:grey_allOf(grey_accessibilityLabel(@"abC12@{#"), |
| 431 grey_kindOfClass( | 435 grey_kindOfClass( |
| 432 [OmniboxPopupMaterialRow class]), | 436 [OmniboxPopupMaterialRow class]), |
| 433 nil)] | 437 nil)] |
| 434 assertWithMatcher:grey_sufficientlyVisible()]; | 438 assertWithMatcher:grey_sufficientlyVisible()]; |
| 435 | 439 |
| 436 // TODO(crbug.com/642559): Enable these steps for iPad when typing bug | 440 NSString* cancelButtonText = l10n_util::GetNSString(IDS_CANCEL); |
| 437 // is fixed. | 441 NSString* typingShield = @"Hide keyboard"; |
| 438 if (IsIPadIdiom()) { | 442 NSString* clearText = IsIPadIdiom() ? typingShield : cancelButtonText; |
| 439 EARL_GREY_TEST_DISABLED(@"Disabled for iPad due to a simulator bug."); | |
| 440 } else { | |
| 441 NSString* cancelButton = l10n_util::GetNSString(IDS_CANCEL); | |
| 442 NSString* typingShield = @"Hide keyboard"; | |
| 443 NSString* clearText = IsIPadIdiom() ? typingShield : cancelButton; | |
| 444 | 443 |
| 445 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(clearText)] | 444 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(clearText)] |
| 446 performAction:grey_tap()]; | 445 performAction:grey_tap()]; |
| 447 [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()] | 446 [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()] |
| 448 assertWithMatcher:chrome_test_util::OmniboxText("")]; | 447 assertWithMatcher:chrome_test_util::OmniboxText("")]; |
| 449 | 448 |
| 450 SelectNewTabPagePanel(NewTabPage::kMostVisitedPanel); | 449 SelectNewTabPagePanel(NewTabPage::kMostVisitedPanel); |
| 451 } | |
| 452 } | 450 } |
| 453 @end | 451 @end |
| OLD | NEW |