Bug 1353447 - Fix race condition in TestBackForwardNavigation.test_timeout_error. r=ato, a=test-only
authorHenrik Skupin <mail@hskupin.info>
Mon, 24 Apr 2017 13:08:13 +0200
changeset 396034 5938ef3ed0dba31593d818757972657c96c31dd8
parent 396033 419d01b08a9ef9d9f8698c73b573eb2ffeeef0c1
child 396035 4bde1b05f7bf61e39ba8d3679b2ea73c58bea0e4
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato, test-only
bugs1353447
milestone54.0
Bug 1353447 - Fix race condition in TestBackForwardNavigation.test_timeout_error. r=ato, a=test-only The test doesn't care about the page load status when a timeout error happened for a back and forward command. It only compares the urlbar for the expected url, but doesn't actually wait for the required element on the page. MozReview-Commit-ID: 8w0iP62rlQZ
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
@@ -442,34 +442,34 @@ class TestBackForwardNavigation(BaseNavi
         self.assertEqual(urls[1], self.marionette.get_url())
 
         # Force triggering a timeout error
         self.marionette.timeout.page_load = 0.5
         with self.assertRaises(errors.TimeoutException):
             self.marionette.go_back()
         self.marionette.timeout.reset()
 
-        Wait(self.marionette, self.marionette.timeout.page_load).until(
-            lambda mn: urls[0] == mn.get_url(),
-            message="'{}' has been successfully loaded after going back".format(urls[0]))
-        self.assertEqual(self.marionette.find_element(By.ID, "delay").text, "3")
+        delay = Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
+            expected.element_present(By.ID, "delay"),
+            message="Target element 'delay' has not been found after timeout in 'back'")
+        self.assertEqual(delay.text, "3")
 
         self.marionette.go_forward()
         self.assertEqual(urls[1], self.marionette.get_url())
 
         # Force triggering a timeout error
         self.marionette.timeout.page_load = 0.5
         with self.assertRaises(errors.TimeoutException):
             self.marionette.go_forward()
         self.marionette.timeout.reset()
 
-        Wait(self.marionette, self.marionette.timeout.page_load).until(
-            lambda mn: urls[2] == mn.get_url(),
-            message="'{}' has been successfully loaded after going back".format(urls[2]))
-        self.assertEqual(self.marionette.find_element(By.ID, "delay").text, "4")
+        delay = Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
+            expected.element_present(By.ID, "delay"),
+            message="Target element 'delay' has not been found after timeout in 'forward'")
+        self.assertEqual(delay.text, "4")
 
     def test_certificate_error(self):
         test_pages = [
             {"url": self.test_page_insecure,
              "error": errors.InsecureCertificateException},
             {"url": self.test_page_remote},
             {"url": self.test_page_insecure,
              "error": errors.InsecureCertificateException},