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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Henrik Skupin 2019-01-11 13:20:29 +00:00
Родитель 08e5888d07
Коммит 43ec1824b4
1 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -116,17 +116,17 @@ class BaseNavigationTestCase(WindowManagerMixin, MarionetteTestCase):
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())