lib/calabash/android/device.rb in calabash-1.9.9.pre3 vs lib/calabash/android/device.rb in calabash-2.0.0.pre1
- old
+ new
@@ -155,12 +155,18 @@
def map_route(query, method_name, *method_args)
parameters = make_map_parameters(query, method_name, *method_args)
request = HTTP::Request.new('map', params_for_request(parameters))
- result = JSON.parse(http_client.get(request).body)
+ http_result = if method_name == :flash
+ http_client.get(request, timeout: 30)
+ else
+ http_client.get(request)
+ end
+ result = JSON.parse(http_result.body)
+
if result['outcome'] != 'SUCCESS'
raise "mapping \"#{query}\" with \"#{method_name}\" failed because: #{result['reason']}\n#{result['details']}"
end
Calabash::QueryResult.create(result['results'], query)
@@ -817,12 +823,17 @@
def _pan_between(query_from, query_to, options={})
gesture = Gestures::Gesture.generate_swipe({x: 50, y: 50}, {x: 50, y: 50}, time: options[:duration])
gesture.gestures.first.touches[0].query = query_from
gesture.gestures.first.touches[1].query = query_to
- execute_gesture(Gestures::Gesture.with_parameters(gesture,
+ result = execute_gesture(Gestures::Gesture.with_parameters(gesture,
query: query_to,
timeout: options[:timeout]))
+
+ {
+ :from => Calabash::QueryResult.create(result[0], query_from),
+ :to => Calabash::QueryResult.create(result[1], query_to)
+ }
end
# @!visibility private
def _flick(query, from, to, options={})
from_x = from[:x]