Sha256: 523bdef51340aab7f9f2b65f38665777d4b0abc04f25e3aa451ed7de821eadf7

Contents?: true

Size: 1.1 KB

Versions: 10

Compression:

Stored size: 1.1 KB

Contents

module Calabash
  module Android
    # Android specific life cyle methods.
    module LifeCycle
      # Resume an application. If the application is already focused, nothing
      # will happen.
      #
      # @example
      #  go_home
      #  # Do something
      #  resume_app
      #
      # @param [String, Calabash::Application] path_or_application A path to the
      #  application, or an instance of {Calabash::Application}.
      #  Defaults to
      #  {Calabash::Defaults#default_application Calabash.default_application}
      def resume_app(path_or_application = nil)
        path_or_application ||= Application.default

        unless path_or_application
          raise 'No application given, and Application.default is not set'
        end

        Device.default.resume_app(path_or_application)

        true
      end

      # @!visibility private
      def _send_current_app_to_background(for_seconds)
        package = focused_package
        activity = focused_activity

        go_home
        sleep(for_seconds)
        Device.default.resume_activity(package, activity)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
calabash-2.0.0.pre10 lib/calabash/android/life_cycle.rb
calabash-2.0.0.pre9 lib/calabash/android/life_cycle.rb
calabash-2.0.0.prelegacy4 lib/calabash/android/life_cycle.rb
calabash-2.0.0.prelegacy3 lib/calabash/android/life_cycle.rb
calabash-2.0.0.prelegacy2 lib/calabash/android/life_cycle.rb
calabash-2.0.0.prelegacy lib/calabash/android/life_cycle.rb
calabash-2.0.0.pre6 lib/calabash/android/life_cycle.rb
calabash-2.0.0.pre5 lib/calabash/android/life_cycle.rb
calabash-2.0.0.pre4 lib/calabash/android/life_cycle.rb
calabash-2.0.0.pre3 lib/calabash/android/life_cycle.rb