Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -695,13 +695,13 @@ Closes the app and leaves it running in the background.

- Type: launch_app
Role: role1
Value: com.android.vending (Optional - Android app package / iOS bundle ID)
Value: com.android.vending (Android app package / iOS bundle ID)

### <a id="terminate_app"></a>terminate_app

- Type: terminate_app
Role: role1
Value: com.apple.Preferences (Optional - Android app package / iOS bundle ID)
Value: com.apple.Preferences (Android app package / iOS bundle ID)

### <a id="start_record/end_record"></a>start_record/end_record (Mobile)

Expand Down
30 changes: 12 additions & 18 deletions lib/core/device.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,34 +250,28 @@ def close_app(action = nil)
# launches the app specified by the Android app package / iOS bundle ID
# defaults to the app under test if Value is not provided
# Accepts:
# Value (optional)
# Value
def launch_app(action)
raise "Please specify the application identifier in the Value field!" unless action.key?("Value")
app_id = action["Value"]
if app_id
if @platform == "iOS"
@driver.execute_script('mobile: launchApp', {'bundleId': app_id})
elsif @platform == "Android"
@driver.activate_app(app_id)
end
else
@driver.launch_app
if @platform == "iOS"
@driver.execute_script('mobile: launchApp', {'bundleId': app_id})
elsif @platform == "Android"
@driver.execute_script('mobile: activateApp', {'appId': app_id})
end
end

# closes the app specified by the Android app package / iOS bundle ID
# defaults to the app under test if Value is not provided
# Accepts:
# Value (optional)
# Value
def terminate_app(action)
raise "Please specify the application identifier in the Value field!" unless action.key?("Value")
app_id = action["Value"]
if app_id
if @platform == "iOS"
@driver.execute_script('mobile: terminateApp', {'bundleId': app_id})
elsif @platform == "Android"
@driver.terminate_app(app_id)
end
else
@driver.close_app
if @platform == "iOS"
@driver.execute_script('mobile: terminateApp', {'bundleId': app_id})
elsif @platform == "Android"
@driver.execute_script('mobile: terminateApp', {'appId': app_id})
end
end

Expand Down