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

Included in:
Bridge::MJSONWP, Bridge::W3C
Defined in:
lib/appium_lib_core/common/device/app_management.rb

Instance Method Summary collapse

Instance Method Details

#activate_app(app_id) ⇒ Object



77
78
79
80
# File 'lib/appium_lib_core/common/device/app_management.rb', line 77

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

#app_installed?(app_id) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#app_strings(language = nil) ⇒ Object



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

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

#background_app(duration = 0) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument

Raises:

  • (NotImplementedError)


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

def background_app(duration = 0) # rubocop:disable Lint/UnusedMethodArgument
  # Should override in each driver
  raise NotImplementedError
end

#close_appObject



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

def close_app
  execute :close_app
end

#install_app(path, replace: nil, timeout: nil, allow_test_packages: nil, use_sdcard: nil, grant_permissions: nil) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/appium_lib_core/common/device/app_management.rb', line 42

def install_app(path,
                replace: nil,
                timeout: nil,
                allow_test_packages: nil,
                use_sdcard: nil,
                grant_permissions: nil)
  args = { appPath: path }

  args[:options] = {} unless options?(replace, timeout, allow_test_packages, use_sdcard, grant_permissions)

  args[:options][:replace] = replace unless replace.nil?
  args[:options][:timeout] = timeout unless timeout.nil?
  args[:options][:allowTestPackages] = allow_test_packages unless allow_test_packages.nil?
  args[:options][:useSdcard] = use_sdcard unless use_sdcard.nil?
  args[:options][:grantPermissions] = grant_permissions unless grant_permissions.nil?

  execute :install_app, {}, args
end

#launch_appObject



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

def launch_app
  execute :launch_app
end

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



61
62
63
64
65
66
67
68
69
70
# File 'lib/appium_lib_core/common/device/app_management.rb', line 61

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



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

def reset
  execute :reset
end

#terminate_app(app_id, timeout: nil) ⇒ Object



82
83
84
85
86
87
88
89
90
91
# File 'lib/appium_lib_core/common/device/app_management.rb', line 82

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