Commit 7a180635 authored by Mike Dougherty's avatar Mike Dougherty Committed by Commit Bot

Re-enable FindInPage EG tests

Update the scroll amount to bring the Find In Page menu item more into
view. Although it was previously visible, it was at the very bottom
edge of the pop over menu which seems to have been a source of flaky
failure even when running locally.

grey_replaceText  sometimes causes a crash locally, so replace with
typeText as there is no need to clear the text first in any of these
tests. Additionally, there is no longer two accessibility elements with
the same ID, and on iOS 12 the item with the accessibilityID is not an
accessibilityElement. Simplify typeFindInPageText

Fixed: 1029709 , 1030701
Change-Id: I7fca1bc87160b5404c40e592143e6841fee848cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2303453
Commit-Queue: Mike Dougherty <michaeldo@chromium.org>
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: default avatarStepan Khapugin <stkhapugin@chromium.org>
Auto-Submit: Mike Dougherty <michaeldo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#789985}
parent 0c2a4274
...@@ -103,15 +103,7 @@ const std::string kFindInPageResponse = "Find in page. Find in page."; ...@@ -103,15 +103,7 @@ const std::string kFindInPageResponse = "Find in page. Find in page.";
// Tests that find in page allows iteration between search results and displays // Tests that find in page allows iteration between search results and displays
// correct number of results. // correct number of results.
// TODO(crbug.com/1030701): Test fails on iOS 13 when rolling EG2 version. - (void)testFindInPage {
- (void)DISABLED_testFindInPage {
// TODO(crbug.com/1030701): Test fails on iOS 12 when run as EG2 test.
#if defined(CHROME_EARL_GREY_2)
if (!base::ios::IsRunningOnOrLater(13, 0, 0)) {
EARL_GREY_TEST_DISABLED(@"Fails on iOS 12.0.");
}
#endif
// Type "find". // Type "find".
[self typeFindInPageText:@"find"]; [self typeFindInPageText:@"find"];
// Should be highlighting result 1 of 2. // Should be highlighting result 1 of 2.
...@@ -128,8 +120,7 @@ const std::string kFindInPageResponse = "Find in page. Find in page."; ...@@ -128,8 +120,7 @@ const std::string kFindInPageResponse = "Find in page. Find in page.";
// Tests that Find In Page search term retention is working as expected, e.g. // Tests that Find In Page search term retention is working as expected, e.g.
// the search term is persisted between FIP runs, but in incognito search term // the search term is persisted between FIP runs, but in incognito search term
// is not retained and not autofilled. // is not retained and not autofilled.
// TODO(crbug.com/1029709): Test failed. - (void)testFindInPageRetainsSearchTerm {
- (void)DISABLED_testFindInPageRetainsSearchTerm {
// Type "find". // Type "find".
[self typeFindInPageText:@"find"]; [self typeFindInPageText:@"find"];
[self assertResultStringIsResult:1 outOfTotal:2]; [self assertResultStringIsResult:1 outOfTotal:2];
...@@ -169,20 +160,10 @@ const std::string kFindInPageResponse = "Find in page. Find in page."; ...@@ -169,20 +160,10 @@ const std::string kFindInPageResponse = "Find in page. Find in page.";
} }
// Tests accessibility of the Find in Page screen. // Tests accessibility of the Find in Page screen.
// TODO(crbug.com/1030701): Test fails on iOS 13 when rolling EG2 version. - (void)testAccessibilityOnFindInPage {
- (void)DISABLED_testAccessibilityOnFindInPage {
// TODO(crbug.com/1030701): Test fails on iOS 12 when run as EG2 test.
#if defined(CHROME_EARL_GREY_2)
if (!base::ios::IsRunningOnOrLater(13, 0, 0)) {
EARL_GREY_TEST_DISABLED(@"Fails on iOS 12.0.");
}
#endif
[self typeFindInPageText:@"find"]; [self typeFindInPageText:@"find"];
[self assertResultStringIsResult:1 outOfTotal:2];
// Wait for UI to finish loading screen, before programatically verifying
// accessibility.
[ChromeEarlGreyUI waitForAppToIdle];
[ChromeEarlGrey verifyAccessibilityForCurrentScreen]; [ChromeEarlGrey verifyAccessibilityForCurrentScreen];
} }
...@@ -194,7 +175,7 @@ const std::string kFindInPageResponse = "Find in page. Find in page."; ...@@ -194,7 +175,7 @@ const std::string kFindInPageResponse = "Find in page. Find in page.";
selectElementWithMatcher:grey_allOf( selectElementWithMatcher:grey_allOf(
grey_accessibilityID(kToolsMenuFindInPageId), grey_accessibilityID(kToolsMenuFindInPageId),
grey_sufficientlyVisible(), nil)] grey_sufficientlyVisible(), nil)]
usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, 200) usingSearchAction:grey_scrollInDirection(kGREYDirectionDown, 250)
onElementWithMatcher:grey_accessibilityID(kPopupMenuToolsMenuTableViewId)] onElementWithMatcher:grey_accessibilityID(kPopupMenuToolsMenuTableViewId)]
performAction:grey_tap()]; performAction:grey_tap()];
} }
...@@ -206,21 +187,8 @@ const std::string kFindInPageResponse = "Find in page. Find in page."; ...@@ -206,21 +187,8 @@ const std::string kFindInPageResponse = "Find in page. Find in page.";
} }
- (void)typeFindInPageText:(NSString*)text { - (void)typeFindInPageText:(NSString*)text {
#if defined(CHROME_EARL_GREY_1)
[[EarlGrey selectElementWithMatcher:[self findInPageInputField]] [[EarlGrey selectElementWithMatcher:[self findInPageInputField]]
performAction:grey_replaceText(text)]; performAction:grey_typeText(text)];
#elif defined(CHROME_EARL_GREY_2)
// There are two elements in the DOM (UITextField and
// UIAccessibilityTextFieldElement) that match the acessibilityID of
// kFindInPageInputFieldId. Choose the accessibility element.
[[EarlGrey
selectElementWithMatcher:grey_allOf(grey_accessibilityID(
kFindInPageInputFieldId),
grey_accessibilityElement(), nil)]
performAction:grey_replaceText(text)];
#else
#error Must define either CHROME_EARL_GREY_1 or CHROME_EARL_GREY_2.
#endif
} }
- (id<GREYMatcher>)findInPageInputField { - (id<GREYMatcher>)findInPageInputField {
......
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