Module: Appium::Core::Base::Device::AppManagement

Defined in:
lib/appium_lib_core/common/device/app_management.rb

Instance Method Summary collapse

Instance Method Details

#activate_app(app_id) ⇒ Object



71
72
73
74
# File 'lib/appium_lib_core/common/device/app_management.rb', line 71

def activate_app(app_id)
  # required: [['appId'], ['bundleId']]
  execute :activate_app, {}, bundleId: app_id
end

#app_installed?(app_id) ⇒ Boolean

Returns:

  • (Boolean)


66
67
68
69
# File 'lib/appium_lib_core/common/device/app_management.rb', line 66

def app_installed?(app_id)
  # required: [['appId'], ['bundleId']]
  execute :app_installed?, {}, bundleId: app_id
end

#app_strings(language = nil) ⇒ Object



38
39
40
41
# File 'lib/appium_lib_core/common/device/app_management.rb', line 38

def app_strings(language = nil)
  opts = language ? { language: language } : {}
  execute :app_strings, {}, opts
end

#background_app(duration = 0) ⇒ Object

Raises:

  • (NotImplementedError)


43
44
45
46
# File 'lib/appium_lib_core/common/device/app_management.rb', line 43

def background_app(duration = 0)
  # Should override in each driver
  raise NotImplementedError
end

#close_appObject



27
28
29
30
31
32
# File 'lib/appium_lib_core/common/device/app_management.rb', line 27

def close_app
  ::Appium::Logger.warn(
    '[DEPRECATION] close_app is deprecated. Please use terminate_app instead.'
  )
  execute :close_app
end

#install_app(path, options = {}) ⇒ Object



48
49
50
51
52
53
# File 'lib/appium_lib_core/common/device/app_management.rb', line 48

def install_app(path, options = {})
  args = { appPath: path }
  args[:options] = options unless options.empty?

  execute :install_app, {}, args
end

#launch_appObject



20
21
22
23
24
25
# File 'lib/appium_lib_core/common/device/app_management.rb', line 20

def launch_app
  ::Appium::Logger.warn(
    '[DEPRECATION] launch_app is deprecated. Please use activate_app instead.'
  )
  execute :launch_app
end

#remove_app(id, keep_data: nil, timeout: nil) ⇒ Object



55
56
57
58
59
60
61
62
63
64
# File 'lib/appium_lib_core/common/device/app_management.rb', line 55

def remove_app(id, keep_data: nil, timeout: nil)
  # required: [['appId'], ['bundleId']]
  args = { appId: id }

  args[:options] = {} unless keep_data.nil? && timeout.nil?
  args[:options][:keepData] = keep_data unless keep_data.nil?
  args[:options][:timeout] = timeout unless timeout.nil?

  execute :remove_app, {}, args
end

#resetObject



34
35
36
# File 'lib/appium_lib_core/common/device/app_management.rb', line 34

def reset
  execute :reset
end

#terminate_app(app_id, timeout: nil) ⇒ Object



76
77
78
79
80
81
82
83
84
85
# File 'lib/appium_lib_core/common/device/app_management.rb', line 76

def terminate_app(app_id, timeout: nil)
  # required: [['appId'], ['bundleId']]
  #
  args = { appId: app_id }

  args[:options] = {} unless timeout.nil?
  args[:options][:timeout] = timeout unless timeout.nil?

  execute :terminate_app, {}, args
end