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

Unified Diff: ios/chrome/browser/web/forms_egtest.mm

Issue 2806743004: Fixing testBrowsingPostEntryWithButton flakiness. (Closed)
Patch Set: Re-factoring to use helper methods Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/web/browsing_egtest.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/web/forms_egtest.mm
diff --git a/ios/chrome/browser/web/forms_egtest.mm b/ios/chrome/browser/web/forms_egtest.mm
index 2210492ffa19019a3b7cd16d853daf33248f394a..ca9cf191045448aeac457b45255d1e32a6155cab 100644
--- a/ios/chrome/browser/web/forms_egtest.mm
+++ b/ios/chrome/browser/web/forms_egtest.mm
@@ -24,6 +24,9 @@
#include "ios/web/public/test/response_providers/data_response_provider.h"
#include "ios/web/public/test/url_test_util.h"
+using chrome_test_util::OmniboxText;
+using chrome_test_util::WebViewContainingText;
+
namespace {
// URL for a generic website in the user navigation flow.
@@ -124,8 +127,6 @@ void GetResponseHeadersAndBody(
} // namespace
-using chrome_test_util::OmniboxText;
-
// Tests submition of HTTP forms POST data including cases involving navigation.
@interface FormsTestCase : ChromeTestCase
@end
@@ -346,4 +347,25 @@ - (void)testRepostFormCancellingAfterRedirect {
[self waitForExpectedResponse:"GET"];
}
+// Tests that pressing the button on a POST-based form changes the page and that
+// the back button works as expected afterwards.
+- (void)testGoBackButtonAfterFormSubmission {
+ GURL formURL = TestResponseProvider::GetFormUrl();
+ GURL destinationURL = TestResponseProvider::GetPrintFormDataUrl();
+
+ [ChromeEarlGrey loadURL:formURL];
+ chrome_test_util::TapWebViewElementWithId(kSubmitButton);
+ [[EarlGrey selectElementWithMatcher:WebViewContainingText(kExpectedPostData)]
gchatz 2017/04/10 18:43:23 Should this use [self waitForExpectedResponse]?
liaoyuke 2017/04/10 18:48:09 I think we should remove this method (in a separat
gchatz 2017/04/10 20:46:10 Ok sounds good
Eugene But (OOO till 7-30) 2017/04/10 20:46:45 Could you please file a bug and add a TODO for thi
+ assertWithMatcher:grey_notNil()];
+ [[EarlGrey selectElementWithMatcher:OmniboxText(destinationURL.GetContent())]
+ assertWithMatcher:grey_notNil()];
+
+ // Go back and verify the browser navigates to the original URL.
+ [self goBack];
+ [[EarlGrey selectElementWithMatcher:WebViewContainingText("Unicorn")]
+ assertWithMatcher:grey_notNil()];
+ [[EarlGrey selectElementWithMatcher:OmniboxText(formURL.GetContent())]
+ assertWithMatcher:grey_notNil()];
+}
+
@end
« no previous file with comments | « ios/chrome/browser/web/browsing_egtest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698