Sha256: 769634d5dc824c3e29491f830bdec5c972729576e59bba4e974d2d45efd81df7

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

module Calabash
  module Android
    # Android specific text-related actions.
    module Text
      # Dismisses the current keyboard. This is equivalent to the user
      # pressing the back button if the keyboard is showing. If the keyboard is
      # already hidden/dismissed, nothing is done.
      def dismiss_keyboard
        Device.default.perform_action('hide_soft_keyboard')
        sleep 0.5
      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_keyboard_action_key(action_key)
        if action_key.nil?
          Device.default.perform_action('press_user_action_button')
        else
          Device.default.perform_action('press_user_action_button', action_key.to_s)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
calabash-2.0.0.pre6 lib/calabash/android/text.rb
calabash-2.0.0.pre5 lib/calabash/android/text.rb
calabash-2.0.0.pre4 lib/calabash/android/text.rb
calabash-2.0.0.pre3 lib/calabash/android/text.rb