Bug 1512336 - [marionette] Fix hang in TestNavigate.test_set_location_through_execute_script. r=ato
authorHenrik Skupin <mail@hskupin.info>
Fri, 11 Jan 2019 13:20:29 +0000
changeset 513454 70cf6c6c51b4e162394552140d92b7266603f47d
parent 513453 662d6d626c15b9a9dce3041541037bf74f465cec
child 513455 4e94bbb9031517d9953adc24b6ff5646600df028
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1512336
milestone66.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 1512336 - [marionette] Fix hang in TestNavigate.test_set_location_through_execute_script. r=ato An unexpected remoteness change can cause the "WebDriver:FindElement" command to hang forever. To avoid that already pre-load a web page which enables the remoteness flag. Differential Revision: https://phabricator.services.mozilla.com/D16306
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
@@ -111,27 +111,27 @@ class BaseNavigationTestCase(WindowManag
     def ready_state(self):
         return self.marionette.execute_script("return window.document.readyState;",
                                               sandbox=None)
 
 
 class TestNavigate(BaseNavigationTestCase):
 
     def test_set_location_through_execute_script(self):
-        test_element_locator = (By.ID, "testh1")
+        # To avoid unexpected remoteness changes and a hang in any non-navigation
+        # command (bug 1519354) when navigating via the location bar, already
+        # pre-load a page which causes a remoteness change.
+        self.marionette.navigate(self.test_page_push_state)
 
         self.marionette.execute_script(
             "window.location.href = arguments[0];",
             script_args=(self.test_page_remote,), sandbox=None)
 
-        # We cannot use get_url() to wait until the target page has been loaded,
-        # because it will return the URL of the top browsing context and doesn't
-        # wait for the page load to be complete.
         Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
-            expected.element_present(*test_element_locator),
+            expected.element_present(*(By.ID, "testh1")),
             message="Target element 'testh1' has not been found")
 
         self.assertEqual(self.test_page_remote, self.marionette.get_url())
 
     def test_navigate_chrome_unsupported_error(self):
         with self.marionette.using_context("chrome"):
             self.assertRaises(errors.UnsupportedOperationException,
                               self.marionette.navigate, "about:blank")