--- a/testing/marionette/harness/marionette_harness/tests/unit/test_crash.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_crash.py
@@ -71,17 +71,16 @@ class BaseCrashTestCase(MarionetteTestCa
self.skipTest('Crash reporter disabled')
return
self.mozcrash = runner.mozcrash
runner.mozcrash = mozcrash_mock
self.crash_count = self.marionette.crashed
self.pid = self.marionette.process_id
- self.remote_uri = self.marionette.absolute_url("javascriptPage.html")
def tearDown(self):
# Replace mockup with original mozcrash instance
runner.mozcrash = self.mozcrash
self.marionette.crashed = self.crash_count
super(BaseCrashTestCase, self).tearDown()
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_key_actions.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_key_actions.py
@@ -1,28 +1,34 @@
# 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 urllib
+
from marionette_driver.by import By
from marionette_driver.keys import Keys
from marionette_driver.marionette import Actions
from marionette_harness import MarionetteTestCase, skip_if_mobile, WindowManagerMixin
+def inline(doc):
+ return "data:text/html;charset=utf-8,{}".format(urllib.quote(doc))
+
+
class TestKeyActions(WindowManagerMixin, MarionetteTestCase):
def setUp(self):
super(TestKeyActions, self).setUp()
if self.marionette.session_capabilities["platformName"] == "darwin":
self.mod_key = Keys.META
else:
self.mod_key = Keys.CONTROL
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
self.reporter_element = self.marionette.find_element(By.ID, "keyReporter")
self.reporter_element.click()
self.key_action = Actions(self.marionette)
@property
def key_reporter_value(self):
return self.reporter_element.get_property("value")
@@ -69,23 +75,22 @@ class TestKeyActions(WindowManagerMixin,
.key_down("x")
.perform())
self.assertEqual(self.key_reporter_value, "")
@skip_if_mobile("Interacting with chrome windows not available for Fennec")
def test_open_in_new_window_shortcut(self):
def open_window_with_action():
- el = self.marionette.find_element(By.ID, "updatediv")
- # Ensure that the element is in the current view port because press() doesn't
- # handle that inside the action chain (bug 1295538).
- self.marionette.execute_script('arguments[0].scrollIntoView()', script_args=[el])
+ el = self.marionette.find_element(By.TAG_NAME, "a")
(self.key_action.key_down(Keys.SHIFT)
.press(el)
.release()
.key_up(Keys.SHIFT)
.perform())
+ self.marionette.navigate(inline("<a href='#'>Click</a>"))
new_window = self.open_window(trigger=open_window_with_action)
+
self.marionette.switch_to_window(new_window)
self.marionette.close_chrome_window()
+
self.marionette.switch_to_window(self.start_window)
- self.assertEqual(self.key_reporter_value, "")
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_mouse_action.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_mouse_action.py
@@ -39,19 +39,19 @@ class TestMouseAction(MarionetteTestCase
el = self.marionette.find_element(By.ID, "one-word-div")
self.action.double_click(el).perform()
el.send_keys(self.mod_key + "c")
rel = self.marionette.find_element(By.ID, "input-field")
rel.send_keys(self.mod_key + "v")
self.assertEqual("zyxw", rel.get_property("value"))
def test_context_click_action(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ test_html = self.marionette.absolute_url("clicks.html")
self.marionette.navigate(test_html)
- click_el = self.marionette.find_element(By.ID, "resultContainer")
+ click_el = self.marionette.find_element(By.ID, "normal")
def context_menu_state():
with self.marionette.using_context("chrome"):
cm_el = self.marionette.find_element(By.ID, "contentAreaContextMenu")
return cm_el.get_property("state")
self.assertEqual("closed", context_menu_state())
self.action.context_click(click_el).perform()
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_rendered_element.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_rendered_element.py
@@ -1,34 +1,28 @@
-#Copyright 2007-2009 WebDriver committers
-#Copyright 2007-2009 Google Inc.
-#
-#Licensed under the Apache License, Version 2.0 (the "License");
-#you may not use this file except in compliance with the License.
-#You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-#Unless required by applicable law or agreed to in writing, software
-#distributed under the License is distributed on an "AS IS" BASIS,
-#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#See the License for the specific language governing permissions and
-#limitations under the License.
+import urllib
from marionette_driver.by import By
+from marionette_harness import MarionetteTestCase
-from marionette_harness import MarionetteTestCase
+
+def inline(doc):
+ return "data:text/html;charset=utf-8,{}".format(urllib.quote(doc))
class RenderedElementTests(MarionetteTestCase):
- def testWeCanGetComputedStyleValueOnElement(self):
- test_url = self.marionette.absolute_url('javascriptPage.html')
- self.marionette.navigate(test_url)
- element = self.marionette.find_element(By.ID, "green-parent")
- backgroundColour = element.value_of_css_property("background-color")
+ def test_get_computed_style_value_from_element(self):
+ self.marionette.navigate(inline("""
+ <div style="color: green;" id="parent">
+ <p id="green">This should be green</p>
+ <p id="red" style="color: red;">But this is red</p>
+ </div>
+ """))
- self.assertEqual("rgb(0, 128, 0)", backgroundColour)
+ parent = self.marionette.find_element(By.ID, "parent")
+ self.assertEqual("rgb(0, 128, 0)", parent.value_of_css_property("color"))
- element = self.marionette.find_element(By.ID, "red-item")
- backgroundColour = element.value_of_css_property("background-color")
+ green = self.marionette.find_element(By.ID, "green")
+ self.assertEqual("rgb(0, 128, 0)", green.value_of_css_property("color"))
- self.assertEqual("rgb(255, 0, 0)", backgroundColour)
+ red = self.marionette.find_element(By.ID, "red")
+ self.assertEqual("rgb(255, 0, 0)", red.value_of_css_property("color"))
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_switch_frame.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_switch_frame.py
@@ -74,32 +74,29 @@ class TestSwitchFrame(MarionetteTestCase
self.marionette.execute_async_script("foo();")
except JavascriptException as e:
self.assertTrue("foo" in e.message)
def test_should_be_able_to_carry_on_working_if_the_frame_is_deleted_from_under_us(self):
test_html = self.marionette.absolute_url("deletingFrame.html")
self.marionette.navigate(test_html)
- self.marionette.switch_to_frame(self.marionette.find_element(By.ID,
- 'iframe1'))
- killIframe = self.marionette.find_element(By.ID, "killIframe")
- killIframe.click()
+ self.marionette.switch_to_frame(self.marionette.find_element(By.ID, 'iframe1'))
+ kill_iframe = self.marionette.find_element(By.ID, "killIframe")
+ kill_iframe.click()
self.marionette.switch_to_frame()
-
self.assertEqual(0, len(self.marionette.find_elements(By.ID, "iframe1")))
- addIFrame = self.marionette.find_element(By.ID, "addBackFrame")
- addIFrame.click()
+ add_iframe = self.marionette.find_element(By.ID, "addBackFrame")
+ add_iframe.click()
+
self.marionette.find_element(By.ID, "iframe1")
-
self.marionette.switch_to_frame(self.marionette.find_element(By.ID,
"iframe1"))
-
- self.marionette.find_element(By.ID, "checkbox")
+ self.marionette.find_element(By.ID, "killIframe")
def test_should_allow_a_user_to_switch_from_an_iframe_back_to_the_main_content_of_the_page(self):
test_iframe = self.marionette.absolute_url("test_iframe.html")
self.marionette.navigate(test_iframe)
self.marionette.switch_to_frame(0)
self.marionette.switch_to_default_content()
header = self.marionette.find_element(By.ID, "iframe_page_heading")
self.assertEqual(header.text, "This is the heading")
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_text.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_text.py
@@ -1,224 +1,23 @@
# 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/.
from marionette_driver.by import By
-from marionette_driver.keys import Keys
-
-from marionette_harness import MarionetteTestCase, skip_if_mobile
+from marionette_harness import MarionetteTestCase
class TestText(MarionetteTestCase):
- def test_getText(self):
+
+ def test_get_text(self):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
l = self.marionette.find_element(By.ID, "mozLink")
self.assertEqual("Click me!", l.text)
- def test_clearText(self):
+ def test_clear_text(self):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
l = self.marionette.find_element(By.NAME, "myInput")
self.assertEqual("asdf", self.marionette.execute_script("return arguments[0].value;", [l]))
l.clear()
self.assertEqual("", self.marionette.execute_script("return arguments[0].value;", [l]))
-
- def test_sendKeys(self):
- test_html = self.marionette.absolute_url("test.html")
- self.marionette.navigate(test_html)
- l = self.marionette.find_element(By.NAME, "myInput")
- self.assertEqual("asdf", self.marionette.execute_script("return arguments[0].value;", [l]))
-
- # Set caret position to the middle of the input text.
- self.marionette.execute_script(
- """var el = arguments[0];
- el.selectionStart = el.selectionEnd = el.value.length / 2;""",
- script_args=[l])
-
- l.send_keys("o")
- self.assertEqual("asodf", self.marionette.execute_script("return arguments[0].value;", [l]))
-
- def test_send_keys_to_type_input(self):
- test_html = self.marionette.absolute_url("html5/test_html_inputs.html")
- self.marionette.navigate(test_html)
- num_input = self.marionette.find_element(By.ID, 'number')
- self.assertEqual("", self.marionette.execute_script("return arguments[0].value", [num_input]))
- num_input.send_keys("1234")
- self.assertEqual('1234', self.marionette.execute_script("return arguments[0].value", [num_input]))
-
- def test_should_fire_key_press_events(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
- self.marionette.navigate(test_html)
- key_reporter = self.marionette.find_element(By.ID, "keyReporter")
- key_reporter.send_keys("a")
-
- result = self.marionette.find_element(By.ID, "result")
- self.assertIn("press:", result.text)
-
- def test_should_fire_key_down_events(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
- self.marionette.navigate(test_html)
- key_reporter = self.marionette.find_element(By.ID, "keyReporter")
- key_reporter.send_keys("a")
-
- result = self.marionette.find_element(By.ID, "result")
- self.assertIn("down:", result.text)
-
- def test_should_fire_key_up_events(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
- self.marionette.navigate(test_html)
- key_reporter = self.marionette.find_element(By.ID, "keyReporter")
- key_reporter.send_keys("a")
-
- result = self.marionette.find_element(By.ID, "result")
- self.assertIn("up:", result.text)
-
- def test_should_type_lowercase_characters(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
- self.marionette.navigate(test_html)
- key_reporter = self.marionette.find_element(By.ID, "keyReporter")
- key_reporter.send_keys("abc def")
-
- self.assertEqual("abc def", key_reporter.get_property("value"))
-
- def test_should_type_uppercase_characters(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
- self.marionette.navigate(test_html)
- key_reporter = self.marionette.find_element(By.ID, "keyReporter")
- key_reporter.send_keys("ABC DEF")
-
- self.assertEqual("ABC DEF", key_reporter.get_property("value"))
-
- def test_should_type_a_quote_characters(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
- self.marionette.navigate(test_html)
- key_reporter = self.marionette.find_element(By.ID, "keyReporter")
- key_reporter.send_keys('"')
-
- self.assertEqual('"', key_reporter.get_property("value"))
-
- def test_should_type_an_at_character(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
- self.marionette.navigate(test_html)
- key_reporter = self.marionette.find_element(By.ID, "keyReporter")
- key_reporter.send_keys('@')
-
- self.assertEqual("@", key_reporter.get_property("value"))
-
- def test_should_type_a_mix_of_upper_and_lower_case_character(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
- self.marionette.navigate(test_html)
- key_reporter = self.marionette.find_element(By.ID, "keyReporter")
- key_reporter.send_keys("me@EXampLe.com")
-
- self.assertEqual("me@EXampLe.com", key_reporter.get_property("value"))
-
- def test_arrow_keys_are_not_printable(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
- self.marionette.navigate(test_html)
- key_reporter = self.marionette.find_element(By.ID, "keyReporter")
- key_reporter.send_keys(Keys.ARROW_LEFT)
-
- self.assertEqual("", key_reporter.get_property("value"))
-
- def test_will_simulate_a_key_up_when_entering_text_into_input_elements(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
- self.marionette.navigate(test_html)
- element = self.marionette.find_element(By.ID, "keyUp")
- element.send_keys("I like cheese")
-
- result = self.marionette.find_element(By.ID, "result")
- self.assertEqual(result.text, "I like cheese")
-
- def test_will_simulate_a_key_down_when_entering_text_into_input_elements(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
- self.marionette.navigate(test_html)
- element = self.marionette.find_element(By.ID, "keyDown")
- element.send_keys("I like cheese")
-
- result = self.marionette.find_element(By.ID, "result")
- # Because the key down gets the result before the input element is
- # filled, we're a letter short here
- self.assertEqual(result.text, "I like chees")
-
- def test_will_simulate_a_key_press_when_entering_text_into_input_elements(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
- self.marionette.navigate(test_html)
- element = self.marionette.find_element(By.ID, "keyPress")
- element.send_keys("I like cheese")
-
- result = self.marionette.find_element(By.ID, "result")
- # Because the key down gets the result before the input element is
- # filled, we're a letter short here
- self.assertEqual(result.text, "I like chees")
-
- def test_will_simulate_a_keyup_when_entering_text_into_textareas(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
- self.marionette.navigate(test_html)
- element = self.marionette.find_element(By.ID, "keyUpArea")
- element.send_keys("I like cheese")
-
- result = self.marionette.find_element(By.ID, "result")
- self.assertEqual(result.text, "I like cheese")
-
- def test_will_simulate_a_keydown_when_entering_text_into_textareas(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
- self.marionette.navigate(test_html)
- element = self.marionette.find_element(By.ID, "keyDownArea")
- element.send_keys("I like cheese")
-
- result = self.marionette.find_element(By.ID, "result")
- # Because the key down gets the result before the input element is
- # filled, we're a letter short here
- self.assertEqual(result.text, "I like chees")
-
- def test_will_simulate_a_keypress_when_entering_text_into_textareas(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
- self.marionette.navigate(test_html)
- element = self.marionette.find_element(By.ID, "keyPressArea")
- element.send_keys("I like cheese")
-
- result = self.marionette.find_element(By.ID, "result")
- # Because the key down gets the result before the input element is
- # filled, we're a letter short here
- self.assertEqual(result.text, "I like chees")
-
- @skip_if_mobile("Bug 1333069 - Assertion: 'down: 40' not found in u''")
- def test_should_report_key_code_of_arrow_keys_up_down_events(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
- self.marionette.navigate(test_html)
- result = self.marionette.find_element(By.ID, "result")
- element = self.marionette.find_element(By.ID, "keyReporter")
- element.send_keys(Keys.ARROW_DOWN)
- self.assertIn("down: 40", result.text.strip())
- self.assertIn("up: 40", result.text.strip())
-
- element.send_keys(Keys.ARROW_UP)
- self.assertIn("down: 38", result.text.strip())
- self.assertIn("up: 38", result.text.strip())
-
- element.send_keys(Keys.ARROW_LEFT)
- self.assertIn("down: 37", result.text.strip())
- self.assertIn("up: 37", result.text.strip())
-
- element.send_keys(Keys.ARROW_RIGHT)
- self.assertIn("down: 39", result.text.strip())
- self.assertIn("up: 39", result.text.strip())
-
- # And leave no rubbish/printable keys in the "keyReporter"
- self.assertEqual("", element.get_property("value"))
-
- def testNumericNonShiftKeys(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
- self.marionette.navigate(test_html)
- element = self.marionette.find_element(By.ID, "keyReporter")
- numericLineCharsNonShifted = "`1234567890-=[]\\,.'/42"
- element.send_keys(numericLineCharsNonShifted)
- self.assertEqual(numericLineCharsNonShifted, element.get_property("value"))
-
- def testShouldTypeAnInteger(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
- self.marionette.navigate(test_html)
- element = self.marionette.find_element(By.ID, "keyReporter")
- element.send_keys(1234)
- self.assertEqual("1234", element.get_property("value"))
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_typing.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_typing.py
@@ -30,197 +30,197 @@ class TestTypingChrome(TypingTestCase):
def setUp(self):
super(TestTypingChrome, self).setUp()
self.marionette.set_context("chrome")
@skip_if_mobile("Interacting with chrome elements not available for Fennec")
def test_cut_and_paste_shortcuts(self):
with self.marionette.using_context("content"):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
- keyReporter = self.marionette.find_element(By.ID, "keyReporter")
- self.assertEqual("", keyReporter.get_property("value"))
- keyReporter.send_keys("zyxwvutsr")
- self.assertEqual("zyxwvutsr", keyReporter.get_property("value"))
+ key_reporter = self.marionette.find_element(By.ID, "keyReporter")
+ self.assertEqual("", key_reporter.get_property("value"))
+ key_reporter.send_keys("zyxwvutsr")
+ self.assertEqual("zyxwvutsr", key_reporter.get_property("value"))
# select all and cut
- keyReporter.send_keys(self.mod_key, "a")
- keyReporter.send_keys(self.mod_key, "x")
- self.assertEqual("", keyReporter.get_property("value"))
+ key_reporter.send_keys(self.mod_key, "a")
+ key_reporter.send_keys(self.mod_key, "x")
+ self.assertEqual("", key_reporter.get_property("value"))
url_bar = self.marionette.find_element(By.ID, "urlbar")
# Clear contents first
url_bar.send_keys(self.mod_key, "a")
url_bar.send_keys(Keys.BACK_SPACE)
self.assertEqual("", url_bar.get_attribute("value"))
url_bar.send_keys(self.mod_key, "v")
self.assertEqual("zyxwvutsr", url_bar.get_property("value"))
class TestTypingContent(TypingTestCase):
- def testShouldFireKeyPressEvents(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_should_fire_key_press_events(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
- keyReporter = self.marionette.find_element(By.ID, "keyReporter")
- keyReporter.send_keys("a")
+ key_reporter = self.marionette.find_element(By.ID, "keyReporter")
+ key_reporter.send_keys("a")
result = self.marionette.find_element(By.ID, "result")
self.assertTrue("press:" in result.text)
- def testShouldFireKeyDownEvents(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_should_fire_key_down_events(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
- keyReporter = self.marionette.find_element(By.ID, "keyReporter")
- keyReporter.send_keys("I")
+ key_reporter = self.marionette.find_element(By.ID, "keyReporter")
+ key_reporter.send_keys("I")
result = self.marionette.find_element(By.ID, "result")
self.assertTrue("down" in result.text)
- def testShouldFireKeyUpEvents(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_should_fire_key_up_events(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
- keyReporter = self.marionette.find_element(By.ID, "keyReporter")
- keyReporter.send_keys("a")
+ key_reporter = self.marionette.find_element(By.ID, "keyReporter")
+ key_reporter.send_keys("a")
result = self.marionette.find_element(By.ID, "result")
self.assertTrue("up:" in result.text)
- def testShouldTypeLowerCaseLetters(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_should_type_lowercase_characters(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
- keyReporter = self.marionette.find_element(By.ID, "keyReporter")
- keyReporter.send_keys("abc def")
- self.assertEqual("abc def", keyReporter.get_property("value"))
+ key_reporter = self.marionette.find_element(By.ID, "keyReporter")
+ key_reporter.send_keys("abc def")
+ self.assertEqual("abc def", key_reporter.get_property("value"))
- def testShouldBeAbleToTypeCapitalLetters(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_should_type_uppercase_characters(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
- keyReporter = self.marionette.find_element(By.ID, "keyReporter")
- keyReporter.send_keys("ABC DEF")
- self.assertEqual("ABC DEF", keyReporter.get_property("value"))
+ key_reporter = self.marionette.find_element(By.ID, "keyReporter")
+ key_reporter.send_keys("ABC DEF")
+ self.assertEqual("ABC DEF", key_reporter.get_property("value"))
- def testCutAndPasteShortcuts(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_cut_and_paste_shortcuts(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
- keyReporter = self.marionette.find_element(By.ID, "keyReporter")
- self.assertEqual("", keyReporter.get_property("value"))
- keyReporter.send_keys("zyxwvutsr")
- self.assertEqual("zyxwvutsr", keyReporter.get_property("value"))
+ key_reporter = self.marionette.find_element(By.ID, "keyReporter")
+ self.assertEqual("", key_reporter.get_property("value"))
+ key_reporter.send_keys("zyxwvutsr")
+ self.assertEqual("zyxwvutsr", key_reporter.get_property("value"))
# select all and cut
- keyReporter.send_keys(self.mod_key, "a")
- keyReporter.send_keys(self.mod_key, "x")
- self.assertEqual("", keyReporter.get_property("value"))
+ key_reporter.send_keys(self.mod_key, "a")
+ key_reporter.send_keys(self.mod_key, "x")
+ self.assertEqual("", key_reporter.get_property("value"))
- keyReporter.send_keys(self.mod_key, "v")
- self.assertEqual("zyxwvutsr", keyReporter.get_property("value"))
+ key_reporter.send_keys(self.mod_key, "v")
+ self.assertEqual("zyxwvutsr", key_reporter.get_property("value"))
- def testShouldBeAbleToTypeQuoteMarks(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_should_type_a_quote_characters(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
- keyReporter = self.marionette.find_element(By.ID, "keyReporter")
- keyReporter.send_keys("\"")
- self.assertEqual("\"", keyReporter.get_property("value"))
+ key_reporter = self.marionette.find_element(By.ID, "keyReporter")
+ key_reporter.send_keys("\"")
+ self.assertEqual("\"", key_reporter.get_property("value"))
- def testShouldBeAbleToTypeTheAtCharacter(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_should_type_an_at_character(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
- keyReporter = self.marionette.find_element(By.ID, "keyReporter")
- keyReporter.send_keys("@")
- self.assertEqual("@", keyReporter.get_property("value"))
+ key_reporter = self.marionette.find_element(By.ID, "keyReporter")
+ key_reporter.send_keys("@")
+ self.assertEqual("@", key_reporter.get_property("value"))
- def testShouldBeAbleToMixUpperAndLowerCaseLetters(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_should_type_a_mix_of_upper_and_lower_case_character(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
- keyReporter = self.marionette.find_element(By.ID, "keyReporter")
- keyReporter.send_keys("me@eXample.com")
- self.assertEqual("me@eXample.com", keyReporter.get_property("value"))
+ key_reporter = self.marionette.find_element(By.ID, "keyReporter")
+ key_reporter.send_keys("me@eXample.com")
+ self.assertEqual("me@eXample.com", key_reporter.get_property("value"))
- def testArrowKeysShouldNotBePrintable(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_arrow_keys_are_not_printable(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
- keyReporter = self.marionette.find_element(By.ID, "keyReporter")
- keyReporter.send_keys(Keys.ARROW_LEFT)
- self.assertEqual("", keyReporter.get_property("value"))
+ key_reporter = self.marionette.find_element(By.ID, "keyReporter")
+ key_reporter.send_keys(Keys.ARROW_LEFT)
+ self.assertEqual("", key_reporter.get_property("value"))
- def testWillSimulateAKeyUpWhenEnteringTextIntoInputElements(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_will_simulate_a_key_up_when_entering_text_into_input_elements(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
element = self.marionette.find_element(By.ID, "keyUp")
element.send_keys("I like cheese")
result = self.marionette.find_element(By.ID, "result")
self.assertEqual(result.text, "I like cheese")
- def testWillSimulateAKeyDownWhenEnteringTextIntoInputElements(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_will_simulate_a_key_down_when_entering_text_into_input_elements(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
element = self.marionette.find_element(By.ID, "keyDown")
element.send_keys("I like cheese")
result = self.marionette.find_element(By.ID, "result")
# Because the key down gets the result before the input element is
# filled, we're a letter short here
self.assertEqual(result.text, "I like chees")
- def testWillSimulateAKeyPressWhenEnteringTextIntoInputElements(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_will_simulate_a_key_press_when_entering_text_into_input_elements(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
element = self.marionette.find_element(By.ID, "keyPress")
element.send_keys("I like cheese")
result = self.marionette.find_element(By.ID, "result")
# Because the key down gets the result before the input element is
# filled, we're a letter short here
self.assertEqual(result.text, "I like chees")
- def testWillSimulateAKeyUpWhenEnteringTextIntoTextAreas(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_will_simulate_a_keyup_when_entering_text_into_textareas(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
element = self.marionette.find_element(By.ID, "keyUpArea")
element.send_keys("I like cheese")
result = self.marionette.find_element(By.ID, "result")
self.assertEqual("I like cheese", result.text)
- def testWillSimulateAKeyDownWhenEnteringTextIntoTextAreas(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_will_simulate_a_keydown_when_entering_text_into_textareas(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
element = self.marionette.find_element(By.ID, "keyDownArea")
element.send_keys("I like cheese")
result = self.marionette.find_element(By.ID, "result")
# Because the key down gets the result before the input element is
# filled, we're a letter short here
self.assertEqual(result.text, "I like chees")
- def testWillSimulateAKeyPressWhenEnteringTextIntoTextAreas(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_will_simulate_a_keypress_when_entering_text_into_textareas(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
element = self.marionette.find_element(By.ID, "keyPressArea")
element.send_keys("I like cheese")
result = self.marionette.find_element(By.ID, "result")
# Because the key down gets the result before the input element is
# filled, we're a letter short here
self.assertEqual(result.text, "I like chees")
- @skip_if_mobile("Bug 1324752 - Arrow keys cannot be sent in Fennec")
- def testShouldReportKeyCodeOfArrowKeysUpDownEvents(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ @skip_if_mobile("Bug 1333069 - Assertion: 'down: 40' not found in u''")
+ def test_should_report_key_code_of_arrow_keys_up_down_events(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
result = self.marionette.find_element(By.ID, "result")
element = self.marionette.find_element(By.ID, "keyReporter")
element.send_keys(Keys.ARROW_DOWN)
self.assertIn("down: 40", result.text.strip())
@@ -237,96 +237,133 @@ class TestTypingContent(TypingTestCase):
element.send_keys(Keys.ARROW_RIGHT)
self.assertIn("down: 39", result.text.strip())
self.assertIn("up: 39", result.text.strip())
# And leave no rubbish/printable keys in the "keyReporter"
self.assertEqual("", element.get_property("value"))
@skip("Reenable in Bug 1068728")
- def testNumericShiftKeys(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_numeric_shift_keys(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
result = self.marionette.find_element(By.ID, "result")
element = self.marionette.find_element(By.ID, "keyReporter")
- numericShiftsEtc = "~!@#$%^&*()_+{}:i\"<>?|END~"
- element.send_keys(numericShiftsEtc)
- self.assertEqual(numericShiftsEtc, element.get_property("value"))
+ numeric_shifts_etc = "~!@#$%^&*()_+{}:i\"<>?|END~"
+ element.send_keys(numeric_shifts_etc)
+ self.assertEqual(numeric_shifts_etc, element.get_property("value"))
self.assertIn(" up: 16", result.text.strip())
- def testLowerCaseAlphaKeys(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_numeric_non_shift_keys(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
+ self.marionette.navigate(test_html)
+ element = self.marionette.find_element(By.ID, "keyReporter")
+ numeric_line_chars_non_shifted = "`1234567890-=[]\\,.'/42"
+ element.send_keys(numeric_line_chars_non_shifted)
+ self.assertEqual(numeric_line_chars_non_shifted, element.get_property("value"))
+
+ def test_lowercase_alpha_keys(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
element = self.marionette.find_element(By.ID, "keyReporter")
- lowerAlphas = "abcdefghijklmnopqrstuvwxyz"
- element.send_keys(lowerAlphas)
- self.assertEqual(lowerAlphas, element.get_property("value"))
+ lower_alphas = "abcdefghijklmnopqrstuvwxyz"
+ element.send_keys(lower_alphas)
+ self.assertEqual(lower_alphas, element.get_property("value"))
@skip("Reenable in Bug 1068735")
- def testUppercaseAlphaKeys(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_uppercase_alpha_keys(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
result = self.marionette.find_element(By.ID, "result")
element = self.marionette.find_element(By.ID, "keyReporter")
- upperAlphas = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- element.send_keys(upperAlphas)
- self.assertEqual(upperAlphas, element.get_property("value"))
+ upper_alphas = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ element.send_keys(upper_alphas)
+ self.assertEqual(upper_alphas, element.get_property("value"))
self.assertIn(" up: 16", result.text.strip())
@skip("Reenable in Bug 1068726")
- def testAllPrintableKeys(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_all_printable_keys(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
result = self.marionette.find_element(By.ID, "result")
element = self.marionette.find_element(By.ID, "keyReporter")
- allPrintable = "!\"#$%&'()*+,-./0123456789:<=>?@ ABCDEFGHIJKLMNOPQRSTUVWXYZ [\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
- element.send_keys(allPrintable)
+ all_printable = ("!\"#$%&'()*+,-./0123456789:<=>?@ "
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ [\\]^_`"
+ "abcdefghijklmnopqrstuvwxyz{|}~")
+ element.send_keys(all_printable)
- self.assertTrue(allPrintable, element.get_property("value"))
+ self.assertTrue(all_printable, element.get_property("value"))
self.assertIn(" up: 16", result.text.strip())
@skip("Reenable in Bug 1068733")
- def testSpecialSpaceKeys(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_special_space_keys(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
element = self.marionette.find_element(By.ID, "keyReporter")
element.send_keys("abcd" + Keys.SPACE + "fgh" + Keys.SPACE + "ij")
self.assertEqual("abcd fgh ij", element.get_property("value"))
- def testShouldTypeAnInteger(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_should_type_an_integer(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
element = self.marionette.find_element(By.ID, "keyReporter")
element.send_keys(1234)
self.assertEqual("1234", element.get_property("value"))
- def testShouldSendKeysToElementsWithoutTheValueAttribute(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ def test_should_send_keys_to_elements_without_the_value_attribute(self):
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
# If we don't get an error below we are good
self.marionette.find_element(By.TAG_NAME, "body").send_keys("foo")
def test_not_interactable_if_hidden(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)
+
not_displayed = self.marionette.find_element(By.ID, "notDisplayed")
self.assertRaises(ElementNotInteractableException, not_displayed.send_keys, "foo")
def test_appends_to_input_text(self):
self.marionette.navigate(inline("<input>"))
el = self.marionette.find_element(By.TAG_NAME, "input")
el.send_keys("foo")
el.send_keys("bar")
self.assertEqual("foobar", el.get_property("value"))
def test_appends_to_textarea(self):
self.marionette.navigate(inline("<textarea></textarea>"))
textarea = self.marionette.find_element(By.TAG_NAME, "textarea")
textarea.send_keys("foo")
textarea.send_keys("bar")
self.assertEqual("foobar", textarea.get_property("value"))
+
+ def test_send_keys_to_type_input(self):
+ test_html = self.marionette.absolute_url("html5/test_html_inputs.html")
+ self.marionette.navigate(test_html)
+
+ num_input = self.marionette.find_element(By.ID, 'number')
+ self.assertEqual("",
+ self.marionette.execute_script("return arguments[0].value", [num_input]))
+ num_input.send_keys("1234")
+ self.assertEqual('1234',
+ self.marionette.execute_script("return arguments[0].value", [num_input]))
+
+ def test_insert_keys(self):
+ l = self.marionette.find_element(By.ID, "change")
+ l.send_keys("abde")
+ self.assertEqual("abde", self.marionette.execute_script("return arguments[0].value;", [l]))
+
+ # Set caret position to the middle of the input text.
+ self.marionette.execute_script(
+ """var el = arguments[0];
+ el.selectionStart = el.selectionEnd = el.value.length / 2;""",
+ script_args=[l])
+
+ l.send_keys("c")
+ self.assertEqual("abcde",
+ self.marionette.execute_script("return arguments[0].value;", [l]))
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_visibility.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_visibility.py
@@ -5,51 +5,51 @@
from marionette_driver.by import By
from marionette_harness import MarionetteTestCase
class TestVisibility(MarionetteTestCase):
def testShouldAllowTheUserToTellIfAnElementIsDisplayedOrNot(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ test_html = self.marionette.absolute_url("visibility.html")
self.marionette.navigate(test_html)
self.assertTrue(self.marionette.find_element(By.ID, "displayed").is_displayed())
self.assertFalse(self.marionette.find_element(By.ID, "none").is_displayed())
self.assertFalse(self.marionette.find_element(By.ID,
- "suppressedParagraph").is_displayed())
+ "suppressedParagraph").is_displayed())
self.assertFalse(self.marionette.find_element(By.ID, "hidden").is_displayed())
def testVisibilityShouldTakeIntoAccountParentVisibility(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ test_html = self.marionette.absolute_url("visibility.html")
self.marionette.navigate(test_html)
childDiv = self.marionette.find_element(By.ID, "hiddenchild")
hiddenLink = self.marionette.find_element(By.ID, "hiddenlink")
self.assertFalse(childDiv.is_displayed())
self.assertFalse(hiddenLink.is_displayed())
def testShouldCountElementsAsVisibleIfStylePropertyHasBeenSet(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ test_html = self.marionette.absolute_url("visibility.html")
self.marionette.navigate(test_html)
shown = self.marionette.find_element(By.ID, "visibleSubElement")
self.assertTrue(shown.is_displayed())
def testShouldModifyTheVisibilityOfAnElementDynamically(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ test_html = self.marionette.absolute_url("visibility.html")
self.marionette.navigate(test_html)
element = self.marionette.find_element(By.ID, "hideMe")
self.assertTrue(element.is_displayed())
element.click()
self.assertFalse(element.is_displayed())
def testHiddenInputElementsAreNeverVisible(self):
- test_html = self.marionette.absolute_url("javascriptPage.html")
+ test_html = self.marionette.absolute_url("visibility.html")
self.marionette.navigate(test_html)
shown = self.marionette.find_element(By.NAME, "hidden")
self.assertFalse(shown.is_displayed())
def testShouldSayElementsWithNegativeTransformAreNotDisplayed(self):
test_html = self.marionette.absolute_url("cssTransform.html")
--- a/testing/marionette/harness/marionette_harness/www/deletingFrame.html
+++ b/testing/marionette/harness/marionette_harness/www/deletingFrame.html
@@ -4,26 +4,26 @@
</head>
<script type="text/javascript">
function remove() {
var iframe = document.getElementById("iframe1");
var myDiv = document.getElementById("myDiv");
myDiv.removeChild(iframe);
}
function addBack() {
- var iframe = '<iframe src="javascriptPage.html" marginheight="0" marginwidth="0" topmargin="0" leftmargin="600" allowtransparency="true" frameborder="0" height="600" scrolling="no" width="120" id="iframe1"></iframe>';
+ var iframe = '<iframe src="formPage.html" marginheight="0" marginwidth="0" topmargin="0" leftmargin="600" allowtransparency="true" frameborder="0" height="600" scrolling="no" width="120" id="iframe1"></iframe>';
var myDiv2 = document.getElementById("myDiv2");
myDiv2.innerHTML = iframe;
}
</script>
<body>
<div id='myDiv'>
<iframe src="formPage.html" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" allowtransparency="true"
frameborder="1" height="900" scrolling="no" width="500" id="iframe1"></iframe>
-
+
</div>
<div id='myDiv2'>
</div>
<input type='button' id='addBackFrame' value='Add back frame' onclick='addBack();' />
</body>
</html>
rename from testing/marionette/harness/marionette_harness/www/javascriptPage.html
rename to testing/marionette/harness/marionette_harness/www/keyboard.html
--- a/testing/marionette/harness/marionette_harness/www/javascriptPage.html
+++ b/testing/marionette/harness/marionette_harness/www/keyboard.html
@@ -1,99 +1,76 @@
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- 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/. -->
-<head>
- <title>Testing Javascript</title>
- <script type="text/javascript">
- var seen = {};
-
- function updateContent(input) {
- document.getElementById('result').innerHTML = "<p>" + input.value + "</p>";
- }
- function displayMessage(message) {
- document.getElementById('result').innerHTML = "<p>" + message + "</p>";
- }
+<head>
+ <title>Testing Javascript</title>
+ <script type="text/javascript">
+ var seen = {};
- function appendMessage(message) {
- document.getElementById('result').innerHTML += message + " ";
- }
-
- function register(message) {
- if (!seen[message]) {
- appendMessage(message);
- seen[message] = true;
- }
- }
+ function updateResult(event) {
+ document.getElementById('result').innerText = event.target.value;
+ }
- function delayedShowHide(delay, show) {
- var blackBox = document.getElementById('clickToHide');
- window.setTimeout(function() {
- blackBox.style.display = show ? '' : 'none';
- }, delay);
- }
- </script>
- <script type="text/javascript">
- var startList = function() {
- // Ugh. Let's hope no-one is faking their user agent when running the tests
- if (navigator.userAgent.indexOf("MSIE") != -1) {
- var navRoot = document.getElementById("nav");
- for (var i = 0; i < navRoot.childNodes.length; i++) {
- var node = navRoot.childNodes[i];
- if (node.nodeName == "LI") {
- node.onmouseover = function() {
- this.className += " over";
- };
- node.onmouseout = function() {
- this.className = this.className.replace(" over", "");
- };
- }
- }
- }
- };
- window.onload=startList;
- </script>
- <style type="text/css">
- #nav {
- padding: 0; margin: 0; list-style: none;
- }
- #nav li {
- float: left; position: relative; width: 10em;
- }
- #nav li ul {
- display: none; position: absolute; top: 1em; left: 0;
- }
- #nav li > ul { top: auto; left: auto; }
- #nav li:hover ul, #nav li.over ul{ display: block; background: white; }
- </style>
+ function displayMessage(message) {
+ document.getElementById('result').innerText = message;
+ }
+
+ function appendMessage(message) {
+ document.getElementById('result').innerText += " " + message + " ";
+ }
+ </script>
</head>
+
<body>
<h1>Type Stuff</h1>
-<div>
- <ul id="nav">
- <li id="menu1">Menu 1
- <ul>
- <li id="item1" onclick="displayMessage('item 1');">Item 1</li>
- <li>Item 2</li>
- </ul>
- </li>
- </ul>
+<div id="resultContainer">
+ Result: <p id="result"></p>
</div>
-<div id="resultContainer" height="30">
- <div id="result" style="width:300;height:60">
- <p> </p>
- </div>
+<div>
+ <form action="#">
+ <p>
+ <label>keyDown: <input type="text" id="keyDown" onkeydown="updateResult(event)"/></label>
+ <label>keyPress: <input type="text" id="keyPress" onkeypress="updateResult(event)"/></label>
+ <label>keyUp: <input type="text" id="keyUp" onkeyup="updateResult(event)"/></label>
+ <label>change: <input type="text" id="change" onchange="updateResult(event)"/></label>
+ </p>
+ <p>
+ <label>change:
+ <input type="checkbox" id="checkbox" value="checkbox thing" onchange="updateResult(event)"/>
+ </label>
+ </p>
+ <p>
+ <label>keyDown:
+ <textarea id="keyDownArea" onkeydown="updateResult(event)" rows="2" cols="15"></textarea>
+ </label>
+ <label>keyPress:
+ <textarea id="keyPressArea" onkeypress="updateResult(event)" rows="2" cols="15"></textarea>
+ </label>
+ <label>keyUp:
+ <textarea id="keyUpArea" onkeyup="updateResult(event)" rows="2" cols="15"></textarea>
+ </label>
+ </p>
+ <p>
+ <select id="selector" onchange="updateResult(event)">
+ <option value="foo">Foo</option>
+ <option value="bar">Bar</option>
+ </select>
+ </p>
+ <p>
+ <label>hidden: <input type="text" id="notDisplayed" style="display: none"></label>
+ </p>
+ </form>
+</div>
-</div>
-
<div id="formageddon">
<form action="#">
Key Up: <input type="text" id="keyUp" onkeyup="javascript:updateContent(this)"/><br/>
Key Down: <input type="text" id="keyDown" onkeydown="javascript:updateContent(this)"/><br/>
Key Press: <input type="text" id="keyPress" onkeypress="javascript:updateContent(this)"/><br/>
Change: <input type="text" id="change" onkeypress="javascript:displayMessage('change')"/><br/>
<textarea id="keyDownArea" onkeydown="javascript:updateContent(this)" rows="2" cols="15"></textarea>
<textarea id="keyPressArea" onkeypress="javascript:updateContent(this)" rows="2" cols="15"></textarea>
@@ -101,178 +78,24 @@
<select id="selector" onchange="javascript:updateContent(this)">
<option value="foo">Foo</option>
<option value="bar">Bar</option>
</select>
<input type="checkbox" id="checkbox" value="checkbox thing" onchange="javascript:updateContent(this)"/>
<input id="clickField" type="text" onclick="document.getElementById('clickField').value='Clicked';" value="Hello"/>
<input id="doubleClickField" type="text" onclick="document.getElementById('doubleClickField').value='Clicked';" ondblclick="document.getElementById('doubleClickField').value='DoubleClicked';" oncontextmenu="document.getElementById('doubleClickField').value='ContextClicked'; return false;" value="DoubleHello"/>
<input id="clearMe" value="Something" onchange="displayMessage('Cleared')"/>
+ <input type="text" id="notDisplayed" style="display: none">
</form>
</div>
<div>
- <p><a href="#" onclick="javascript:document.title='Changed'">Change the page title!</a></p>
-
- <p><a onclick="javascript:document.title='Changed'" id="nohref">No href</a></p>
-
- <p><a id="updatediv" href="#" onclick="javascript:document.getElementById('dynamo').innerHTML = 'Fish and chips!';">Update a
- div</a></p>
-</div>
-
-<div id="dynamo">What's for dinner?</div>
-
-<div id="mousedown" onmousedown="javascript:displayMessage('mouse down');">
- <p>Click for the mouse down event</p>
- <span><p id="child">Here's some text</p></span>
-</div>
-
-<div id="mouseup" onmouseup="javascript:displayMessage('mouse up');">
- <p>Click for the mouse up event</p>
-</div>
-
-<div id="mouseclick" onclick="javascript:displayMessage('mouse click');">
- <p>Click for the mouse click event</p>
-</div>
-
-<div id="mousebutton">
- <p>Click to show button</p>
-</div>
-
-<div id="error" onclick="document.getElementById('doesnotexist').innerHTML = 'cheese';">
- Clicking this causes a JS exception in the click handler
-</div>
-
-<div>
- <form action="resultPage.html" id="on-form">
- <input id="theworks"
- onfocus="appendMessage('focus')"
- onkeydown="appendMessage('keydown')"
- onkeypress="appendMessage('keypress')"
- onkeyup="appendMessage('keyup')"
- onblur="appendMessage('blur')"
- onchange="appendMessage('change')"
- />
-
- <input id="changeable" name="changeable" onfocus="appendMessage('focus')" onchange="appendMessage('change')" onblur="appendMessage('blur')"/>
-
- <button type="button" id="plainButton"
- onfocus="appendMessage('focus')"
- onkeydown="appendMessage('keydown')"
- onkeypress="appendMessage('keypress')"
- onkeyup="appendMessage('keyup')"
- onblur="appendMessage('blur')"
- onclick="appendMessage('click')"
- onmousedown="appendMessage('mousedown ')"
- onmouseup="appendMessage('mouseup ')"
- onmouseover="register('mouseover ')"
- onmousemove="register('mousemove ')"
- >
- <b>Go somewhere</b>
- </button>
- <button type="submit" id="submittingButton"><emph>submit</emph></button>
- <button type="button" id="jsSubmitButton" onclick="javascript:document.getElementById('on-form').submit();">Submitomatic</button>
-
- <button type="button" id="switchFocus" onclick="document.getElementById('theworks').focus();">Switch focus</button>
- <button type="button" onclick="var element = document.getElementById('switchFocus'); var clickEvent = document.createEvent('MouseEvents'); clickEvent.initMouseEvent('click', true, true, null, 0, 0, 0, 0, 0,false, false, false, false, 0, element);element.dispatchEvent(clickEvent);">Do magic</button><br/>
- <label id="labelForCheckbox" for="labeledCheckbox" onclick="appendMessage('labelclick')">Toggle checkbox</label><input type="checkbox" id="labeledCheckbox" onclick="appendMessage('chboxclick')"/>
- </form>
-
- <form action="javascriptPage.html" id="submitListeningForm" onsubmit="appendMessage('form-onsubmit '); return false;">
- <p>
- <input id="submitListeningForm-text" type="text" onsubmit="appendMessage('text-onsubmit ')" onclick="appendMessage('text-onclick ');" />
- <input id="submitListeningForm-submit" type="submit" onsubmit="appendMessage('submit-onsubmit ')" onclick="appendMessage('submit-onclick ');" />
- </p>
- </form>
-</div>
-
-<p id="suppressedParagraph" style="display: none">A paragraph suppressed using CSS display=none</p>
-
-<div>
- <p id="displayed">Displayed</p>
-
- <form action="#"><input type="hidden" name="hidden" /> </form>
-
- <p id="none" style="display: none;">Display set to none</p>
-
- <p id="hidden" style="visibility: hidden;">Hidden</p>
-
- <div id="hiddenparent" style="height: 2em; display: none;">
- <div id="hiddenchild">
- <a href="#" id="hiddenlink">ok</a>
- </div>
- </div>
-
- <div style="visibility: hidden;">
- <span>
- <input id="unclickable" />
- <input type="checkbox" id="untogglable" checked="checked" />Check box you can't see
- </span>
- </div>
-
- <p id="outer" style="visibility: hidden">A <b id="visibleSubElement" style="visibility: visible">sub-element that is explicitly visible</b> using CSS visibility=visible</p>
-</div>
-
-<div>
<form>
<input type="text" id="keyReporter" size="80"
onkeyup="appendMessage('up: ' + event.keyCode)"
onkeypress="appendMessage('press: ' + event.keyCode)"
onkeydown="displayMessage(''); appendMessage('down: ' + event.keyCode)" />
<input name="suppress" onkeydown="if (event.preventDefault) event.preventDefault(); event.returnValue = false; return false;" onkeypress="appendMessage('press');"/>
</form>
</div>
-<!-- Used for testing styles -->
-<div style="background-color: green;" id="green-parent">
- <p id="style1">This should be greenish</p>
- <ul>
- <li id="green-item">So should this</li>
- <li id="red-item" style="background-color: red;">But this is red</li>
- </ul>
-</div>
-
-<a href="#" id="close" onclick="window.close();">Close window</a>
-
-<div id="delete" onclick="var d = document.getElementById('deleted'); this.removeChild(d);">
- <p id="deleted">I should be deleted when you click my containing div</p>
- <p>Whereas, I should not</p>
-</div>
-
-<div>
- <span id="hideMe" onclick="this.style.display = 'none';">Click to hide me.</span>
-</div>
-
-<div style="margin-top: 10px;">
- Click actions delayed by 3000ms:
- <div id="clickToShow" onclick="delayedShowHide(3000, true);"
- style="float: left;width: 100px;height:100px;border: 1px solid black;">
- Click to show black box
- </div>
- <div id="clickToHide" onclick="delayedShowHide(3000, false);"
- style="float: left;width: 100px;height:100px;border: 1px solid black;
- background-color: black; color: white; display: none;">
- Click to hide black box
- </div>
- <div style="clear: both"></div>
-</div>
-
-<a id="new_window" onmouseup="window.open('closeable_window.html', 'close_me')" href="#">Click me to open a new window</a>
-
-<a id="throwing-mouseover" onmouseover="throw new Error()" href="#throwing-mouseover">Mouse over me will throw a JS error</a>
-
-<div id="parent">
- <span id="movable" onmouseover="var p = document.getElementById('movable'); displayMessage('parent matches? ' + (p != event.relatedTarget));">
- Click on me to show the related target
- </span>
-</div>
-
-<div id="zero" style="width:0;height:0">
- <div>
- <img src="map.png">
- </div>
-</div>
-
-<input type='text' id='notDisplayed' style='display:none'>
</body>
</html>
-
-
new file mode 100644
--- /dev/null
+++ b/testing/marionette/harness/marionette_harness/www/visibility.html
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <!-- 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/. -->
+<head>
+ <title>Testing Visibility</title>
+</head>
+
+<body>
+
+<div>
+ <span id="hideMe" onclick="this.style.display = 'none';">Click to hide me.</span>
+</div>
+
+<div id="zero" style="width:0;height:0">
+ <div>
+ <img src="map.png">
+ </div>
+</div>
+
+<p id="suppressedParagraph" style="display: none">A paragraph suppressed using CSS display=none</p>
+
+<div>
+ <p id="displayed">Displayed</p>
+
+ <form action="#"><input type="hidden" name="hidden" /> </form>
+
+ <p id="none" style="display: none;">Display set to none</p>
+
+ <p id="hidden" style="visibility: hidden;">Hidden</p>
+
+ <div id="hiddenparent" style="height: 2em; display: none;">
+ <div id="hiddenchild">
+ <a href="#" id="hiddenlink">ok</a>
+ </div>
+ </div>
+
+ <div style="visibility: hidden;">
+ <span>
+ <input id="unclickable" />
+ <input type="checkbox" id="untogglable" checked="checked" />Check box you can't see
+ </span>
+ </div>
+
+ <p id="outer" style="visibility: hidden">A <b id="visibleSubElement" style="visibility: visible">sub-element that is explicitly visible</b> using CSS visibility=visible</p>
+</div>
+
+<input type='text' id='notDisplayed' style='display:none'>
+</body>
+</html>
+
+
--- a/testing/marionette/harness/marionette_harness/www/xhtmlTest.html
+++ b/testing/marionette/harness/marionette_harness/www/xhtmlTest.html
@@ -6,17 +6,17 @@
<head>
<title>XHTML Test Page</title>
</head>
<body>
<div class="navigation">
<p><a href="resultPage.html" target="result" name="windowOne">Open new window</a></p>
<p><a href="iframes.html" target="_blank" name="windowTwo">Create a new anonymous window</a></p>
<p><a href="test_iframe.html" name="sameWindow">Open page with iframes in same window</a></p>
- <p><a href="javascriptPage.html" target="result" name="windowThree">Open a window with a close button</a></p>
+ <p><a href="test.html" target="result" name="windowThree">Open a window with a close button</a></p>
</div>
<a name="notext"><b></b></a>
<div class="content">
<h1 class="header">XHTML Might Be The Future</h1>
<p>If you'd like to go elsewhere then <a href="resultPage.html">click me</a>.</p>