Commit dce02bb5 authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

[ios] Add fakebox focus helper to content suggestions egtest.

Bug: 866281
Change-Id: Idedb310b57b39c532b31b8755eb61886742639c6
Reviewed-on: https://chromium-review.googlesource.com/c/1334857
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608093}
parent 50a3d2c9
...@@ -361,11 +361,7 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse( ...@@ -361,11 +361,7 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
CGPoint previousPosition = omnibox.bounds.origin; CGPoint previousPosition = omnibox.bounds.origin;
// Tap the omnibox to focus it. // Tap the omnibox to focus it.
[[EarlGrey selectElementWithMatcher:grey_accessibilityID( [self focusFakebox];
FakeOmniboxAccessibilityID())]
performAction:grey_tap()];
[ChromeEarlGrey
waitForElementWithMatcherSufficientlyVisible:chrome_test_util::Omnibox()];
// Navigate and come back. // Navigate and come back.
[[EarlGrey selectElementWithMatcher: [[EarlGrey selectElementWithMatcher:
...@@ -396,11 +392,8 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse( ...@@ -396,11 +392,8 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
NSString* URL = base::SysUTF8ToNSString(pageURL.spec()); NSString* URL = base::SysUTF8ToNSString(pageURL.spec());
// Tap the fake omnibox, type the URL in the real omnibox and navigate to the // Tap the fake omnibox, type the URL in the real omnibox and navigate to the
// page. // page.
[[EarlGrey selectElementWithMatcher:grey_accessibilityID( [self focusFakebox];
FakeOmniboxAccessibilityID())]
performAction:grey_tap()];
[ChromeEarlGrey
waitForElementWithMatcherSufficientlyVisible:chrome_test_util::Omnibox()];
[[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()] [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()]
performAction:grey_typeText([URL stringByAppendingString:@"\n"])]; performAction:grey_typeText([URL stringByAppendingString:@"\n"])];
...@@ -458,11 +451,7 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse( ...@@ -458,11 +451,7 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
CGPoint origin = collectionView.contentOffset; CGPoint origin = collectionView.contentOffset;
// Tap the omnibox to focus it. // Tap the omnibox to focus it.
[[EarlGrey selectElementWithMatcher:grey_accessibilityID( [self focusFakebox];
FakeOmniboxAccessibilityID())]
performAction:grey_tap()];
[ChromeEarlGrey
waitForElementWithMatcherSufficientlyVisible:chrome_test_util::Omnibox()];
// Offset after the fake omnibox has been tapped. // Offset after the fake omnibox has been tapped.
CGPoint offsetAfterTap = collectionView.contentOffset; CGPoint offsetAfterTap = collectionView.contentOffset;
...@@ -509,11 +498,7 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse( ...@@ -509,11 +498,7 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
CGPoint origin = collectionView.contentOffset; CGPoint origin = collectionView.contentOffset;
// Tap the omnibox to focus it. // Tap the omnibox to focus it.
[[EarlGrey selectElementWithMatcher:grey_accessibilityID( [self focusFakebox];
FakeOmniboxAccessibilityID())]
performAction:grey_tap()];
[ChromeEarlGrey
waitForElementWithMatcherSufficientlyVisible:chrome_test_util::Omnibox()];
// Unfocus the omnibox. // Unfocus the omnibox.
[[EarlGrey selectElementWithMatcher:chrome_test_util:: [[EarlGrey selectElementWithMatcher:chrome_test_util::
...@@ -572,4 +557,13 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse( ...@@ -572,4 +557,13 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
[ChromeEarlGrey openNewTab]; [ChromeEarlGrey openNewTab];
} }
// Taps the fake omnibox and waits for the real omnibox to be visible.
- (void)focusFakebox {
[[EarlGrey selectElementWithMatcher:grey_accessibilityID(
FakeOmniboxAccessibilityID())]
performAction:grey_tap()];
[ChromeEarlGrey
waitForElementWithMatcherSufficientlyVisible:chrome_test_util::Omnibox()];
}
@end @end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment