diff --git a/test/unit/webdriver/touch_action_test.py b/test/unit/webdriver/touch_action_test.py index 0d752fd6..4e37b63d 100644 --- a/test/unit/webdriver/touch_action_test.py +++ b/test/unit/webdriver/touch_action_test.py @@ -32,11 +32,76 @@ def test_tap_json(self, touch_action): def test_tap_x_y_json(self, touch_action): json = [ - {'action': 'tap', 'options': {'x': 3, 'y': 4, 'count': 1, 'element': 2}} + {'action': 'tap', 'options': {'x': 3, 'y': 4, 'count': 1, 'element': 1}} ] - touch_action.tap(ElementStub(2), 3, 4) + touch_action.tap(ElementStub(1), 3, 4) assert json == touch_action.json_wire_gestures + def test_press_json(self, touch_action): + json = [ + {'action': 'press', 'options': {'element': 1}} + ] + touch_action.press(ElementStub(1)) + assert json == touch_action.json_wire_gestures + + def test_press_x_y_json(self, touch_action): + json = [ + {'action': 'press', 'options': {'element': 1, 'x': 3, 'y': 4}} + ] + touch_action.press(ElementStub(1), 3, 4) + assert json == touch_action.json_wire_gestures + + def test_long_press_json(self, touch_action): + json = [ + {'action': 'longPress', 'options': {'element': 1, 'duration': 2000}} + ] + touch_action.long_press(ElementStub(1), duration=2000) + assert json == touch_action.json_wire_gestures + + def test_long_press_x_y_json(self, touch_action): + json = [ + {'action': 'longPress', 'options': {'element': 1, 'x': 3, 'y': 4, 'duration': 1000}} + ] + touch_action.long_press(ElementStub(1), 3, 4) + assert json == touch_action.json_wire_gestures + + def test_wait_json(self, touch_action): + json = [ + {'action': 'wait', 'options': {'ms': 10}} + ] + touch_action.wait(10) + assert json == touch_action.json_wire_gestures + + def test_wait_without_ms_json(self, touch_action): + json = [ + {'action': 'wait', 'options': {'ms': 0}} + ] + touch_action.wait() + assert json == touch_action.json_wire_gestures + + def test_move_to_json(self, touch_action): + json = [ + {'action': 'moveTo', 'options': {'element': 1, 'x': 3, 'y': 4}} + ] + touch_action.move_to(ElementStub(1), 3, 4) + assert json == touch_action.json_wire_gestures + + def test_release_json(self, touch_action): + json = [ + {'action': 'release', 'options': {}} + ] + touch_action.release() + assert json == touch_action.json_wire_gestures + + def test_perform_json(self, touch_action): + json_tap = [ + {'action': 'tap', 'options': {'element': 1, 'count': 1}} + ] + touch_action.tap(ElementStub(1)) + assert json_tap == touch_action.json_wire_gestures + touch_action.perform() + assert [] == touch_action.json_wire_gestures + class DriverStub(object): def execute(self, _action, _params):