calios-uia-extension 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/calios-uia-extension/uia_target.rb +35 -0
- data/lib/calios-uia-extension/version.rb +1 -1
- data/spec/spec_uia_base.rb +1 -1
- data/spec/spec_uia_target.rb +95 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cd184d1ec6d5b5aeafe0ce2ac9397b06b91ff42
|
4
|
+
data.tar.gz: 4f08bc514766de7250e7c4a2ac0a5042313fcff8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f8c1bae162ad9db045a955aadd0fbcece9a1ec6d94ce26f87c57fda94e7f5f3a86a818339d14adb28adf23aecc2944eb0abfe1f318408d5dff4d6e7a300ffc2
|
7
|
+
data.tar.gz: 4847ebbbec93e8a6eee79b5de03cbe692cf80357c81a3f24109ca48b5d7c7dc6148b044cf536578408ba08c6975c7d323cf87baf6f4f8788efe9203d7f330b1d
|
@@ -22,5 +22,40 @@ class UIATarget < UIABase
|
|
22
22
|
res = execute('target.deviceOrientation()')
|
23
23
|
response(res)
|
24
24
|
end
|
25
|
+
|
26
|
+
def deactivate_app_for_duration(aDuration=5)
|
27
|
+
res = execute("target.deactivateAppForDuration(#{aDuration})")
|
28
|
+
response(res)
|
29
|
+
end
|
30
|
+
|
31
|
+
alias_method :send_application_to_background, :deactivate_app_for_duration
|
32
|
+
|
33
|
+
def drag_from_to_for_duration(aFromX, aFromY, aToX, aToY, aDuration=1)
|
34
|
+
res = execute("target.dragFromToForDuration({x:#{aFromX}, y:#{aFromY}}, {x:#{aToX}, y:#{aToY}}, #{aDuration})")
|
35
|
+
response(res)
|
36
|
+
end
|
37
|
+
|
38
|
+
alias_method :drag, :drag_from_to_for_duration
|
39
|
+
|
40
|
+
def pinch_close_from_to_for_duration(aFromX, aFromY, aToX, aToY, aDuration=1)
|
41
|
+
res = execute("target.pinchCloseFromToForDuration({x:#{aFromX}, y:#{aFromY}}, {x:#{aToX}, y:#{aToY}}, #{aDuration})")
|
42
|
+
response(res)
|
43
|
+
end
|
44
|
+
|
45
|
+
alias_method :pinch_close, :pinch_close_from_to_for_duration
|
46
|
+
|
47
|
+
def pinch_open_from_to_for_duration(aFromX, aFromY, aToX, aToY, aDuration=1)
|
48
|
+
res = execute("target.pinchOpenFromToForDuration({x:#{aFromX}, y:#{aFromY}}, {x:#{aToX}, y:#{aToY}}, #{aDuration})")
|
49
|
+
response(res)
|
50
|
+
end
|
51
|
+
|
52
|
+
alias_method :pinch_open, :pinch_open_from_to_for_duration
|
53
|
+
|
54
|
+
def flick_from_to(aFromX, aFromY, aToX, aToY)
|
55
|
+
res = execute("target.flickFromTo({x:#{aFromX}, y:#{aFromY}}, {x:#{aToX}, y:#{aToY}})")
|
56
|
+
response(res)
|
57
|
+
end
|
58
|
+
|
59
|
+
alias_method :flick, :flick_from_to
|
25
60
|
end
|
26
61
|
end
|
data/spec/spec_uia_base.rb
CHANGED
@@ -11,7 +11,7 @@ class SpecUIABase < Minitest::Spec
|
|
11
11
|
end
|
12
12
|
|
13
13
|
describe 'UIABase' do
|
14
|
-
classes = [UIAAlert, UIAPopover]
|
14
|
+
classes = [UIAAlert, UIAPopover, UIATarget]
|
15
15
|
classes.each do |klass|
|
16
16
|
describe "#{klass}.execute" do
|
17
17
|
it 'should call Calabash uia method with correct parameters' do
|
data/spec/spec_uia_target.rb
CHANGED
@@ -67,6 +67,101 @@ class SpecUIATarget < Minitest::Spec
|
|
67
67
|
$uia_command.must_equal('target.deviceOrientation()')
|
68
68
|
res.must_equal(3)
|
69
69
|
end
|
70
|
+
|
71
|
+
describe 'UIATarget.deactivate_app_for_duration and alias methods' do
|
72
|
+
it 'should call Calabash uia command with correct parameters and return correct response' do
|
73
|
+
$stub_uia_response =
|
74
|
+
{
|
75
|
+
'status' => 'success',
|
76
|
+
'value' => true,
|
77
|
+
'index' => 0
|
78
|
+
}
|
79
|
+
|
80
|
+
res = UIATarget.deactivate_app_for_duration
|
81
|
+
$uia_command.must_equal('target.deactivateAppForDuration(5)')
|
82
|
+
res.must_equal(true)
|
83
|
+
|
84
|
+
res = UIATarget.deactivate_app_for_duration(10)
|
85
|
+
$uia_command.must_equal('target.deactivateAppForDuration(10)')
|
86
|
+
res.must_equal(true)
|
87
|
+
|
88
|
+
res = UIATarget.send_application_to_background
|
89
|
+
$uia_command.must_equal('target.deactivateAppForDuration(5)')
|
90
|
+
res.must_equal(true)
|
91
|
+
|
92
|
+
res = UIATarget.send_application_to_background(10)
|
93
|
+
$uia_command.must_equal('target.deactivateAppForDuration(10)')
|
94
|
+
res.must_equal(true)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe 'UIATarget.drag_from_to_for_duration and alias methods' do
|
99
|
+
it 'should call Calabash uia command with correct parameters and return correct response' do
|
100
|
+
$stub_uia_response =
|
101
|
+
{
|
102
|
+
'status' => 'success',
|
103
|
+
'value' => ':nil',
|
104
|
+
'index' => 0
|
105
|
+
}
|
106
|
+
|
107
|
+
UIATarget.drag_from_to_for_duration(100, 100, 200, 200, 3)
|
108
|
+
$uia_command.must_equal('target.dragFromToForDuration({x:100, y:100}, {x:200, y:200}, 3)')
|
109
|
+
|
110
|
+
UIATarget.drag(300, 300, 400, 400, 5)
|
111
|
+
$uia_command.must_equal('target.dragFromToForDuration({x:300, y:300}, {x:400, y:400}, 5)')
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe 'UIATarget.pinch_close_from_to_for_duration and alias methods' do
|
116
|
+
it 'should call Calabash uia command with correct parameters and return correct response' do
|
117
|
+
$stub_uia_response =
|
118
|
+
{
|
119
|
+
'status' => 'success',
|
120
|
+
'value' => ':nil',
|
121
|
+
'index' => 0
|
122
|
+
}
|
123
|
+
|
124
|
+
UIATarget.pinch_close_from_to_for_duration(100, 100, 200, 200, 3)
|
125
|
+
$uia_command.must_equal('target.pinchCloseFromToForDuration({x:100, y:100}, {x:200, y:200}, 3)')
|
126
|
+
|
127
|
+
UIATarget.pinch_close(300, 300, 400, 400, 5)
|
128
|
+
$uia_command.must_equal('target.pinchCloseFromToForDuration({x:300, y:300}, {x:400, y:400}, 5)')
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
describe 'UIATarget.pinch_open_from_to_for_duration and alias methods' do
|
133
|
+
it 'should call Calabash uia command with correct parameters and return correct response' do
|
134
|
+
$stub_uia_response =
|
135
|
+
{
|
136
|
+
'status' => 'success',
|
137
|
+
'value' => ':nil',
|
138
|
+
'index' => 0
|
139
|
+
}
|
140
|
+
|
141
|
+
UIATarget.pinch_open_from_to_for_duration(100, 100, 200, 200, 3)
|
142
|
+
$uia_command.must_equal('target.pinchOpenFromToForDuration({x:100, y:100}, {x:200, y:200}, 3)')
|
143
|
+
|
144
|
+
UIATarget.pinch_open(300, 300, 400, 400, 5)
|
145
|
+
$uia_command.must_equal('target.pinchOpenFromToForDuration({x:300, y:300}, {x:400, y:400}, 5)')
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
describe 'UIATarget.flick_from_to and alias methods' do
|
150
|
+
it 'should call Calabash uia command with correct parameters and return correct response' do
|
151
|
+
$stub_uia_response =
|
152
|
+
{
|
153
|
+
'status' => 'success',
|
154
|
+
'value' => ':nil',
|
155
|
+
'index' => 0
|
156
|
+
}
|
157
|
+
|
158
|
+
UIATarget.flick_from_to(100, 100, 200, 200)
|
159
|
+
$uia_command.must_equal('target.flickFromTo({x:100, y:100}, {x:200, y:200})')
|
160
|
+
|
161
|
+
UIATarget.flick(300, 300, 400, 400)
|
162
|
+
$uia_command.must_equal('target.flickFromTo({x:300, y:300}, {x:400, y:400})')
|
163
|
+
end
|
164
|
+
end
|
70
165
|
end
|
71
166
|
end
|
72
167
|
end
|