Bug 1352132 - Navigation unit tests have to wait for the page loaded in the newly opened tab. r=ato
authorHenrik Skupin <mail@hskupin.info>
Mon, 08 May 2017 21:18:24 +0200
changeset 357149 0bd894decfae5a32c2971d8cbb0835e51c77507c
parent 357148 e283471c9bfe14ad030181cbb4290596a7f0969c
child 357150 afe4400d803d3ef4eb56c86e95252acf1d7a237b
push id31783
push usercbook@mozilla.com
push dateTue, 09 May 2017 12:03:48 +0000
treeherdermozilla-central@b0ff0c5c0a35 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1352132
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1352132 - Navigation unit tests have to wait for the page loaded in the newly opened tab. r=ato There is a race condition for all navigation tests inside the setUp method of the BaseNavigationTestCase class. The assert for history items can already happen if the page hasn't been fully loaded yet. As such a failure is thrown. To fix this we have to wait for the page being loaded. MozReview-Commit-ID: 9LbArVT9WqA
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
@@ -39,17 +39,19 @@ class BaseNavigationTestCase(WindowManag
         def open_with_link():
             link = self.marionette.find_element(By.ID, "new-blank-tab")
             link.click()
 
         # Always use a blank new tab for an empty history
         self.marionette.navigate(self.marionette.absolute_url("windowHandles.html"))
         self.new_tab = self.open_tab(open_with_link)
         self.marionette.switch_to_window(self.new_tab)
-        self.assertEqual(self.history_length, 1)
+        Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
+            lambda _: self.history_length == 1,
+            message="The newly opened tab doesn't have a browser history length of 1")
 
     def tearDown(self):
         self.marionette.timeout.reset()
         self.marionette.switch_to_parent_frame()
 
         self.close_all_tabs()
 
         super(BaseNavigationTestCase, self).tearDown()