calabash-cucumber 0.9.163.pre5 → 0.9.163.pre6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/calabash-cucumber.gemspec +1 -1
- data/lib/calabash-cucumber/uia.rb +120 -14
- data/lib/calabash-cucumber/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08de191047f321e0ffed282134c68eb60330b541
|
4
|
+
data.tar.gz: 89b0d98563434d12e9bdfef041e8430b2ecdfefa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5777ca5de72a1c88fbde13e2a2d7e154dccbe6da6df1a2d33d0b075b41f3b01d128232b0fa10e9e837ad580565779366c2892153370e3f7245b7860f1f11c762
|
7
|
+
data.tar.gz: 38c5dd7c53756499585f0709134075fced3724ca68028bf12272bdff532d4e997f645f2c25922e8f3207cf17ccfe93bdedef73738cfb5fef949f6a86adcf8d7c
|
data/calabash-cucumber.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.add_dependency( "geocoder", "~>1.1.8")
|
27
27
|
s.add_dependency( "httpclient","~> 2.3.3")
|
28
28
|
s.add_dependency( "bundler", "~> 1.1")
|
29
|
-
s.add_dependency( "run_loop", "~> 0.1.0.
|
29
|
+
s.add_dependency( "run_loop", "~> 0.1.0.pre4" )
|
30
30
|
s.add_dependency( "awesome_print")
|
31
31
|
s.add_dependency( "xamarin-test-cloud", "~> 0.9.25")
|
32
32
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'edn'
|
2
|
+
require 'json'
|
2
3
|
|
3
4
|
module Calabash
|
4
5
|
module Cucumber
|
@@ -24,6 +25,16 @@ module Calabash
|
|
24
25
|
uia_handle_command(:query, queryparts)
|
25
26
|
end
|
26
27
|
|
28
|
+
def uia_query_el(*queryparts)
|
29
|
+
#TODO escape '\n etc in query
|
30
|
+
uia_handle_command(:queryEl, queryparts)
|
31
|
+
end
|
32
|
+
|
33
|
+
def uia_query_windows(*queryparts)
|
34
|
+
#TODO escape '\n etc in query
|
35
|
+
uia_handle_command(:queryWindows, queryparts)
|
36
|
+
end
|
37
|
+
|
27
38
|
def uia_names(*queryparts)
|
28
39
|
#TODO escape '\n etc in query
|
29
40
|
uia_handle_command(:names, queryparts)
|
@@ -41,6 +52,38 @@ module Calabash
|
|
41
52
|
uia_handle_command(:tapOffset, offset)
|
42
53
|
end
|
43
54
|
|
55
|
+
def uia_double_tap(*queryparts)
|
56
|
+
uia_handle_command(:doubleTap, queryparts)
|
57
|
+
end
|
58
|
+
|
59
|
+
def uia_double_tap_mark(mark)
|
60
|
+
uia_double_tap(:view, marked:mark)
|
61
|
+
end
|
62
|
+
|
63
|
+
def uia_double_tap_offset(offset)
|
64
|
+
uia_handle_command(:doubleTapOffset, offset)
|
65
|
+
end
|
66
|
+
|
67
|
+
def uia_two_finger_tap(*queryparts)
|
68
|
+
uia_handle_command(:twoFingerTap, queryparts)
|
69
|
+
end
|
70
|
+
|
71
|
+
def uia_two_finger_tap_offset(offset)
|
72
|
+
uia_handle_command(:twoFingerTapOffset, offset)
|
73
|
+
end
|
74
|
+
|
75
|
+
def uia_flick_offset(from, to)
|
76
|
+
uia_handle_command(:flickOffset, from, to)
|
77
|
+
end
|
78
|
+
|
79
|
+
def uia_touch_hold(duration, *queryparts)
|
80
|
+
uia_handle_command(:touchHold, duration, queryparts)
|
81
|
+
end
|
82
|
+
|
83
|
+
def uia_touch_hold_offset(duration, offset)
|
84
|
+
uia_handle_command(:touchHoldOffset, duration, offset)
|
85
|
+
end
|
86
|
+
|
44
87
|
def uia_pan(from_q, to_q)
|
45
88
|
uia_handle_command(:pan, from_q, to_q)
|
46
89
|
end
|
@@ -82,7 +125,12 @@ module Calabash
|
|
82
125
|
end
|
83
126
|
|
84
127
|
def uia_type_string(string)
|
85
|
-
uia_handle_command(:typeString, string)
|
128
|
+
res = uia_handle_command(:typeString, string)
|
129
|
+
status = res['status']
|
130
|
+
if status.eql?('error')
|
131
|
+
value = res['value']
|
132
|
+
screenshot_and_raise "could not type '#{string}' - '#{value}'"
|
133
|
+
end
|
86
134
|
end
|
87
135
|
|
88
136
|
def uia_enter
|
@@ -107,28 +155,73 @@ module Calabash
|
|
107
155
|
uia_handle_command(:deactivate, secs)
|
108
156
|
end
|
109
157
|
|
110
|
-
def
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
158
|
+
def uia_call(args_arr, *opts)
|
159
|
+
uia_call_method(:queryEl, args_arr, *opts)
|
160
|
+
end
|
161
|
+
|
162
|
+
def uia_call_method(cmd, args_arr, *opts)
|
163
|
+
if opts.empty?
|
164
|
+
return uia_handle_command(cmd, args_arr)
|
165
|
+
end
|
166
|
+
js_cmd = uia_serialize_command(cmd, args_arr)
|
167
|
+
|
168
|
+
js_args = []
|
169
|
+
opts.each do |invocation|
|
170
|
+
js_args << case invocation
|
171
|
+
when Symbol
|
172
|
+
"#{invocation}()"
|
173
|
+
when Hash
|
174
|
+
m = invocation.keys.first
|
175
|
+
args = invocation[m]
|
176
|
+
|
177
|
+
if args.is_a?(Array)
|
178
|
+
serialized_args = (args.map &:to_json).join(',')
|
179
|
+
else
|
180
|
+
serialized_args = args.to_json
|
181
|
+
end
|
182
|
+
|
183
|
+
|
184
|
+
"#{m}(#{serialized_args})"
|
185
|
+
else
|
186
|
+
raise "Invalid invocation spec #{invocation}"
|
116
187
|
end
|
117
188
|
end
|
118
|
-
command =
|
189
|
+
command = "#{js_cmd}.#{js_args.join('.')}"
|
119
190
|
if ENV['DEBUG'] == '1'
|
120
191
|
puts "Sending UIA command"
|
121
192
|
puts command
|
122
193
|
end
|
123
|
-
|
194
|
+
|
195
|
+
uia_result(uia(command))
|
196
|
+
|
197
|
+
end
|
198
|
+
|
199
|
+
def uia_handle_command(cmd, *query_args)
|
200
|
+
command = uia_serialize_command(cmd, *query_args)
|
124
201
|
if ENV['DEBUG'] == '1'
|
125
|
-
puts "
|
126
|
-
|
202
|
+
puts "Sending UIA command"
|
203
|
+
puts command
|
127
204
|
end
|
128
|
-
|
129
|
-
|
205
|
+
s = uia(command)
|
206
|
+
uia_result(s)
|
207
|
+
end
|
208
|
+
|
209
|
+
def uia_serialize_command(cmd, *query_args)
|
210
|
+
args = uia_serialize_arguments(query_args)
|
211
|
+
%Q[uia.#{cmd}(#{args.join(', ')})]
|
212
|
+
end
|
213
|
+
|
214
|
+
def uia_serialize_arguments(args)
|
215
|
+
args.map do |part|
|
216
|
+
uia_serialize_argument(part)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
def uia_serialize_argument(part)
|
221
|
+
if part.is_a?(String)
|
222
|
+
"'#{escape_uia_string(part)}'"
|
130
223
|
else
|
131
|
-
|
224
|
+
"'#{escape_uia_string(part.to_edn)}'"
|
132
225
|
end
|
133
226
|
end
|
134
227
|
|
@@ -148,6 +241,19 @@ module Calabash
|
|
148
241
|
end
|
149
242
|
end
|
150
243
|
|
244
|
+
def uia_result(s)
|
245
|
+
if ENV['DEBUG'] == '1'
|
246
|
+
puts "Result"
|
247
|
+
p s
|
248
|
+
end
|
249
|
+
if s['status'] == 'success'
|
250
|
+
s['value']
|
251
|
+
else
|
252
|
+
s
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
|
151
257
|
|
152
258
|
end
|
153
259
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calabash-cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.163.
|
4
|
+
version: 0.9.163.pre6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Krukow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - ~>
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.1.0.
|
159
|
+
version: 0.1.0.pre4
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - ~>
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0.1.0.
|
166
|
+
version: 0.1.0.pre4
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: awesome_print
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|