Chromium Code Reviews| 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 <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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 592 GREYAssert([condition waitWithTimeout:10], | 592 GREYAssert([condition waitWithTimeout:10], |
| 593 @"No keyboard with 'Go' button showed up."); | 593 @"No keyboard with 'Go' button showed up."); |
| 594 | 594 |
| 595 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Go")] | 595 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Go")] |
| 596 performAction:grey_tap()]; | 596 performAction:grey_tap()]; |
| 597 | 597 |
| 598 // Reenable synchronization now that the keyboard has been closed. | 598 // Reenable synchronization now that the keyboard has been closed. |
| 599 [[GREYConfiguration sharedInstance] | 599 [[GREYConfiguration sharedInstance] |
| 600 setValue:@YES | 600 setValue:@YES |
| 601 forConfigKey:kGREYConfigKeySynchronizationEnabled]; | 601 forConfigKey:kGREYConfigKeySynchronizationEnabled]; |
| 602 | |
| 603 // Ensure that the new page loaded before continuing. | |
| 604 [ChromeEarlGrey waitForPageToFinishLoading]; | |
| 605 } | 602 } |
| 606 | 603 |
| 607 // Tests that submitting a POST-based form by tapping the 'Go' button on the | 604 // Tests that submitting a POST-based form by tapping the 'Go' button on the |
| 608 // keyboard navigates to the correct URL and the back button works as expected | 605 // keyboard navigates to the correct URL and the back button works as expected |
| 609 // afterwards. | 606 // afterwards. |
| 610 // TODO(crbug.com/704618): Re-enable this test when the flake is fixed. | 607 // TODO(crbug.com/704618): Re-enable this test when the flake is fixed. |
| 611 - (void)FLAKY_testBrowsingPostEntryWithKeyboard { | 608 - (void)FLAKY_testBrowsingPostEntryWithKeyboard { |
|
Eugene But (OOO till 7-30)
2017/04/11 00:57:04
Do you plan to remove |FLAKY_| in a separate CL?
gchatz
2017/04/11 01:03:58
Yep, after verifying this fix worked.
| |
| 612 // Create map of canned responses and set up the test HTML server. | 609 // Create map of canned responses and set up the test HTML server. |
| 613 std::map<GURL, std::string> responses; | 610 std::map<GURL, std::string> responses; |
| 614 const GURL URL = | 611 const GURL URL = |
| 615 web::test::HttpServer::MakeUrl("http://postEntryWithKeyboard"); | 612 web::test::HttpServer::MakeUrl("http://postEntryWithKeyboard"); |
| 616 const GURL destinationURL = web::test::HttpServer::MakeUrl("http://foo"); | 613 const GURL destinationURL = web::test::HttpServer::MakeUrl("http://foo"); |
| 617 // This is a page this an input text field and a button that posts to the | 614 // This is a page this an input text field and a button that posts to the |
| 618 // destination. | 615 // destination. |
| 619 responses[URL] = base::StringPrintf( | 616 responses[URL] = base::StringPrintf( |
| 620 "hello!" | 617 "hello!" |
| 621 "<form action='%s' method='post'>" | 618 "<form action='%s' method='post'>" |
| 622 "<input value='textfield' id='textfield' type='text'></label>" | 619 "<input value='textfield' id='textfield' type='text'></label>" |
| 623 "<input type='submit'></form>", | 620 "<input type='submit'></form>", |
| 624 destinationURL.spec().c_str()); | 621 destinationURL.spec().c_str()); |
| 625 // This is the page that should be showing at the end of the test. | 622 // This is the page that should be showing at the end of the test. |
| 626 responses[destinationURL] = "baz!"; | 623 responses[destinationURL] = "baz!"; |
| 627 web::test::SetUpSimpleHttpServer(responses); | 624 web::test::SetUpSimpleHttpServer(responses); |
| 628 | 625 |
| 629 // Open the URL, focus the textfield,and submit via keyboard. | 626 // Open the URL, focus the textfield,and submit via keyboard. |
| 630 [ChromeEarlGrey loadURL:URL]; | 627 [ChromeEarlGrey loadURL:URL]; |
| 631 [[EarlGrey selectElementWithMatcher:WebViewContainingText("hello!")] | 628 [[EarlGrey selectElementWithMatcher:WebViewContainingText("hello!")] |
| 632 assertWithMatcher:grey_notNil()]; | 629 assertWithMatcher:grey_notNil()]; |
| 633 | 630 |
| 634 [self submitFormUsingKeyboardGoButtonWithInputID:"textfield"]; | 631 [self submitFormUsingKeyboardGoButtonWithInputID:"textfield"]; |
| 635 | 632 |
| 636 // Verify that the browser navigates to the expected URL. | 633 // Verify that the browser navigates to the expected URL. |
| 634 [[EarlGrey selectElementWithMatcher:WebViewContainingText("baz!")] | |
| 635 assertWithMatcher:grey_notNil()]; | |
| 637 [[EarlGrey selectElementWithMatcher:OmniboxText(destinationURL.GetContent())] | 636 [[EarlGrey selectElementWithMatcher:OmniboxText(destinationURL.GetContent())] |
| 638 assertWithMatcher:grey_notNil()]; | 637 assertWithMatcher:grey_notNil()]; |
| 639 | 638 |
| 640 // Go back and verify that the browser navigates to the original URL. | 639 // Go back and verify that the browser navigates to the original URL. |
| 641 [self goBack]; | 640 [self goBack]; |
| 641 [[EarlGrey selectElementWithMatcher:WebViewContainingText("hello!")] | |
| 642 assertWithMatcher:grey_notNil()]; | |
| 642 [[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())] | 643 [[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())] |
| 643 assertWithMatcher:grey_notNil()]; | 644 assertWithMatcher:grey_notNil()]; |
| 644 } | 645 } |
| 645 | 646 |
| 646 @end | 647 @end |
| OLD | NEW |