Bug 962645 - Support wait between press->release action chain. r=mdas

wait() before press() should not raise "MarionetteException: Element has
not been pressed."
This commit is contained in:
Ting-Yu Lin 2014-06-12 02:34:00 -04:00
Родитель 0645a74aa3
Коммит 772d8aebb7
4 изменённых файлов: 16 добавлений и 5 удалений

Просмотреть файл

@ -1,10 +1,15 @@
from marionette import Actions
def press_release(marionette, wait_for_condition, expected):
def press_release(marionette, times, wait_for_condition, expected):
testAction = marionette.absolute_url("testAction.html")
marionette.navigate(testAction)
action = Actions(marionette)
button = marionette.find_element("id", "button1")
action.press(button).release().perform()
action.press(button).release()
# Insert wait between each press and release chain.
for _ in range(times-1):
action.wait(0.1)
action.press(button).release()
action.perform()
wait_for_condition(lambda m: expected in m.execute_script("return document.getElementById('button1').innerHTML;"))
def move_element(marionette, wait_for_condition, expected1, expected2):

Просмотреть файл

@ -19,7 +19,10 @@ from single_finger_functions import (
class testSingleFinger(MarionetteTestCase):
def test_press_release(self):
press_release(self.marionette, self.wait_for_condition, "button1-touchstart-touchend-mousemove-mousedown-mouseup-click")
press_release(self.marionette, 1, self.wait_for_condition, "button1-touchstart-touchend-mousemove-mousedown-mouseup-click")
def test_press_release_twice(self):
press_release(self.marionette, 2, self.wait_for_condition, "button1-touchstart-touchend-mousemove-mousedown-mouseup-click-touchstart-touchend-mousemove-mousedown-mouseup-click")
def test_move_element(self):
move_element(self.marionette, self.wait_for_condition, "button1-touchstart", "button2-touchmove-touchend")

Просмотреть файл

@ -59,7 +59,10 @@ prefs.setIntPref("ui.click_hold_context_menus.delay", arguments[0]);
super(MarionetteTestCase, self).tearDown()
def test_press_release(self):
press_release(self.marionette, self.wait_for_condition, "button1-mousemove-mousedown-mouseup-click")
press_release(self.marionette, 1, self.wait_for_condition, "button1-mousemove-mousedown-mouseup-click")
def test_press_release_twice(self):
press_release(self.marionette, 2, self.wait_for_condition, "button1-mousemove-mousedown-mouseup-click-mousemove-mousedown-mouseup-click")
def test_move_element(self):
move_element(self.marionette, self.wait_for_condition, "button1-mousemove-mousedown", "button2-mousemove-mouseup")

Просмотреть файл

@ -969,7 +969,7 @@ function actions(chain, touchId, command_id, i) {
let el;
let c;
i++;
if (command != 'press') {
if (command != 'press' && command != 'wait') {
//if mouseEventsOnly, then touchIds isn't used
if (!(touchId in touchIds) && !mouseEventsOnly) {
sendError("Element has not been pressed", 500, null, command_id);