Bug 755700 - Part A: test case, r=mdas, DONTBUILD because NPOTB
authorDavid Burns <dburns@mozilla.com>
Wed, 16 May 2012 13:44:24 -0700
changeset 94411 6990b5f4ea250f75b300faed71ef62d679e8dacf
parent 94410 aef74c3cd5a1a9dcba989e950210b0952ca6d215
child 94412 94c7c6648af78e628e73754f2256196e2796b5b0
push id22712
push userryanvm@gmail.com
push dateSat, 19 May 2012 00:52:01 +0000
treeherdermozilla-central@642d1a36702f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmdas, DONTBUILD
bugs755700
milestone15.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 755700 - Part A: test case, r=mdas, DONTBUILD because NPOTB
testing/marionette/client/marionette/tests/unit/test_window_switching.py
testing/marionette/client/marionette/www/resultPage.html
testing/marionette/client/marionette/www/test_windows.html
new file mode 100644
--- /dev/null
+++ b/testing/marionette/client/marionette/tests/unit/test_window_switching.py
@@ -0,0 +1,45 @@
+# 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 os
+import time
+from marionette_test import MarionetteTestCase
+
+class TestWindowSwitching(MarionetteTestCase):
+    def testJSWindowCreationAndSwitching(self):
+        test_html = self.marionette.absolute_url("test_windows.html")
+        self.marionette.navigate(test_html)
+
+        current_window = self.marionette.get_window()
+        link = self.marionette.find_element("link text", "Open new window")
+        link.click()
+
+        windows = self.marionette.get_windows()
+        windows.remove(current_window)
+        self.marionette.switch_to_window(windows[0])
+
+        title = self.marionette.execute_script("return document.title")
+        results_page = self.marionette.absolute_url("resultPage.html")
+        self.assertEqual(self.marionette.get_url(), results_page)
+        self.assertEqual(title, "We Arrive Here")
+
+        #ensure navigate works in our current window
+        other_page = self.marionette.absolute_url("test.html")
+        self.marionette.navigate(other_page)
+        other_window = self.marionette.get_window()
+
+        #try to access its dom
+        #since Bug 720714 stops us from checking DOMContentLoaded, we wait a bit
+        for i in range(30):
+            try:
+                self.marionette.find_element("id", "mozLink")
+                break
+            except:
+                pass
+            time.sleep(1)
+
+        self.assertEqual(other_window, self.marionette.get_window())
+        self.marionette.switch_to_window(current_window)
+        self.assertEqual(current_window, self.marionette.get_window())
+
new file mode 100644
--- /dev/null
+++ b/testing/marionette/client/marionette/www/resultPage.html
@@ -0,0 +1,13 @@
+<html>
+<head>
+    <title>We Arrive Here</title>
+</head>
+<body>
+
+
+<div>
+  <input type='text' id='email'/>
+</div>
+</body>
+</html>
+
new file mode 100644
--- /dev/null
+++ b/testing/marionette/client/marionette/www/test_windows.html
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+    <title>XHTML Test Page</title>
+</head>
+<body>
+    <p><a href="resultPage.html" onClick='javascript:window.open("resultPage.html",null, "menubar=0,location=1,resizable=1,scrollbars=1,status=0,dialog=1,width=700,height=375");' name="windowOne">Open new window</a></p>
+</body>
+</html>
+