mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1107336: Update imports for loop tests; r=jgriffin
--HG-- extra : rebase_source : 5bcb1d7f8585033618197eed259688e034361d75
This commit is contained in:
parent
5a1e19cfcb
commit
8c91a2af84
@ -1,13 +1,14 @@
|
||||
from marionette_test import MarionetteTestCase
|
||||
from by import By
|
||||
import urlparse
|
||||
from errors import NoSuchElementException, StaleElementException
|
||||
|
||||
from marionette_driver.by import By
|
||||
from marionette_driver.errors import NoSuchElementException, StaleElementException
|
||||
# noinspection PyUnresolvedReferences
|
||||
from wait import Wait
|
||||
from time import sleep
|
||||
from marionette_driver.wait import Wait
|
||||
|
||||
import os
|
||||
import sys
|
||||
import urlparse
|
||||
from time import sleep
|
||||
sys.path.insert(1, os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from serversetup import LoopTestServers
|
||||
|
@ -2,11 +2,14 @@
|
||||
# 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/.
|
||||
|
||||
from marionette_test import MarionetteTestCase, skip_if_b2g, skip_if_e10s
|
||||
from marionette_driver.errors import MarionetteException, TimeoutException
|
||||
|
||||
class TestNavigate(MarionetteTestCase):
|
||||
def test_navigate(self):
|
||||
self.assertTrue(self.marionette.execute_script("window.location.href = 'about:blank'; return true;"))
|
||||
self.assertEqual("about:blank", self.marionette.execute_script("return window.location.href;"))
|
||||
test_html = self.marionette.absolute_url("test.html")
|
||||
self.marionette.navigate(test_html)
|
||||
self.assertNotEqual("about:blank", self.marionette.execute_script("return window.location.href;"))
|
||||
self.assertEqual("Marionette Test", self.marionette.title)
|
||||
@ -74,6 +77,7 @@ class TestNavigate(MarionetteTestCase):
|
||||
self.assertTrue('test_iframe.html' in self.marionette.get_url())
|
||||
'''
|
||||
|
||||
@skip_if_e10s # Interactions with about: pages need e10s support (bug 1096488).
|
||||
def test_shouldnt_error_if_nonexistent_url_used(self):
|
||||
try:
|
||||
self.marionette.navigate("thisprotocoldoesnotexist://")
|
||||
@ -81,8 +85,20 @@ class TestNavigate(MarionetteTestCase):
|
||||
except TimeoutException:
|
||||
self.fail("The socket shouldn't have timed out when navigating to a non-existent URL")
|
||||
except MarionetteException as e:
|
||||
self.assertIn("Error loading page", str(e))
|
||||
except Exception as inst:
|
||||
import traceback
|
||||
print traceback.format_exc()
|
||||
self.fail("Should have thrown a MarionetteException instead of %s" % type(inst))
|
||||
|
||||
@skip_if_e10s # Interactions with about: pages need e10s support (bug 1096488).
|
||||
@skip_if_b2g # about:blocked isn't a well formed uri on b2g
|
||||
def test_should_navigate_to_requested_about_page(self):
|
||||
self.marionette.navigate("about:neterror")
|
||||
self.assertEqual(self.marionette.get_url(), "about:neterror")
|
||||
self.marionette.navigate(self.marionette.absolute_url("test.html"))
|
||||
self.marionette.navigate("about:blocked")
|
||||
self.assertEqual(self.marionette.get_url(), "about:blocked")
|
||||
|
||||
def test_find_element_state_complete(self):
|
||||
test_html = self.marionette.absolute_url("test.html")
|
||||
|
@ -2,10 +2,13 @@
|
||||
# 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/.
|
||||
|
||||
from marionette import Keys
|
||||
from marionette_test import MarionetteTestCase, skip_if_e10s
|
||||
from marionette_driver.keys import Keys
|
||||
|
||||
|
||||
class TestWindowHandles(MarionetteTestCase):
|
||||
|
||||
@skip_if_e10s # Interactions with about: pages need e10s support (bug 1096488).
|
||||
def test_new_tab_window_handles(self):
|
||||
keys = [Keys.SHIFT]
|
||||
if self.marionette.session_capabilities['platformName'] == 'DARWIN':
|
||||
@ -89,5 +92,66 @@ from marionette import Keys
|
||||
self.assertEqual(len(self.marionette.window_handles), 1)
|
||||
self.marionette.switch_to_window(start_tab)
|
||||
|
||||
# This sequence triggers an exception in Marionette:register with e10s on (bug 1120809).
|
||||
@skip_if_e10s
|
||||
def test_tab_and_window_handles(self):
|
||||
start_tab = self.marionette.current_window_handle
|
||||
start_chrome_window = self.marionette.current_chrome_window_handle
|
||||
tab_open_page = self.marionette.absolute_url("windowHandles.html")
|
||||
window_open_page = self.marionette.absolute_url("test_windows.html")
|
||||
|
||||
# Open a new tab and switch to it.
|
||||
self.marionette.navigate(tab_open_page)
|
||||
link = self.marionette.find_element("id", "new-tab")
|
||||
link.click()
|
||||
|
||||
self.wait_for_condition(lambda mn: len(mn.window_handles) == 2)
|
||||
self.assertEqual(len(self.marionette.chrome_window_handles), 1)
|
||||
self.assertEqual(self.marionette.current_chrome_window_handle, start_chrome_window)
|
||||
|
||||
handles = self.marionette.window_handles
|
||||
handles.remove(start_tab)
|
||||
|
||||
new_tab = handles.pop()
|
||||
self.marionette.switch_to_window(new_tab)
|
||||
self.assertEqual(self.marionette.get_url(), "about:blank")
|
||||
|
||||
# Open a new window from the new tab.
|
||||
self.marionette.navigate(window_open_page)
|
||||
|
||||
link = self.marionette.find_element("link text", "Open new window")
|
||||
link.click()
|
||||
self.wait_for_condition(lambda mn: len(mn.window_handles) == 3)
|
||||
|
||||
self.assertEqual(len(self.marionette.chrome_window_handles), 2)
|
||||
self.assertEqual(self.marionette.current_chrome_window_handle, start_chrome_window)
|
||||
|
||||
# Find the new window and switch to it.
|
||||
handles = self.marionette.window_handles
|
||||
handles.remove(start_tab)
|
||||
handles.remove(new_tab)
|
||||
new_window = handles.pop()
|
||||
|
||||
self.marionette.switch_to_window(new_window)
|
||||
results_page = self.marionette.absolute_url("resultPage.html")
|
||||
self.assertEqual(self.marionette.get_url(), results_page)
|
||||
|
||||
self.assertEqual(len(self.marionette.chrome_window_handles), 2)
|
||||
self.assertNotEqual(self.marionette.current_chrome_window_handle, start_chrome_window)
|
||||
|
||||
# Return to our original tab and close it.
|
||||
self.marionette.switch_to_window(start_tab)
|
||||
self.marionette.close()
|
||||
self.assertEquals(len(self.marionette.window_handles), 2)
|
||||
|
||||
# Close the opened window and carry on in our new tab.
|
||||
self.marionette.switch_to_window(new_window)
|
||||
self.marionette.close()
|
||||
self.assertEqual(len(self.marionette.window_handles), 1)
|
||||
|
||||
self.marionette.switch_to_window(new_tab)
|
||||
self.assertEqual(self.marionette.get_url(), results_page)
|
||||
self.marionette.navigate("about:blank")
|
||||
|
||||
self.assertEqual(len(self.marionette.chrome_window_handles), 1)
|
||||
self.assertEqual(self.marionette.current_chrome_window_handle, start_chrome_window)
|
||||
|
Loading…
Reference in New Issue
Block a user