зеркало из https://github.com/mozilla/pjs.git
Bug 755700 - Part A: test case, r=mdas, DONTBUILD because NPOTB
This commit is contained in:
Родитель
d019d9c5ac
Коммит
2cd5e32cac
|
@ -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())
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>We Arrive Here</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<input type='text' id='email'/>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</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>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче