Sha256: 28d0ebcd14688dae53d157b21de08e392d299a299718ed7e1b7a882b2f97a92a

Contents?: true

Size: 1.29 KB

Versions: 6

Compression:

Stored size: 1.29 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

      # @!visibility private
      def _keyboard_visible?
        Device.default.keyboard_visible?
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
calabash-2.0.0.pre10 lib/calabash/android/text.rb
calabash-2.0.0.pre9 lib/calabash/android/text.rb
calabash-2.0.0.prelegacy4 lib/calabash/android/text.rb
calabash-2.0.0.prelegacy3 lib/calabash/android/text.rb
calabash-2.0.0.prelegacy2 lib/calabash/android/text.rb
calabash-2.0.0.prelegacy lib/calabash/android/text.rb