Module: Appium::Ios::Xcuitest::MultiAppHandler

Defined in:
lib/appium_lib/ios/xcuitest/command/multi_app_handler.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#xcuitest_activate_app(bundle_id:) ⇒ Object

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.

Examples:


xcuitest_activate_app(bundle_id: "io.appium.bundle") #=> 1

Parameters:

  • bundle_id (String)

    The bundle identifier of the application, which is going to be brought to the foreground.

Returns:

  • {}



127
128
129
# 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:) ⇒ boolean

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

Examples:


xcuitest_app_installed?(bundle_id: "io.appium.bundle") #=> true or false

Parameters:

  • bundle_id (String)

    The bundle identifier of the application, which is going to be verified.

Returns:

  • (boolean)


48
49
50
# 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:) ⇒ Object

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.

Examples:


xcuitest_install_app(app: "path/to/app.app")

Parameters:

  • app (String)

    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.

Returns:

  • {}



35
36
37
# 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:) ⇒ Object

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

Examples:


xcuitest_launch_app(bundle_id: "io.appium.bundle") #=> 1

Parameters:

  • bundle_id (String)

    The bundle identifier of the application, which is going to be executed.

Returns:

  • {}



76
77
78
79
# 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:) ⇒ 0|1|2|3|4

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

Examples:


xcuitest_query_app_status(bundle_id: "io.appium.bundle") #=> 1

Parameters:

  • bundle_id (String)

    A target app’s bundle id

Returns:

  • (0|1|2|3|4)

    A number of the state



112
113
114
# 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:) ⇒ Object

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.

Examples:


xcuitest_remove_app(bundle_id: "io.appium.bundle") #=> 1

Parameters:

  • bundle_id (String)

    The bundle identifier of the application, which is going to be uninstalled.

Returns:

  • {}



62
63
64
# 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:) ⇒ Object

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

Examples:


xcuitest_terminate_app(bundle_id: "io.appium.bundle") #=> 1

Parameters:

  • bundle_id (String)

    The bundle identifier of the application, which is going to be terminated.

Returns:

  • {}



91
92
93
# 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