Bug 1322862 - Wait for forward- and back commands to complete. r=maja_zf, a=test-only
authorAndreas Tolfsen <ato@mozilla.com>
Thu, 02 Feb 2017 14:08:52 +0000
changeset 480400 80a2d38b0b2216e3ef89975f27e2d0a764d7fb24
parent 480399 55fa23c4fe239af7f1d94155ce4457cd56951622
child 480401 f67c25a9d2a909969bcba04b9a0c263415cfeddd
push id44524
push usermartin.thomson@gmail.com
push dateWed, 08 Feb 2017 05:10:11 +0000
reviewersmaja_zf, test-only
bugs1322862, 1330348
milestone52.0
Bug 1322862 - Wait for forward- and back commands to complete. r=maja_zf, a=test-only The Back and Forward commands are meant to be synchronous and this works around the problem of intermittents on slow try machines until bug 1330348 is fixed. For some reason, the preceding patches make script evaluation quicker and makes navigating back and forward less racy. MozReview-Commit-ID: GRcgMp1Rc6N
testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_navigation.py
@@ -73,36 +73,41 @@ class TestNavigate(WindowManagerMixin, M
         self.assertEqual(self.iframe_doc, self.marionette.get_url())
 
     def test_get_current_url(self):
         self.marionette.navigate(self.test_doc)
         self.assertEqual(self.test_doc, self.marionette.get_url())
         self.marionette.navigate("about:blank")
         self.assertEqual("about:blank", self.marionette.get_url())
 
+    # TODO(ato): Remove wait conditions when fixing bug 1330348
     def test_go_back(self):
         self.marionette.navigate(self.test_doc)
         self.assertNotEqual("about:blank", self.location_href)
         self.assertEqual("Marionette Test", self.marionette.title)
         self.marionette.navigate("about:blank")
         self.assertEqual("about:blank", self.location_href)
         self.marionette.go_back()
+        Wait(self.marionette).until(lambda m: self.location_href == self.test_doc)
         self.assertNotEqual("about:blank", self.location_href)
         self.assertEqual("Marionette Test", self.marionette.title)
 
+    # TODO(ato): Remove wait conditions when fixing bug 1330348
     def test_go_forward(self):
         self.marionette.navigate(self.test_doc)
         self.assertNotEqual("about:blank", self.location_href)
         self.assertEqual("Marionette Test", self.marionette.title)
         self.marionette.navigate("about:blank")
         self.assertEqual("about:blank", self.location_href)
         self.marionette.go_back()
+        Wait(self.marionette).until(lambda m: self.location_href == self.test_doc)
         self.assertEqual(self.test_doc, self.location_href)
         self.assertEqual("Marionette Test", self.marionette.title)
         self.marionette.go_forward()
+        Wait(self.marionette).until(lambda m: self.location_href == "about:blank")
         self.assertEqual("about:blank", self.location_href)
 
     def test_refresh(self):
         self.marionette.navigate(self.test_doc)
         self.assertEqual("Marionette Test", self.marionette.title)
         self.assertTrue(self.marionette.execute_script(
             """var elem = window.document.createElement('div'); elem.id = 'someDiv';
             window.document.body.appendChild(elem); return true;"""))