lib/calabash/android/interactions.rb in calabash-2.0.0.pre11 vs lib/calabash/android/interactions.rb in calabash-2.0.0.prelegacy

- old
+ new

@@ -6,54 +6,51 @@ # Interactions with your app that are specific to Android. module Interactions # Go back. If the keyboard is shown, it will be dismissed. def go_back - Calabash::Internal.with_default_device(required_os: :android) do |device| - device.perform_action('hide_soft_keyboard') - end - - press_physical_back_button + Device.default.perform_action('hide_soft_keyboard') + press_back_button end # Go to the home screen. def go_home - Calabash::Internal.with_default_device(required_os: :android) {|device| device.go_home} + Device.default.go_home true end # Get the name of the currently focused activity # # @example - # puts cal_android.focused_activity + # puts focused_activity # # => com.example.MainActivity # # @return [String] The name of the currently focused activity. def focused_activity - Calabash::Internal.with_default_device(required_os: :android) {|device| device.current_focus[:activity]} + Device.default.current_focus[:activity] end # Get the name of the currently focused package # # @example - # puts cal_android.focused_package + # puts focused_package # # => com.example # # @return [String] The name of the currently focused package def focused_package - Calabash::Internal.with_default_device(required_os: :android) {|device| device.current_focus[:package]} + Device.default.current_focus[:package] end # Sets the date of the first visible date picker widget. # # @example - # cal_android.set_date('2012-04-24') + # set_date('2012-04-24') # # @example # date = Date.parse('3rd Feb 2012') - # cal_android.set_date(date) + # set_date(date) # # @param [Date, String] date The date to set. If given a String, # `Date.parse` is called on the string. # # @see #set_date_in @@ -89,15 +86,15 @@ end # Sets the time of the first visible time picker widget. # # @example - # cal_android.set_time('14:42') + # set_time('14:42') # # @example # time = Time.parse('8:30 AM') - # cal_android.set_time(time) + # set_time(time) # # @param [Time, String] time The time to set. If given a String, # `Time.parse` is called on the string. # # @see #set_time_in @@ -138,9 +135,15 @@ if result.first.is_a?(Hash) && result.first.has_key?('error') raise result.first['error'] end true + end + + + # @!visibility private + def _evaluate_javascript_in(query, javascript) + Device.default.evaluate_javascript_in(query, javascript) end end end end