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

Revert "[iOS] Use a simpler grey matcher for web view"

This reverts commit ed3fbbd4.

Reason for revert: Still seeing red on both 13.4 and 13.6:
https://ci.chromium.org/p/chromium/builders/ci/ios-simulator-full-configs/25898
https://ci.chromium.org/p/chromium/builders/ci/ios14-sdk-simulator/2399

Original change's description:
> [iOS] Use a simpler grey matcher for web view
> 
> For some reason chrome_test_util::WebViewMatcher is flaky in these ones.
> Could be related to the keyboard being in screen.
> 
> The flakiness appears to be related to iOS 13.4. Maybe a recent update
> to the bots or a version upgrade of earl grey.
> 
> Using a simpler matcher seems to fix the issue.
> 
> Fixed: 1116043, 1116734, 1114899, 1111076, 1115321, 1111258, 1115282
> Change-Id: I9172417a20d5b8e09dc47cd986256fc0a8cb46ba
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2362892
> Reviewed-by: David Jean <djean@chromium.org>
> Commit-Queue: Javier Ernesto Flores Robles <javierrobles@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#799544}

TBR=javierrobles@chromium.org,djean@chromium.org

Change-Id: If5fe6e3906ed0b0b3a4d5ccce251e34b5829d26d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2364226Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799774}
parent 19caef57
......@@ -44,14 +44,9 @@ BOOL WaitForKeyboardToAppear() {
return [waitForKeyboard waitWithTimeout:kWaitForActionTimeout];
}
// Returns a matcher for a web view.
id<GREYMatcher> WebViewMatcher() {
return grey_kindOfClass(NSClassFromString(@"WKWebView"));
}
} // namespace
// Integration Tests for Manual Fallback Addresses View Controller.
// Integration Tests for Mannual Fallback Addresses View Controller.
@interface AddressViewControllerTestCase : ChromeTestCase
@end
......@@ -74,9 +69,17 @@ id<GREYMatcher> WebViewMatcher() {
}
// Tests that the addresses view controller appears on screen.
- (void)testAddressesViewControllerIsPresented {
// TODO(crbug.com/1116274): Flaky on ios simulator.
#if TARGET_IPHONE_SIMULATOR
#define MAYBE_testAddressesViewControllerIsPresented \
DISABLED_testAddressesViewControllerIsPresented
#else
#define MAYBE_testAddressesViewControllerIsPresented \
testAddressesViewControllerIsPresented
#endif
- (void)MAYBE_testAddressesViewControllerIsPresented {
// Bring up the keyboard.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementName)];
// Tap on the addresses icon.
......@@ -92,9 +95,17 @@ id<GREYMatcher> WebViewMatcher() {
// Tests that the addresses view controller contains the "Manage Addresses..."
// action.
- (void)testAddressesViewControllerContainsManageAddressesAction {
// TODO(crbug.com/1116043): Flaky on ios simulator.
#if TARGET_IPHONE_SIMULATOR
#define MAYBE_testAddressesViewControllerContainsManageAddressesAction \
DISABLED_testAddressesViewControllerContainsManageAddressesAction
#else
#define MAYBE_testAddressesViewControllerContainsManageAddressesAction \
testAddressesViewControllerContainsManageAddressesAction
#endif
- (void)MAYBE_testAddressesViewControllerContainsManageAddressesAction {
// Bring up the keyboard.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementName)];
// Tap on the addresses icon.
......@@ -113,7 +124,7 @@ id<GREYMatcher> WebViewMatcher() {
// Tests that the "Manage Addresses..." action works.
- (void)testManageAddressesActionOpensAddressSettings {
// Bring up the keyboard.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementName)];
// Tap on the addresses icon.
......@@ -135,9 +146,17 @@ id<GREYMatcher> WebViewMatcher() {
// Tests that returning from "Manage Addresses..." leaves the icons and keyboard
// in the right state.
- (void)testAddressesStateAfterPresentingManageAddresses {
// TODO(crbug.com/1111076): Flaky on iOS simulator.
#if TARGET_IPHONE_SIMULATOR
#define MAYBE_testAddressesStateAfterPresentingManageAddresses \
DISABLED_testAddressesStateAfterPresentingManageAddresses
#else
#define MAYBE_testAddressesStateAfterPresentingManageAddresses \
testAddressesStateAfterPresentingManageAddresses
#endif
- (void)MAYBE_testAddressesStateAfterPresentingManageAddresses {
// Bring up the keyboard.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementName)];
// Tap on the addresses icon.
......@@ -192,7 +211,7 @@ id<GREYMatcher> WebViewMatcher() {
;
}
// Bring up the keyboard.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementName)];
// Tap on the addresses icon.
......@@ -219,12 +238,20 @@ id<GREYMatcher> WebViewMatcher() {
// Tests that the Address View Controller is dismissed when tapping the outside
// the popover on iPad.
- (void)testIPadTappingOutsidePopOverDismissAddressController {
// TODO(crbug.com/1116887) Flaky on iOS simulator
#if TARGET_IPHONE_SIMULATOR
#define MAYBE_testIPadTappingOutsidePopOverDismissAddressController \
DISABLED_testIPadTappingOutsidePopOverDismissAddressController
#else
#define MAYBE_testIPadTappingOutsidePopOverDismissAddressController \
testIPadTappingOutsidePopOverDismissAddressController
#endif
- (void)MAYBE_testIPadTappingOutsidePopOverDismissAddressController {
if (![ChromeEarlGrey isIPadIdiom]) {
EARL_GREY_TEST_SKIPPED(@"Test is not applicable for iPhone");
}
// Bring up the keyboard.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementName)];
// Tap on the addresses icon.
......@@ -253,12 +280,20 @@ id<GREYMatcher> WebViewMatcher() {
}
// Tests that the address icon is hidden when no addresses are available.
- (void)testAddressIconIsNotVisibleWhenAddressStoreEmpty {
// TODO(crbug.com/1116043): Flaky on ios simulator.
#if TARGET_IPHONE_SIMULATOR
#define MAYBE_testAddressIconIsNotVisibleWhenAddressStoreEmpty \
DISABLED_testAddressIconIsNotVisibleWhenAddressStoreEmpty
#else
#define MAYBE_testAddressIconIsNotVisibleWhenAddressStoreEmpty \
testAddressIconIsNotVisibleWhenAddressStoreEmpty
#endif
- (void)MAYBE_testAddressIconIsNotVisibleWhenAddressStoreEmpty {
// Delete the profile that is added on |-setUp|.
[AutofillAppInterface clearProfilesStore];
// Bring up the keyboard.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementName)];
// Wait for the keyboard to appear.
......@@ -272,7 +307,7 @@ id<GREYMatcher> WebViewMatcher() {
[AutofillAppInterface saveExampleProfile];
// Tap another field to trigger form activity.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementCity)];
// Assert the address icon is visible now.
......
......@@ -48,11 +48,6 @@ id<GREYMatcher> ProfileTableViewButtonMatcher() {
return grey_buttonTitle(@"Underworld");
}
// Returns a matcher for a web view.
id<GREYMatcher> WebViewMatcher() {
return grey_kindOfClass(NSClassFromString(@"WKWebView"));
}
// Polls the JavaScript query |java_script_condition| until the returned
// |boolValue| is YES with a kWaitForActionTimeout timeout.
BOOL WaitForJavaScriptCondition(NSString* java_script_condition) {
......@@ -168,7 +163,7 @@ BOOL WaitForKeyboardToAppear() {
// will dismiss any.
if ([ChromeEarlGrey isIPadIdiom]) {
// Tap in the web view so the popover dismisses.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:grey_tapAtPoint(CGPointMake(0, 0))];
// Verify the table view is not visible.
......@@ -192,7 +187,7 @@ BOOL WaitForKeyboardToAppear() {
[AutofillAppInterface saveExampleProfile];
// Bring up the keyboard.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementName)];
// Tap on the profiles icon.
......@@ -235,7 +230,7 @@ BOOL WaitForKeyboardToAppear() {
[AutofillAppInterface saveExampleProfile];
// Bring up the keyboard.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementCity)];
// Tap on the profiles icon.
......@@ -281,7 +276,7 @@ BOOL WaitForKeyboardToAppear() {
// Bring up the keyboard by tapping the city, which is the element before the
// picker.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementCity)];
// Tap on the profiles icon.
......@@ -306,7 +301,7 @@ BOOL WaitForKeyboardToAppear() {
// first.
if ([ChromeEarlGrey isIPadIdiom]) {
// Tap in the web view so the popover dismisses.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:grey_tapAtPoint(CGPointMake(0, 0))];
// Verify the table view is not visible.
......@@ -318,7 +313,7 @@ BOOL WaitForKeyboardToAppear() {
}
// Bring up the regular keyboard again.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementCity)];
// Wait for the accessory icon to appear.
......@@ -349,7 +344,7 @@ BOOL WaitForKeyboardToAppear() {
// Bring up the keyboard by tapping the city, which is the element before the
// picker.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementCity)];
if (!UndockAndSplitKeyboard()) {
......@@ -394,7 +389,7 @@ BOOL WaitForKeyboardToAppear() {
assertWithMatcher:grey_nil()];
// Bring up the regular keyboard again.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementName)];
// Wait for the accessory icon to appear.
......@@ -425,7 +420,7 @@ BOOL WaitForKeyboardToAppear() {
// Bring up the keyboard by tapping the city, which is the element before the
// picker.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementCity)];
if (!UndockAndSplitKeyboard()) {
......@@ -454,13 +449,14 @@ BOOL WaitForKeyboardToAppear() {
}
// Tests that the manual fallback view is present in incognito.
- (void)testIncognitoManualFallbackMenu {
// Disabled due to flakiness. See crbug.com/1115321.
- (void)DISABLED_testIncognitoManualFallbackMenu {
// Add the profile to use for verification.
[AutofillAppInterface saveExampleProfile];
// Bring up the keyboard by tapping the city, which is the element before the
// picker.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementCity)];
// Verify the profiles icon is visible.
......@@ -477,7 +473,7 @@ BOOL WaitForKeyboardToAppear() {
// Bring up the keyboard by tapping the city, which is the element before the
// picker.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementCity)];
// Verify the profiles icon is visible.
......@@ -490,12 +486,13 @@ BOOL WaitForKeyboardToAppear() {
// Tests the mediator stops observing objects when the incognito BVC is
// destroyed. Waiting for dealloc was causing a race condition with the
// autorelease pool, and some times a DCHECK will be hit.
- (void)testOpeningIncognitoTabsDoNotLeak {
// TODO(crbug.com/1111258): Investigate cause of flakiness and re-enable.
- (void)DISABLED_testOpeningIncognitoTabsDoNotLeak {
const GURL URL = self.testServer->GetURL(kFormHTMLFile);
std::string webViewText("Profile form");
[AutofillAppInterface saveExampleProfile];
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementCity)];
// Verify the profiles icon is visible.
......@@ -509,7 +506,7 @@ BOOL WaitForKeyboardToAppear() {
[ChromeEarlGrey loadURL:URL];
[ChromeEarlGrey waitForWebStateContainingText:webViewText];
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementCity)];
// Verify the profiles icon is visible.
......@@ -525,7 +522,7 @@ BOOL WaitForKeyboardToAppear() {
// Bring up the keyboard by tapping the city, which is the element before the
// picker.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementCity)];
// Verify the profiles icon is visible.
......@@ -541,7 +538,7 @@ BOOL WaitForKeyboardToAppear() {
// Bring up the keyboard by tapping the city, which is the element before the
// picker.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementCity)];
// Open a regular tab.
......@@ -551,7 +548,7 @@ BOOL WaitForKeyboardToAppear() {
// Bring up the keyboard by tapping the city, which is the element before the
// picker.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementCity)];
// This will fail if there is more than one profiles icon in the hierarchy.
......@@ -562,13 +559,14 @@ BOOL WaitForKeyboardToAppear() {
}
// Tests that the manual fallback view is not duplicated after incognito.
- (void)testReturningFromIncognitoDoesNotDuplicatesManualFallbackMenu {
// Disabled due to flakiness. See crbug.com/1115282.
- (void)DISABLED_testReturningFromIncognitoDoesNotDuplicatesManualFallbackMenu {
// Add the profile to use for verification.
[AutofillAppInterface saveExampleProfile];
// Bring up the keyboard by tapping the city, which is the element before the
// picker.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementCity)];
// Verify the profiles icon is visible.
......@@ -585,7 +583,7 @@ BOOL WaitForKeyboardToAppear() {
// Bring up the keyboard by tapping the city, which is the element before the
// picker.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementCity)];
// Open a regular tab.
......@@ -595,7 +593,7 @@ BOOL WaitForKeyboardToAppear() {
// Bring up the keyboard by tapping the city, which is the element before the
// picker.
[[EarlGrey selectElementWithMatcher:WebViewMatcher()]
[[EarlGrey selectElementWithMatcher:chrome_test_util::WebViewMatcher()]
performAction:chrome_test_util::TapWebElementWithId(kFormElementCity)];
// This will fail if there is more than one profiles icon in the hierarchy.
......
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