Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command line options to set appActivity and appPackage capabilities #616

Merged
merged 5 commits into from
Jan 3, 2024
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 8.15.0 - 2024/01/03

## Enhancements

- Add `--app-package` and `--app-activity` options (used for BitBar Appium tests only) [616](https://github.com/bugsnag/maze-runner/pull/616)

# 8.14.1 - 2023/12/21

## Fixes
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ GIT
PATH
remote: .
specs:
bugsnag-maze-runner (8.14.1)
bugsnag-maze-runner (8.15.0)
appium_lib (~> 12.0.0)
appium_lib_core (~> 5.4.0)
bugsnag (~> 6.24)
Expand Down
2 changes: 1 addition & 1 deletion lib/features/support/internal_hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@

# Log all received requests to the console if the scenario fails and/or config says to
if (scenario.failed? && Maze.config.log_requests) || Maze.config.always_log
$stdout.puts '^^^ +++'
$stdout.puts '^^^ +++' if ENV['BUILDKITE']
output_received_requests('errors')
output_received_requests('sessions')
output_received_requests('traces')
Expand Down
2 changes: 1 addition & 1 deletion lib/maze.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Glues the various parts of MazeRunner together that need to be accessed globally,
# providing an alternative to the proliferation of global variables or singletons.
module Maze
VERSION = '8.14.1'
VERSION = '8.15.0'

class << self
attr_accessor :check, :driver, :internal_hooks, :mode, :start_time, :dynamic_retry, :public_address,
Expand Down
2 changes: 2 additions & 0 deletions lib/maze/client/appium/bb_devices.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ def make_android_hash(device)
'uiautomator2ServerInstallTimeout' => 60000,
'uiautomator2ServerLaunchTimeout' => 60000
}
appium_options['appActivity'] = Maze.config.app_activity unless Maze.config.app_activity.nil?
appium_options['appPackage'] = Maze.config.app_package unless Maze.config.app_package.nil?
hash = {
'platformName' => 'Android',
'deviceName' => 'Android Phone',
Expand Down
6 changes: 6 additions & 0 deletions lib/maze/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ def initialize
# Test browser version
attr_accessor :browser_version

# The appActivity to be set in the Appium capabilities
attr_accessor :app_activity

# The appPackage to be set in the Appium capabilities
attr_accessor :app_package

# Appium version to use
attr_accessor :appium_version

Expand Down
2 changes: 2 additions & 0 deletions lib/maze/option.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ module Option

# Generic device farm options
ACCESS_KEY = 'access-key'
APP_ACTIVITY = 'app-activity'
APP_BUNDLE_ID = 'app-bundle-id'
APP_PACKAGE = 'app-package'
APPIUM_VERSION = 'appium-version'
BROWSER = 'browser'
BROWSER_VERSION = 'browser-version'
Expand Down
8 changes: 8 additions & 0 deletions lib/maze/option/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ def parse(args)
'Device farm access key. Consumes env var from environment based on farm set',
short: :none,
type: :string
opt Option::APP_ACTIVITY,
'The appActivity to set in the Appium capabilities (for BitBar only)',
short: :none,
type: :string
opt Option::APP_PACKAGE,
'The appPackage to set in the Appium capabilities (for BitBar only)',
short: :none,
type: :string
opt Option::APPIUM_VERSION,
'The Appium version to use',
short: :none,
Expand Down
2 changes: 2 additions & 0 deletions lib/maze/option/processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def populate(config, options)
end
config.locator = options[Maze::Option::A11Y_LOCATOR] ? :accessibility_id : :id
config.capabilities_option = options[Maze::Option::CAPABILITIES]
config.app_activity = options[Maze::Option::APP_ACTIVITY]
config.app_package = options[Maze::Option::APP_PACKAGE]
config.legacy_driver = !ENV['USE_LEGACY_DRIVER'].nil?
config.start_tunnel = options[Maze::Option::TUNNEL]

Expand Down
6 changes: 6 additions & 0 deletions test/option/parser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def test_default_values
assert_nil(options[Maze::Option::USERNAME])
assert_nil(options[Maze::Option::ACCESS_KEY])
assert_nil(options[Maze::Option::APPIUM_VERSION])
assert_nil(options[Maze::Option::APP_ACTIVITY])
assert_nil(options[Maze::Option::APP_PACKAGE])
assert_true(options[Maze::Option::TUNNEL])

# Local-only options
Expand Down Expand Up @@ -77,6 +79,8 @@ def test_overwritten_values
--browser-version=ARG_BROWSER_VERSION
--username=ARG_USERNAME
--access-key=ARG_ACCESS_KEY
--app-activity=ARG_APP_ACTIVITY
--app-package=ARG_APP_PACKAGE
--appium-version=ARG_APPIUM_VERSION
--os=ARG_OS
--os-version=ARG_OS_VERSION
Expand All @@ -103,6 +107,8 @@ def test_overwritten_values
assert_equal('ARG_BROWSER_VERSION', options[Maze::Option::BROWSER_VERSION])
assert_equal('ARG_USERNAME', options[Maze::Option::USERNAME])
assert_equal('ARG_ACCESS_KEY', options[Maze::Option::ACCESS_KEY])
assert_equal('ARG_APP_ACTIVITY', options[Maze::Option::APP_ACTIVITY])
assert_equal('ARG_APP_PACKAGE', options[Maze::Option::APP_PACKAGE])
assert_equal('ARG_APPIUM_VERSION', options[Maze::Option::APPIUM_VERSION])
assert_false(options[Maze::Option::TUNNEL])

Expand Down