@@ -32,11 +32,76 @@ def test_tap_json(self, touch_action):
32
32
33
33
def test_tap_x_y_json (self , touch_action ):
34
34
json = [
35
- {'action' : 'tap' , 'options' : {'x' : 3 , 'y' : 4 , 'count' : 1 , 'element' : 2 }}
35
+ {'action' : 'tap' , 'options' : {'x' : 3 , 'y' : 4 , 'count' : 1 , 'element' : 1 }}
36
36
]
37
- touch_action .tap (ElementStub (2 ), 3 , 4 )
37
+ touch_action .tap (ElementStub (1 ), 3 , 4 )
38
38
assert json == touch_action .json_wire_gestures
39
39
40
+ def test_press_json (self , touch_action ):
41
+ json = [
42
+ {'action' : 'press' , 'options' : {'element' : 1 }}
43
+ ]
44
+ touch_action .press (ElementStub (1 ))
45
+ assert json == touch_action .json_wire_gestures
46
+
47
+ def test_press_x_y_json (self , touch_action ):
48
+ json = [
49
+ {'action' : 'press' , 'options' : {'element' : 1 , 'x' : 3 , 'y' : 4 }}
50
+ ]
51
+ touch_action .press (ElementStub (1 ), 3 , 4 )
52
+ assert json == touch_action .json_wire_gestures
53
+
54
+ def test_long_press_json (self , touch_action ):
55
+ json = [
56
+ {'action' : 'longPress' , 'options' : {'element' : 1 , 'duration' : 2000 }}
57
+ ]
58
+ touch_action .long_press (ElementStub (1 ), duration = 2000 )
59
+ assert json == touch_action .json_wire_gestures
60
+
61
+ def test_long_press_x_y_json (self , touch_action ):
62
+ json = [
63
+ {'action' : 'longPress' , 'options' : {'element' : 1 , 'x' : 3 , 'y' : 4 , 'duration' : 1000 }}
64
+ ]
65
+ touch_action .long_press (ElementStub (1 ), 3 , 4 )
66
+ assert json == touch_action .json_wire_gestures
67
+
68
+ def test_wait_json (self , touch_action ):
69
+ json = [
70
+ {'action' : 'wait' , 'options' : {'ms' : 10 }}
71
+ ]
72
+ touch_action .wait (10 )
73
+ assert json == touch_action .json_wire_gestures
74
+
75
+ def test_wait_without_ms_json (self , touch_action ):
76
+ json = [
77
+ {'action' : 'wait' , 'options' : {'ms' : 0 }}
78
+ ]
79
+ touch_action .wait ()
80
+ assert json == touch_action .json_wire_gestures
81
+
82
+ def test_move_to_json (self , touch_action ):
83
+ json = [
84
+ {'action' : 'moveTo' , 'options' : {'element' : 1 , 'x' : 3 , 'y' : 4 }}
85
+ ]
86
+ touch_action .move_to (ElementStub (1 ), 3 , 4 )
87
+ assert json == touch_action .json_wire_gestures
88
+
89
+ def test_release_json (self , touch_action ):
90
+ json = [
91
+ {'action' : 'release' , 'options' : {}}
92
+ ]
93
+ touch_action .release ()
94
+ assert json == touch_action .json_wire_gestures
95
+
96
+ def test_perform_json (self , touch_action ):
97
+ json_tap = [
98
+ {'action' : 'tap' , 'options' : {'element' : 1 , 'count' : 1 }}
99
+ ]
100
+ touch_action .tap (ElementStub (1 ))
101
+ assert json_tap == touch_action .json_wire_gestures
102
+ touch_action .perform ()
103
+ assert [] == touch_action .json_wire_gestures
104
+
40
105
41
106
class DriverStub (object ):
42
107
def execute (self , _action , _params ):
0 commit comments