module Appium::Ios::Xcuitest::MultiAppHandler

Note Works only for Xcode 9+. Instance methods have ‘xcuitest_` prefix to prevent conflicts for core commands. see: github.com/appium/ruby_lib_core/blob/82e2526de95b05e8a49872e0b69835e99acc66e5/lib/appium_lib_core/common/command.rb#L39

Public Instance Methods

xcuitest_activate_app(bundle_id:) click to toggle source

Activates an existing application on the device under test and moves it to the foreground. The application should be already running in order to activate it. The call is ignored if the application is already in foreground.

@param [String] bundle_id The bundle identifier of the application, which is going to be brought to the foreground. @return {}

@example

xcuitest_activate_app(bundle_id: "io.appium.bundle") #=> 1
# File lib/appium_lib/ios/xcuitest/command/multi_app_handler.rb, line 127
def xcuitest_activate_app(bundle_id:)
  @driver.activate_app bundle_id
end
xcuitest_app_installed?(bundle_id:) click to toggle source

Verifies whether the application with given bundle identifier is installed on the device.

@param [String] bundle_id The bundle identifier of the application, which is going to be verified. @return [boolean]

@example

xcuitest_app_installed?(bundle_id: "io.appium.bundle") #=> true or false
# File lib/appium_lib/ios/xcuitest/command/multi_app_handler.rb, line 48
def xcuitest_app_installed?(bundle_id:)
  @driver.app_installed? bundle_id
end
xcuitest_install_app(app:) click to toggle source

Installs given application to the device under test. If the same application is already installed then it’s going to be installed over it, which allows to test upgrades. Be careful while reinstalling the main application under test - make sure you called terminateApp for it first, otherwise WebDriverAgent will detect it as a potential application crash.

@param [String] app The path to an existing .ipa/.app file on the server file system, zipped .app file

or an URL pointing to a remote .ipa/.zip file. Mandatory argument.

@return {}

@example

xcuitest_install_app(app: "path/to/app.app")
# File lib/appium_lib/ios/xcuitest/command/multi_app_handler.rb, line 35
def xcuitest_install_app(app:)
  @driver.install_app app
end
xcuitest_launch_app(bundle_id:) click to toggle source

Executes an existing application on the device. If the application is already running then it will be brought to the foreground.

@param [String] bundle_id The bundle identifier of the application, which is going to be executed. @return {}

@example

xcuitest_launch_app(bundle_id: "io.appium.bundle") #=> 1
# File lib/appium_lib/ios/xcuitest/command/multi_app_handler.rb, line 76
def xcuitest_launch_app(bundle_id:)
  args = { bundleId: bundle_id }
  @driver.execute_script 'mobile: launchApp', args
end
xcuitest_query_app_status(bundle_id:) click to toggle source

Get the status of an existing application on the device. State:

0: The current application state cannot be determined/is unknown
1: The application is not running
2: The application is running in the background and is suspended
3: The application is running in the background and is not suspended
4: The application is running in the foreground

For more details: developer.apple.com/documentation/xctest/xcuiapplicationstate

@param [String] bundle_id A target app’s bundle id @return [0|1|2|3|4] A number of the state

@example

xcuitest_query_app_status(bundle_id: "io.appium.bundle") #=> 1
# File lib/appium_lib/ios/xcuitest/command/multi_app_handler.rb, line 112
def xcuitest_query_app_status(bundle_id:)
  @driver.app_state bundle_id
end
xcuitest_remove_app(bundle_id:) click to toggle source

Uninstalls an existing application from the device under test. This endpoint does not verify whether the application is already installed or not before uninstalling it.

@param [String] bundle_id The bundle identifier of the application, which is going to be uninstalled. @return {}

@example

xcuitest_remove_app(bundle_id: "io.appium.bundle") #=> 1
# File lib/appium_lib/ios/xcuitest/command/multi_app_handler.rb, line 62
def xcuitest_remove_app(bundle_id:)
  @driver.remove_app bundle_id
end
xcuitest_terminate_app(bundle_id:) click to toggle source

Terminates an existing application on the device. If the application is not running then the returned result will be false, otherwise true.

@param [String] bundle_id The bundle identifier of the application, which is going to be terminated. @return {}

@example

xcuitest_terminate_app(bundle_id: "io.appium.bundle") #=> 1
# File lib/appium_lib/ios/xcuitest/command/multi_app_handler.rb, line 91
def xcuitest_terminate_app(bundle_id:)
  @driver.terminate_app bundle_id
end