Sha256: d3a48eb64960cc163d4f65aef9e899972045065d877be8e54a200777e97e9dea

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

module Calabash
  module Android
    module Text
      def dismiss_keyboard
        Device.default.perform_action('hide_soft_keyboard')
      end

      # Taps a keyboard action key on the keyboard. Notice that Calabash does
      # not ensure that this particular action key is actually available on the
      # current keyboard.
      #
      # @example
      #  tap_keyboard_action_key(:normal)
      #  tap_keyboard_action_key(:unspecified)
      #  tap_keyboard_action_key(:none)
      #  tap_keyboard_action_key(:go)
      #  tap_keyboard_action_key(:search)
      #  tap_keyboard_action_key(:send)
      #  tap_keyboard_action_key(:next)
      #  tap_keyboard_action_key(:done)
      #  tap_keyboard_action_key(:previous)
      #
      # @see http://developer.android.com/reference/android/view/inputmethod/EditorInfo.html
      #
      # @param [Symbol] action_key The key to press.
      def tap_keyboard_action_key(action_key)
        Device.default.perform_action('press_user_action_button', action_key.to_s)
      end

      # @!visibility private
      def _clear_text
        Device.default.perform_action('clear_text')
      end

      # @!visibility private
      def _clear_text_in(view)
        tap(view)
        sleep 0.5
        clear_text
      end

      # @!visibility private
      def _enter_text(text)
        Device.default.enter_text(text)
      end

      # @!visibility private
      def _enter_text_in(view, text)
        tap(view)
        sleep 0.5
        enter_text(text)
      end

      # @!visibility private
      def _tap_current_keyboard_action_key
        Device.default.perform_action('press_user_action_button')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
calabash-1.9.9.pre2 lib/calabash/android/text.rb