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

Side by Side Diff: ios/chrome/browser/web/browsing_egtest.mm

Issue 2626143002: Add more criteria to wait until keyboard appears. (Closed)
Patch Set: fix GREYMatcher Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <XCTest/XCTest.h> 5 #import <XCTest/XCTest.h>
6 #include <map> 6 #include <map>
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/ios/ios_util.h" 10 #include "base/ios/ios_util.h"
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 // keyboard from a web view. 614 // keyboard from a web view.
615 [[GREYConfiguration sharedInstance] 615 [[GREYConfiguration sharedInstance]
616 setValue:@NO 616 setValue:@NO
617 forConfigKey:kGREYConfigKeySynchronizationEnabled]; 617 forConfigKey:kGREYConfigKeySynchronizationEnabled];
618 618
619 // Wait until the keyboard shows up before tapping. 619 // Wait until the keyboard shows up before tapping.
620 GREYCondition* condition = [GREYCondition 620 GREYCondition* condition = [GREYCondition
621 conditionWithName:@"Wait for the keyboard to show up." 621 conditionWithName:@"Wait for the keyboard to show up."
622 block:^BOOL { 622 block:^BOOL {
623 NSError* error = nil; 623 NSError* error = nil;
624 [[EarlGrey 624 id<GREYMatcher> keyboardGoButton = grey_allOf(
Eugene But (OOO till 7-30) 2017/01/11 22:15:12 Should this be a function instead of local variabl
Eugene But (OOO till 7-30) 2017/01/11 22:15:12 s/keyboardGoButton/keyboardGoButtonMatcher
gchatz 2017/01/11 22:28:41 I moved it to a method in case other places that i
gchatz 2017/01/11 22:28:41 Done with method.
625 selectElementWithMatcher:grey_accessibilityID(@"Go")] 625 grey_accessibilityID(@"Go"), grey_interactable(), nil);
626 [[EarlGrey selectElementWithMatcher:keyboardGoButton]
626 assertWithMatcher:grey_notNil() 627 assertWithMatcher:grey_notNil()
627 error:&error]; 628 error:&error];
628 return (error == nil); 629 return (error == nil);
629 }]; 630 }];
630 GREYAssert([condition waitWithTimeout:10], 631 GREYAssert([condition waitWithTimeout:10],
631 @"No keyboard with 'Go' button showed up."); 632 @"No keyboard with 'Go' button showed up.");
632 633
633 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Go")] 634 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Go")]
634 performAction:grey_tap()]; 635 performAction:grey_tap()];
635 636
636 // Reenable synchronization now that the keyboard has been closed. 637 // Reenable synchronization now that the keyboard has been closed.
637 [[GREYConfiguration sharedInstance] 638 [[GREYConfiguration sharedInstance]
638 setValue:@YES 639 setValue:@YES
639 forConfigKey:kGREYConfigKeySynchronizationEnabled]; 640 forConfigKey:kGREYConfigKeySynchronizationEnabled];
640 641
641 // Verify that the browser navigates to the expected URL. 642 // Verify that the browser navigates to the expected URL.
642 [[EarlGrey selectElementWithMatcher:omniboxText(destinationURL.GetContent())] 643 [[EarlGrey selectElementWithMatcher:omniboxText(destinationURL.GetContent())]
643 assertWithMatcher:grey_notNil()]; 644 assertWithMatcher:grey_notNil()];
644 645
645 // Go back and verify that the browser navigates to the original URL. 646 // Go back and verify that the browser navigates to the original URL.
646 [self goBack]; 647 [self goBack];
647 [[EarlGrey selectElementWithMatcher:omniboxText(URL.GetContent())] 648 [[EarlGrey selectElementWithMatcher:omniboxText(URL.GetContent())]
648 assertWithMatcher:grey_notNil()]; 649 assertWithMatcher:grey_notNil()];
649 } 650 }
650 651
651 @end 652 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698