mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Backed out 1 changesets (bug 1203074) for marionette test failures
Backed out changeset 0e4476d49a82 (bug 1203074)
This commit is contained in:
parent
2c42ac7941
commit
3550bd37cb
@ -2,18 +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/.
|
||||
|
||||
import urllib
|
||||
|
||||
from marionette.marionette_test import MarionetteTestCase, skip_if_b2g
|
||||
from marionette_driver.keys import Keys
|
||||
from marionette_driver.errors import ElementNotVisibleException
|
||||
|
||||
|
||||
def inline(doc):
|
||||
return "data:text/html;charset=utf-8,%s" % urllib.quote(doc)
|
||||
|
||||
|
||||
class TestTyping(MarionetteTestCase):
|
||||
|
||||
def testShouldFireKeyPressEvents(self):
|
||||
test_html = self.marionette.absolute_url("javascriptPage.html")
|
||||
self.marionette.navigate(test_html)
|
||||
@ -285,17 +280,3 @@ class TestTyping(MarionetteTestCase):
|
||||
self.marionette.navigate(test_html)
|
||||
not_displayed = self.marionette.find_element('id', 'notDisplayed')
|
||||
self.assertRaises(ElementNotVisibleException, not_displayed.send_keys, 'foo')
|
||||
|
||||
def test_appends_to_input_text(self):
|
||||
self.marionette.navigate(inline("<input>"))
|
||||
el = self.marionette.find_element("tag name", "input")
|
||||
el.send_keys("foo")
|
||||
el.send_keys("bar")
|
||||
self.assertEqual("foobar", el.get_attribute("value"))
|
||||
|
||||
def test_appends_to_textarea(self):
|
||||
self.marionette.navigate(inline("<textarea></textarea>"))
|
||||
textarea = self.marionette.find_element("tag name", "textarea")
|
||||
textarea.send_keys("foo")
|
||||
textarea.send_keys("bar")
|
||||
self.assertEqual("foobar", textarea.get_attribute("value"))
|
||||
|
@ -126,26 +126,9 @@ function sendSingleKey (keyToSend, modifiers, document) {
|
||||
utils.synthesizeKey(keyCode, modifiers, document);
|
||||
}
|
||||
|
||||
/**
|
||||
* Focus element and, if a textual input field, move the caret to the
|
||||
* end of the input field.
|
||||
*
|
||||
* @param {Element} el
|
||||
* Element to focus.
|
||||
*/
|
||||
function focusElement(el) {
|
||||
let t = el.type;
|
||||
if (t && (t == "text" || t == "textarea")) {
|
||||
let len = el.value.length;
|
||||
el.setSelectionRange(len, len);
|
||||
}
|
||||
el.focus();
|
||||
}
|
||||
|
||||
function sendKeysToElement(document, element, keysToSend, successCallback, errorCallback, command_id, ignoreVisibility) {
|
||||
function sendKeysToElement (document, element, keysToSend, successCallback, errorCallback, command_id, ignoreVisibility) {
|
||||
if (ignoreVisibility || checkVisible(element)) {
|
||||
focusElement(element);
|
||||
|
||||
element.focus();
|
||||
let modifiers = {
|
||||
shiftKey: false,
|
||||
ctrlKey: false,
|
||||
@ -157,7 +140,6 @@ function sendKeysToElement(document, element, keysToSend, successCallback, error
|
||||
var c = value.charAt(i);
|
||||
sendSingleKey(c, modifiers, document);
|
||||
}
|
||||
|
||||
successCallback(command_id);
|
||||
} else {
|
||||
errorCallback(new ElementNotVisibleError("Element is not visible"), command_id);
|
||||
|
Loading…
Reference in New Issue
Block a user