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



53
54
55
56
# File 'lib/appium_lib_core/common/device/app_management.rb', line 53

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

#app_installed?(app_id) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#app_strings(language = nil) ⇒ Object



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

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

#background_app(duration = 0) ⇒ Object

Raises:

  • (NotImplementedError)


25
26
27
28
# File 'lib/appium_lib_core/common/device/app_management.rb', line 25

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

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



30
31
32
33
34
35
# File 'lib/appium_lib_core/common/device/app_management.rb', line 30

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

  execute :install_app, {}, args
end

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



37
38
39
40
41
42
43
44
45
46
# File 'lib/appium_lib_core/common/device/app_management.rb', line 37

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

#terminate_app(app_id, timeout: nil) ⇒ Object



58
59
60
61
62
63
64
65
66
67
# File 'lib/appium_lib_core/common/device/app_management.rb', line 58

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