author | Henrik Skupin <mail@hskupin.info> |
Tue, 30 May 2017 11:25:21 +0200 | |
changeset 361274 | 4c6b36ee9f171c7a3831e30309a925cfe710d329 |
parent 361273 | e7703bd2ef36bca028dea4f2b93c611a68b5d120 |
child 361275 | ed5505b795eac0d3609e2f2ea9fe556490a30c5f |
push id | 43706 |
push user | hskupin@mozilla.com |
push date | Tue, 30 May 2017 14:40:46 +0000 |
treeherder | autoland@4c6b36ee9f17 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | ato |
bugs | 1368526 |
milestone | 55.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
|
testing/marionette/harness/marionette_harness/tests/unit/test_window_handles_chrome.py | file | annotate | diff | comparison | revisions |
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_window_handles_chrome.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_window_handles_chrome.py @@ -1,15 +1,15 @@ # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import types -from marionette_driver import By, errors +from marionette_driver import By, errors, Wait from marionette_harness import MarionetteTestCase, WindowManagerMixin class TestWindowHandles(WindowManagerMixin, MarionetteTestCase): def setUp(self): super(TestWindowHandles, self).setUp() @@ -74,17 +74,19 @@ class TestWindowHandles(WindowManagerMix self.assertEqual(len(self.marionette.chrome_window_handles), len(self.start_windows) + 1) self.assertEqual(self.marionette.current_chrome_window_handle, self.start_window) # Check that the new tab has the correct page loaded self.marionette.switch_to_window(new_win) self.assert_window_handles() self.assertEqual(self.marionette.current_chrome_window_handle, new_win) with self.marionette.using_context("content"): - self.assertEqual(self.marionette.get_url(), self.empty_page) + Wait(self.marionette, timeout=self.marionette.timeout.page_load).until( + lambda mn: mn.get_url() == self.empty_page, + message="{} did not load after opening a new tab".format(self.empty_page)) # Ensure navigate works in our current window other_page = self.marionette.absolute_url("test.html") with self.marionette.using_context("content"): self.marionette.navigate(other_page) self.assertEqual(self.marionette.get_url(), other_page) # Close the opened window and carry on in our original tab. @@ -108,17 +110,19 @@ class TestWindowHandles(WindowManagerMix self.assert_window_handles() self.assertEqual(len(self.marionette.window_handles), len(self.start_tabs) + 1) self.assertEqual(self.marionette.current_window_handle, self.start_tab) self.marionette.switch_to_window(new_tab) self.assert_window_handles() self.assertEqual(self.marionette.current_window_handle, new_tab) with self.marionette.using_context("content"): - self.assertEqual(self.marionette.get_url(), self.empty_page) + Wait(self.marionette, timeout=self.marionette.timeout.page_load).until( + lambda mn: mn.get_url() == self.empty_page, + message="{} did not load after opening a new tab".format(self.empty_page)) # Ensure navigate works in our current tab other_page = self.marionette.absolute_url("test.html") with self.marionette.using_context("content"): self.marionette.navigate(other_page) self.assertEqual(self.marionette.get_url(), other_page) self.marionette.switch_to_window(self.start_tab) @@ -147,17 +151,19 @@ class TestWindowHandles(WindowManagerMix self.assertEqual(len(self.marionette.window_handles), len(self.start_tabs) + 1) self.assertEqual(self.marionette.current_window_handle, self.start_tab) # Check that the new tab has the correct page loaded self.marionette.switch_to_window(new_tab) self.assert_window_handles() self.assertEqual(self.marionette.current_window_handle, new_tab) with self.marionette.using_context("content"): - self.assertEqual(self.marionette.get_url(), self.empty_page) + Wait(self.marionette, timeout=self.marionette.timeout.page_load).until( + lambda mn: mn.get_url() == self.empty_page, + message="{} did not load after opening a new tab".format(self.empty_page)) # Ensure navigate works in our current window other_page = self.marionette.absolute_url("test.html") with self.marionette.using_context("content"): self.marionette.navigate(other_page) self.assertEqual(self.marionette.get_url(), other_page) # Close the opened window and carry on in our original tab. @@ -185,17 +191,19 @@ class TestWindowHandles(WindowManagerMix self.marionette.close() self.assert_window_handles() self.assertEqual(len(self.marionette.window_handles), len(self.start_tabs)) self.marionette.switch_to_window(new_tab) self.assert_window_handles() self.assertEqual(self.marionette.current_window_handle, new_tab) with self.marionette.using_context("content"): - self.assertEqual(self.marionette.get_url(), self.empty_page) + Wait(self.marionette, timeout=self.marionette.timeout.page_load).until( + lambda mn: mn.get_url() == self.empty_page, + message="{} did not load after opening a new tab".format(self.empty_page)) def test_window_handles_no_switch(self): """Regression test for bug 1294456. This test is testing the case where Marionette attempts to send a command to a window handle when the browser has opened and selected a new tab. Before bug 1294456 landed, the Marionette driver was getting confused about which window handle the client cared about, and assumed it was the window handle for the newly opened and selected tab.