calabash-cucumber 0.9.90 → 0.9.91
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/calabash-cucumber/core.rb +24 -16
- data/lib/calabash-cucumber/version.rb +1 -1
- metadata +1 -1
@@ -166,11 +166,11 @@ module Calabash
|
|
166
166
|
|
167
167
|
check_element_exists(q)
|
168
168
|
|
169
|
-
comps = query(q
|
169
|
+
comps = query(q, :numberOfComponents).first
|
170
170
|
row_counts = []
|
171
171
|
texts = []
|
172
172
|
comps.times do |i|
|
173
|
-
row_counts[i] = query(q
|
173
|
+
row_counts[i] = query(q, :numberOfRowsInComponent => i).first
|
174
174
|
texts[i] = []
|
175
175
|
end
|
176
176
|
|
@@ -178,13 +178,13 @@ module Calabash
|
|
178
178
|
row_count.times do |i|
|
179
179
|
#view = query(q,[{:viewForRow => 0}, {:forComponent => 0}],:accessibilityLabel).first
|
180
180
|
spec = [{:viewForRow => i}, {:forComponent => comp}]
|
181
|
-
view = query(q,spec).first
|
181
|
+
view = query(q, spec).first
|
182
182
|
if view
|
183
|
-
txt = query(q,spec
|
183
|
+
txt = query(q, spec, :accessibilityLabel).first
|
184
184
|
else
|
185
|
-
txt = query(q, :delegate, [{:pickerView
|
186
|
-
{:titleForRow=>i},
|
187
|
-
{:forComponent=>comp}]).first
|
185
|
+
txt = query(q, :delegate, [{:pickerView => :view},
|
186
|
+
{:titleForRow => i},
|
187
|
+
{:forComponent => comp}]).first
|
188
188
|
end
|
189
189
|
texts[comp] << txt
|
190
190
|
end
|
@@ -338,7 +338,7 @@ module Calabash
|
|
338
338
|
def url_for(verb)
|
339
339
|
url = URI.parse(ENV['DEVICE_ENDPOINT']|| "http://localhost:37265")
|
340
340
|
path = url.path
|
341
|
-
if path.end_with?"/"
|
341
|
+
if path.end_with? "/"
|
342
342
|
path = "#{path}#{verb}"
|
343
343
|
else
|
344
344
|
path = "#{path}/#{verb}"
|
@@ -353,18 +353,23 @@ module Calabash
|
|
353
353
|
body = nil
|
354
354
|
CAL_HTTP_RETRY_COUNT.times do |count|
|
355
355
|
begin
|
356
|
-
|
356
|
+
if not (@http) or not (@http.started?)
|
357
357
|
@http = init_request(url)
|
358
358
|
@http.start
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
359
|
+
end
|
360
|
+
body = @http.request(req).body
|
361
|
+
break
|
362
|
+
rescue Errno::ECONNRESET, EOFError, Errno::ECONNREFUSED, Errno::EPIPE, Timeout::Error => e
|
363
|
+
|
363
364
|
if count < CAL_HTTP_RETRY_COUNT-1
|
364
|
-
|
365
|
-
|
365
|
+
if e.is_a?(Timeout::Error)
|
366
|
+
sleep(5)
|
367
|
+
else
|
368
|
+
sleep(0.3)
|
369
|
+
end
|
370
|
+
puts "Retrying.. #{e.class}: (#{e})"
|
366
371
|
else
|
367
|
-
puts "Failing..."
|
372
|
+
puts "Failing... #{e.class}"
|
368
373
|
raise e
|
369
374
|
end
|
370
375
|
end
|
@@ -378,6 +383,9 @@ module Calabash
|
|
378
383
|
if http.respond_to? :open_timeout=
|
379
384
|
http.open_timeout==15
|
380
385
|
end
|
386
|
+
if http.respond_to?(:read_timeout=)
|
387
|
+
http.read_timeout = 30
|
388
|
+
end
|
381
389
|
http
|
382
390
|
end
|
383
391
|
end
|