bugsnag-maze-runner 7.22.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/bugsnag-print-load-paths +6 -0
- data/bin/download-logs +74 -0
- data/bin/maze-runner +174 -0
- data/bin/upload-app +56 -0
- data/lib/features/scripts/await-android-emulator.sh +11 -0
- data/lib/features/scripts/clear-android-app-data.sh +8 -0
- data/lib/features/scripts/force-stop-android-app.sh +8 -0
- data/lib/features/scripts/install-android-app.sh +15 -0
- data/lib/features/scripts/launch-android-app.sh +38 -0
- data/lib/features/scripts/launch-android-emulator.sh +15 -0
- data/lib/features/steps/android_steps.rb +51 -0
- data/lib/features/steps/app_automator_steps.rb +228 -0
- data/lib/features/steps/aws_sam_steps.rb +212 -0
- data/lib/features/steps/breadcrumb_steps.rb +80 -0
- data/lib/features/steps/browser_steps.rb +93 -0
- data/lib/features/steps/build_api_steps.rb +25 -0
- data/lib/features/steps/document_server_steps.rb +7 -0
- data/lib/features/steps/error_reporting_steps.rb +358 -0
- data/lib/features/steps/feature_flag_steps.rb +190 -0
- data/lib/features/steps/header_steps.rb +72 -0
- data/lib/features/steps/log_steps.rb +29 -0
- data/lib/features/steps/multipart_request_steps.rb +142 -0
- data/lib/features/steps/network_steps.rb +135 -0
- data/lib/features/steps/payload_steps.rb +257 -0
- data/lib/features/steps/proxy_steps.rb +34 -0
- data/lib/features/steps/query_parameter_steps.rb +31 -0
- data/lib/features/steps/request_assertion_steps.rb +186 -0
- data/lib/features/steps/runner_steps.rb +428 -0
- data/lib/features/steps/session_tracking_steps.rb +116 -0
- data/lib/features/steps/trace_steps.rb +206 -0
- data/lib/features/steps/value_steps.rb +119 -0
- data/lib/features/support/env.rb +7 -0
- data/lib/features/support/internal_hooks.rb +207 -0
- data/lib/maze/api/appium/file_manager.rb +29 -0
- data/lib/maze/appium_server.rb +112 -0
- data/lib/maze/assertions/request_set_assertions.rb +97 -0
- data/lib/maze/aws/sam.rb +112 -0
- data/lib/maze/aws_public_ip.rb +53 -0
- data/lib/maze/bugsnag_config.rb +42 -0
- data/lib/maze/checks/assert_check.rb +69 -0
- data/lib/maze/checks/noop_check.rb +34 -0
- data/lib/maze/client/appium/base_client.rb +131 -0
- data/lib/maze/client/appium/bb_client.rb +102 -0
- data/lib/maze/client/appium/bb_devices.rb +127 -0
- data/lib/maze/client/appium/bs_client.rb +91 -0
- data/lib/maze/client/appium/bs_devices.rb +141 -0
- data/lib/maze/client/appium/bs_legacy_client.rb +31 -0
- data/lib/maze/client/appium/local_client.rb +67 -0
- data/lib/maze/client/appium.rb +23 -0
- data/lib/maze/client/bb_api_client.rb +102 -0
- data/lib/maze/client/bb_client_utils.rb +181 -0
- data/lib/maze/client/bs_client_utils.rb +168 -0
- data/lib/maze/client/selenium/base_client.rb +15 -0
- data/lib/maze/client/selenium/bb_browsers.yml +188 -0
- data/lib/maze/client/selenium/bb_client.rb +38 -0
- data/lib/maze/client/selenium/bs_browsers.yml +257 -0
- data/lib/maze/client/selenium/bs_client.rb +89 -0
- data/lib/maze/client/selenium/local_client.rb +16 -0
- data/lib/maze/client/selenium.rb +16 -0
- data/lib/maze/compare.rb +161 -0
- data/lib/maze/configuration.rb +182 -0
- data/lib/maze/docker.rb +147 -0
- data/lib/maze/document_server.rb +46 -0
- data/lib/maze/driver/appium.rb +198 -0
- data/lib/maze/driver/browser.rb +124 -0
- data/lib/maze/errors.rb +52 -0
- data/lib/maze/generator.rb +55 -0
- data/lib/maze/helper.rb +122 -0
- data/lib/maze/hooks/appium_hooks.rb +55 -0
- data/lib/maze/hooks/browser_hooks.rb +15 -0
- data/lib/maze/hooks/command_hooks.rb +9 -0
- data/lib/maze/hooks/error_code_hook.rb +49 -0
- data/lib/maze/hooks/hooks.rb +61 -0
- data/lib/maze/http_request.rb +21 -0
- data/lib/maze/interactive_cli.rb +173 -0
- data/lib/maze/logger.rb +86 -0
- data/lib/maze/macos_utils.rb +14 -0
- data/lib/maze/maze_output.rb +88 -0
- data/lib/maze/network.rb +49 -0
- data/lib/maze/option/parser.rb +240 -0
- data/lib/maze/option/processor.rb +130 -0
- data/lib/maze/option/validator.rb +155 -0
- data/lib/maze/option.rb +62 -0
- data/lib/maze/plugins/bugsnag_reporting_plugin.rb +49 -0
- data/lib/maze/plugins/cucumber_report_plugin.rb +101 -0
- data/lib/maze/plugins/error_code_plugin.rb +21 -0
- data/lib/maze/plugins/global_retry_plugin.rb +38 -0
- data/lib/maze/proxy.rb +114 -0
- data/lib/maze/request_list.rb +87 -0
- data/lib/maze/request_repeater.rb +49 -0
- data/lib/maze/retry_handler.rb +67 -0
- data/lib/maze/runner.rb +149 -0
- data/lib/maze/schemas/OtelTraceSchema.json +390 -0
- data/lib/maze/schemas/trace_schema.rb +7 -0
- data/lib/maze/schemas/trace_validator.rb +98 -0
- data/lib/maze/server.rb +251 -0
- data/lib/maze/servlets/base_servlet.rb +27 -0
- data/lib/maze/servlets/command_servlet.rb +47 -0
- data/lib/maze/servlets/log_servlet.rb +64 -0
- data/lib/maze/servlets/reflective_servlet.rb +70 -0
- data/lib/maze/servlets/servlet.rb +199 -0
- data/lib/maze/servlets/temp.rb +0 -0
- data/lib/maze/servlets/trace_servlet.rb +13 -0
- data/lib/maze/store.rb +15 -0
- data/lib/maze/terminating_server.rb +129 -0
- data/lib/maze/timers.rb +51 -0
- data/lib/maze/wait.rb +35 -0
- data/lib/maze.rb +27 -0
- data/lib/utils/deep_merge.rb +17 -0
- data/lib/utils/selenium_money_patch.rb +17 -0
- metadata +451 -0
@@ -0,0 +1,102 @@
|
|
1
|
+
module Maze
|
2
|
+
module Client
|
3
|
+
module Appium
|
4
|
+
class BitBarClient < BaseClient
|
5
|
+
def prepare_session
|
6
|
+
config = Maze.config
|
7
|
+
config.app = Maze::Client::BitBarClientUtils.upload_app config.access_key,
|
8
|
+
config.app
|
9
|
+
if Maze.config.start_tunnel
|
10
|
+
Maze::Client::BitBarClientUtils.start_local_tunnel config.sb_local,
|
11
|
+
config.username,
|
12
|
+
config.access_key
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def start_scenario
|
17
|
+
unless Maze.config.legacy_driver?
|
18
|
+
# Write Maze's address to file and push to the device
|
19
|
+
maze_address = Maze.public_address || "local:#{Maze.config.port}"
|
20
|
+
Maze::Api::Appium::FileManager.new.write_app_file(JSON.generate({ maze_address: maze_address }),
|
21
|
+
FIXTURE_CONFIG)
|
22
|
+
end
|
23
|
+
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
def device_capabilities
|
28
|
+
config = Maze.config
|
29
|
+
capabilities = {
|
30
|
+
'noReset' => true,
|
31
|
+
'bitbar:options' => {
|
32
|
+
# Some capabilities probably belong in the top level
|
33
|
+
# of the hash, but BitBar picks them up from here.
|
34
|
+
'apiKey' => config.access_key,
|
35
|
+
'app' => config.app,
|
36
|
+
'findDevice' => false,
|
37
|
+
'testTimeout' => 7200,
|
38
|
+
'newCommandTimeout' => 0
|
39
|
+
}
|
40
|
+
}
|
41
|
+
capabilities['appiumVersion'] = config.appium_version unless config.appium_version.nil?
|
42
|
+
capabilities.deep_merge! dashboard_capabilities
|
43
|
+
capabilities.deep_merge! BitBarDevices.get_available_device(config.device)
|
44
|
+
capabilities.deep_merge! JSON.parse(config.capabilities_option)
|
45
|
+
capabilities
|
46
|
+
end
|
47
|
+
|
48
|
+
def log_run_intro
|
49
|
+
# Nothing to log at the start
|
50
|
+
end
|
51
|
+
|
52
|
+
def log_run_outro
|
53
|
+
api_client = BitBarApiClient.new(Maze.config.access_key)
|
54
|
+
|
55
|
+
$logger.info 'Appium session(s) created:'
|
56
|
+
@session_ids.each do |id|
|
57
|
+
link = api_client.get_device_session_ui_link(id)
|
58
|
+
$logger.info Maze::LogUtil.linkify(link, "BitBar session: #{id}") if link
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def stop_session
|
63
|
+
super
|
64
|
+
if Maze.config.start_tunnel
|
65
|
+
Maze::Client::BitBarClientUtils.stop_local_tunnel
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Determines capabilities used to organise sessions in the BitBar dashboard.
|
70
|
+
#
|
71
|
+
# @return [Hash] A hash containing the capabilities.
|
72
|
+
def dashboard_capabilities
|
73
|
+
# Attempt to use the current git repo as the project name
|
74
|
+
output, status = Maze::Runner.run_command('git rev-parse --show-toplevel')
|
75
|
+
if status == 0
|
76
|
+
project = File.basename(output[0].strip)
|
77
|
+
else
|
78
|
+
if ENV['BUILDKITE']
|
79
|
+
project = ENV['BUILDKITE_PIPELINE_SLUG']
|
80
|
+
else
|
81
|
+
$logger.warn 'Unable to determine project name, consider running Maze Runner from within a Git repository'
|
82
|
+
project = 'Unknown'
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
if ENV['BUILDKITE']
|
87
|
+
test_run = "#{ENV['BUILDKITE_BUILD_NUMBER']} - #{ENV['BUILDKITE_LABEL']}"
|
88
|
+
else
|
89
|
+
test_run = Maze.run_uuid
|
90
|
+
end
|
91
|
+
|
92
|
+
{
|
93
|
+
'bitbar:options' => {
|
94
|
+
bitbar_project: project,
|
95
|
+
bitbar_testrun: test_run
|
96
|
+
}
|
97
|
+
}
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Maze
|
5
|
+
module Client
|
6
|
+
module Appium
|
7
|
+
# Provides a source of capabilities used to run tests against specific BitBar devices
|
8
|
+
# noinspection RubyStringKeysInHashInspection
|
9
|
+
class BitBarDevices
|
10
|
+
class << self
|
11
|
+
# Uses the BitBar API to find an available device from the group name given, or a device of that name
|
12
|
+
# @param device_or_group_name [String] Name of the device, or device group for which to find an available device
|
13
|
+
# @return Capabilities hash for the available device
|
14
|
+
def get_available_device(device_or_group_name)
|
15
|
+
api_client = BitBarApiClient.new(Maze.config.access_key)
|
16
|
+
device_group_id = api_client.get_device_group_id(device_or_group_name)
|
17
|
+
if device_group_id
|
18
|
+
# Device group found - find a free device in it
|
19
|
+
$logger.debug "Got group id #{device_group_id} for #{device_or_group_name}"
|
20
|
+
group_count, device = api_client.find_device_in_group(device_group_id)
|
21
|
+
if device.nil?
|
22
|
+
# TODO: Retry rather than fail, see PLAT-7377
|
23
|
+
Maze::Helper.error_exit 'There are no devices available'
|
24
|
+
else
|
25
|
+
$logger.info "#{group_count} device(s) currently available in group '#{device_or_group_name}'"
|
26
|
+
end
|
27
|
+
else
|
28
|
+
# See if there is a device with the given name
|
29
|
+
device = api_client.find_device device_or_group_name
|
30
|
+
end
|
31
|
+
|
32
|
+
device_name = device['displayName']
|
33
|
+
platform = device['platform'].downcase
|
34
|
+
platform_version = device['softwareVersion']['releaseVersion']
|
35
|
+
|
36
|
+
$logger.info "Selected device: #{device_name} (#{platform} #{platform_version})"
|
37
|
+
|
38
|
+
# TODO: Setting the config here is rather a side effect and factoring it out would be better.
|
39
|
+
# For now, though, it means not having to provide the --os and --os-version options on the command line.
|
40
|
+
Maze.config.os = platform
|
41
|
+
Maze.config.os_version = platform_version.to_f.floor
|
42
|
+
|
43
|
+
case platform
|
44
|
+
when 'android'
|
45
|
+
automation_name = if platform_version.start_with?('5')
|
46
|
+
'UiAutomator1'
|
47
|
+
else
|
48
|
+
'UiAutomator2'
|
49
|
+
end
|
50
|
+
make_android_hash(device_name, automation_name)
|
51
|
+
when 'ios'
|
52
|
+
make_ios_hash(device_name)
|
53
|
+
else
|
54
|
+
throw "Invalid device platform specified #{platform}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def list_device_groups(access_key)
|
59
|
+
api_client = BitBarApiClient.new(access_key)
|
60
|
+
device_groups = api_client.get_device_group_list
|
61
|
+
unless device_groups['data'] && !device_groups['data'].empty?
|
62
|
+
puts 'There are no device groups available for the given user access key'
|
63
|
+
exit 1
|
64
|
+
end
|
65
|
+
puts "BitBar device groups available:"
|
66
|
+
device_groups['data'].sort_by{|g| g['displayName']}.each do |group|
|
67
|
+
puts '------------------------------'
|
68
|
+
puts "Group name : #{group['displayName']}"
|
69
|
+
puts "OS : #{group['osType']}"
|
70
|
+
puts "Device count : #{group['deviceCount']}"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def list_devices_for_group(device_group, access_key)
|
75
|
+
api_client = BitBarApiClient.new(access_key)
|
76
|
+
group_id = api_client.get_device_group_id(device_group)
|
77
|
+
unless group_id
|
78
|
+
puts "No device groups were found with the given name #{device_group}"
|
79
|
+
return
|
80
|
+
end
|
81
|
+
devices = api_client.get_device_list_for_group(group_id)
|
82
|
+
if devices['data'].empty?
|
83
|
+
puts "There are no devices available for the #{device_group} device group"
|
84
|
+
return
|
85
|
+
end
|
86
|
+
puts "BitBar devices available for device group #{device_group}:"
|
87
|
+
devices['data'].sort_by{|d| d['displayName']}.each do |device|
|
88
|
+
puts '------------------------------'
|
89
|
+
puts "Device name : #{device['displayName']}"
|
90
|
+
puts "OS : #{device['platform']} #{device['softwareVersion']['releaseVersion']}"
|
91
|
+
|
92
|
+
if device['platform'].eql? 'ANDROID'
|
93
|
+
puts "API level : #{device['softwareVersion']['apiLevel']}"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def make_android_hash(device, automation_name)
|
99
|
+
hash = {
|
100
|
+
'automationName' => automation_name,
|
101
|
+
'platformName' => 'Android',
|
102
|
+
'deviceName' => 'Android Phone',
|
103
|
+
'bitbar:options' => {
|
104
|
+
'autoGrantPermissions' => true,
|
105
|
+
'device' => device,
|
106
|
+
}
|
107
|
+
}
|
108
|
+
hash.freeze
|
109
|
+
end
|
110
|
+
|
111
|
+
def make_ios_hash(device)
|
112
|
+
{
|
113
|
+
'automationName' => 'XCUITest',
|
114
|
+
'deviceName' => 'iPhone device',
|
115
|
+
'platformName' => 'iOS',
|
116
|
+
'bitbar:options' => {
|
117
|
+
'noReset' => 'true',
|
118
|
+
'shouldTerminateApp' => 'true',
|
119
|
+
'device' => device
|
120
|
+
}
|
121
|
+
}.freeze
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
module Maze
|
2
|
+
module Client
|
3
|
+
module Appium
|
4
|
+
class BrowserStackClient < BaseClient
|
5
|
+
def prepare_session
|
6
|
+
# Upload the app and start the secure tunnel
|
7
|
+
config = Maze.config
|
8
|
+
config.app = Maze::Client::BrowserStackClientUtils.upload_app config.username,
|
9
|
+
config.access_key,
|
10
|
+
config.app
|
11
|
+
if Maze.config.start_tunnel
|
12
|
+
Maze::Client::BrowserStackClientUtils.start_local_tunnel config.bs_local,
|
13
|
+
Maze.run_uuid,
|
14
|
+
config.access_key
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def start_scenario
|
19
|
+
unless Maze.config.legacy_driver?
|
20
|
+
# Write Maze's address to file and push to the device
|
21
|
+
maze_address = "bs-local.com:#{Maze.config.port}"
|
22
|
+
Maze::Api::Appium::FileManager.new.write_app_file(JSON.generate({ maze_address: maze_address }),
|
23
|
+
FIXTURE_CONFIG)
|
24
|
+
end
|
25
|
+
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
def device_capabilities
|
30
|
+
config = Maze.config
|
31
|
+
capabilities = {
|
32
|
+
'app' => config.app,
|
33
|
+
'deviceOrientation' => 'portrait',
|
34
|
+
'noReset' => 'true',
|
35
|
+
'bstack:options' => {}
|
36
|
+
}
|
37
|
+
device_caps = Maze::Client::Appium::BrowserStackDevices::DEVICE_HASH[config.device]
|
38
|
+
capabilities.deep_merge! device_caps
|
39
|
+
capabilities.deep_merge! JSON.parse(config.capabilities_option)
|
40
|
+
capabilities.merge! project_name_capabilities
|
41
|
+
capabilities['bstack:options']['appiumVersion'] = config.appium_version unless config.appium_version.nil?
|
42
|
+
unless device_caps['platformName'] == 'android' && device_caps['platformVersion'].to_i <= 6
|
43
|
+
capabilities['bstack:options']['disableAnimations'] = 'true'
|
44
|
+
end
|
45
|
+
if Maze.config.start_tunnel
|
46
|
+
capabilities['bstack:options']['local'] = 'true'
|
47
|
+
capabilities['bstack:options']['localIdentifier'] = Maze.run_uuid
|
48
|
+
end
|
49
|
+
|
50
|
+
capabilities
|
51
|
+
end
|
52
|
+
|
53
|
+
def log_run_intro
|
54
|
+
# Log a link to the BrowserStack session search dashboard
|
55
|
+
url = "https://app-automate.browserstack.com/dashboard/v2/search?query=#{Maze.run_uuid}&type=builds"
|
56
|
+
$logger.info Maze::LogUtil.linkify(url, 'BrowserStack session(s)')
|
57
|
+
end
|
58
|
+
|
59
|
+
def log_run_outro
|
60
|
+
$logger.info 'Appium session(s) created:'
|
61
|
+
@session_ids.each { |id| $logger.info " #{id}" }
|
62
|
+
log_run_intro
|
63
|
+
end
|
64
|
+
|
65
|
+
def stop_session
|
66
|
+
super
|
67
|
+
Maze::Client::BrowserStackClientUtils.stop_local_tunnel if Maze.config.start_tunnel
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
# Determines and returns sensible project, build, and name capabilities
|
73
|
+
#
|
74
|
+
# @return [Hash] A hash containing the 'project' and 'build' capabilities
|
75
|
+
def project_name_capabilities
|
76
|
+
# Default to values for running locally
|
77
|
+
project = 'local'
|
78
|
+
|
79
|
+
if ENV['BUILDKITE']
|
80
|
+
# Project
|
81
|
+
project = ENV['BUILDKITE_PIPELINE_NAME']
|
82
|
+
end
|
83
|
+
{
|
84
|
+
project: project,
|
85
|
+
build: Maze.run_uuid
|
86
|
+
}
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Maze
|
4
|
+
module Client
|
5
|
+
module Appium
|
6
|
+
# Provides a source of capabilities used to run tests against specific BrowserStack devices
|
7
|
+
# noinspection RubyStringKeysInHashInspection
|
8
|
+
class BrowserStackDevices
|
9
|
+
class << self
|
10
|
+
|
11
|
+
def list_devices(os)
|
12
|
+
puts "BrowserStack #{os} devices available:"
|
13
|
+
devices = DEVICE_HASH.dup
|
14
|
+
devices.select { |key, device|
|
15
|
+
device['platformName'].eql?(os)
|
16
|
+
}.map { |key, device|
|
17
|
+
new_device = device.dup
|
18
|
+
new_device['key'] = key
|
19
|
+
new_device
|
20
|
+
}.sort { |dev_1, dev_2|
|
21
|
+
dev_1['platformVersion'].to_f <=> dev_2['platformVersion'].to_f
|
22
|
+
}.each{ |device|
|
23
|
+
puts '------------------------------'
|
24
|
+
puts "Device key: #{device['key']}"
|
25
|
+
puts "Device: #{device['deviceName']}"
|
26
|
+
puts "OS: #{device['platformName']}"
|
27
|
+
puts "OS version: #{device['platformVersion']}"
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def make_android_hash(device, version)
|
32
|
+
hash = {
|
33
|
+
'platformName' => 'android',
|
34
|
+
'platformVersion' => version,
|
35
|
+
'deviceName' => device,
|
36
|
+
'autoGrantPermissions' => 'true',
|
37
|
+
}
|
38
|
+
hash.freeze
|
39
|
+
end
|
40
|
+
|
41
|
+
def add_android(device, version, hash)
|
42
|
+
# Key format is "ANDROID_<version>_<device>", with:
|
43
|
+
# - dots in versions and all spaces replaced with underscores
|
44
|
+
# - device made upper case
|
45
|
+
name = device.upcase.gsub ' ', '_'
|
46
|
+
new_version = version.gsub '.', '_'
|
47
|
+
key = "ANDROID_#{new_version}_#{name}"
|
48
|
+
hash[key] = make_android_hash device, version
|
49
|
+
end
|
50
|
+
|
51
|
+
def make_ios_hash(device, version)
|
52
|
+
{
|
53
|
+
'platformName' => 'ios',
|
54
|
+
'platformVersion' => version,
|
55
|
+
'deviceName' => device
|
56
|
+
}.freeze
|
57
|
+
end
|
58
|
+
|
59
|
+
def add_ios(device, version, hash)
|
60
|
+
# Key format is "IOS_<version>_<device>", with:
|
61
|
+
# - dots in versions and all spaces replaced with underscores
|
62
|
+
# - device made upper case
|
63
|
+
name = device.upcase.gsub ' ', '_'
|
64
|
+
name = name.gsub '.', '_'
|
65
|
+
new_version = version.gsub '.', '_'
|
66
|
+
key = "IOS_#{new_version}_#{name}"
|
67
|
+
hash[key] = make_ios_hash device, version
|
68
|
+
end
|
69
|
+
|
70
|
+
def create_hash
|
71
|
+
hash = {
|
72
|
+
# Classic, non-specific devices for each Android version
|
73
|
+
'ANDROID_13_0' => make_android_hash('Google Pixel 6 Pro', '13.0'),
|
74
|
+
'ANDROID_13_0_BETA' => make_android_hash('Google Pixel 6 Pro', '13 Beta'),
|
75
|
+
'ANDROID_12_0' => make_android_hash('Google Pixel 5', '12.0'),
|
76
|
+
'ANDROID_11_0' => make_android_hash('Google Pixel 4', '11.0'),
|
77
|
+
'ANDROID_10_0' => make_android_hash('Google Pixel 4', '10.0'),
|
78
|
+
'ANDROID_9_0' => make_android_hash('Google Pixel 3', '9.0'),
|
79
|
+
'ANDROID_8_1' => make_android_hash('Samsung Galaxy Note 9', '8.1'),
|
80
|
+
'ANDROID_8_0' => make_android_hash('Google Pixel 2', '8.0'),
|
81
|
+
'ANDROID_7_1' => make_android_hash('Google Pixel', '7.1'),
|
82
|
+
|
83
|
+
# iOS devices
|
84
|
+
'IOS_16' => make_ios_hash('iPhone 14', '16'),
|
85
|
+
'IOS_15' => make_ios_hash('iPhone 11 Pro', '15'),
|
86
|
+
'IOS_14' => make_ios_hash('iPhone 11', '14'),
|
87
|
+
'IOS_13' => make_ios_hash('iPhone 8', '13'),
|
88
|
+
'IOS_12' => make_ios_hash('iPhone 8', '12'),
|
89
|
+
'IOS_11' => make_ios_hash('iPhone 8', '11'),
|
90
|
+
'IOS_10' => make_ios_hash('iPhone 7', '10')
|
91
|
+
}
|
92
|
+
|
93
|
+
# Specific Android devices
|
94
|
+
add_android 'Google Pixel 4', '11.0', hash # ANDROID_11_0_GOOGLE_PIXEL_4
|
95
|
+
|
96
|
+
add_android 'Xiaomi Redmi Note 9', '10.0', hash # ANDROID_10_0_XIAOMI_REDMI_NOTE_9
|
97
|
+
add_android 'Samsung Galaxy Note 20', '10.0', hash # ANDROID_10_0_SAMSUNG_GALAXY_NOTE_20
|
98
|
+
add_android 'Motorola Moto G9 Play', '10.0', hash # ANDROID_10_0_MOTOROLA_MOTO_G9_PLAY
|
99
|
+
add_android 'OnePlus 8', '10.0', hash # ANDROID_10_0_ONEPLUS_8
|
100
|
+
|
101
|
+
add_android 'Google Pixel 2', '9.0', hash # ANDROID_9_0_GOOGLE_PIXEL_2
|
102
|
+
add_android 'Samsung Galaxy Note 9', '8.1', hash # ANDROID_8_1_SAMSUNG_GALAXY_NOTE_9
|
103
|
+
add_android 'Samsung Galaxy J7 Prime', '8.1', hash # ANDROID_8_1_SAMSUNG_GALAXY_J7_PRIME
|
104
|
+
add_android 'Samsung Galaxy Tab S4', '8.1', hash # ANDROID_8_1_SAMSUNG_GALAXY_TAB_S4
|
105
|
+
add_android 'Samsung Galaxy Tab S3', '8.0', hash # ANDROID_8_0_SAMSUNG_GALAXY_TAB_S3
|
106
|
+
add_android 'Google Pixel 2', '8.0', hash # ANDROID_8_0_GOOGLE_PIXEL_2
|
107
|
+
add_android 'Samsung Galaxy S9', '8.0', hash # ANDROID_8_0_SAMSUNG_GALAXY_S9
|
108
|
+
add_android 'Samsung Galaxy S9 Plus', '8.0', hash # ANDROID_8_0_SAMSUNG_GALAXY_S9_PLUS
|
109
|
+
|
110
|
+
add_android 'Samsung Galaxy A8', '7.1', hash # ANDROID_7_1_SAMSUNG_GALAXY_A8
|
111
|
+
add_android 'Samsung Galaxy Note 8', '7.1', hash # ANDROID_7_1_SAMSUNG_GALAXY_NOTE_8
|
112
|
+
add_android 'Samsung Galaxy S8', '7.0', hash # ANDROID_7_0_SAMSUNG_GALAXY_S8
|
113
|
+
add_android 'Samsung Galaxy S8 Plus', '7.0', hash # ANDROID_7_0_SAMSUNG_GALAXY_S8_PLUS
|
114
|
+
|
115
|
+
# Specific iOS devices
|
116
|
+
add_ios 'iPhone 14 Plus', '16.0', hash # IOS_16_0_IPHONE_14_PLUS
|
117
|
+
add_ios 'iPhone 14 Pro', '16.0', hash # IOS_16_0_IPHONE_14_PRO
|
118
|
+
add_ios 'iPhone 14 Pro Max', '16.0', hash # IOS_16_0_IPHONE_14_PRO_MAX
|
119
|
+
|
120
|
+
add_ios 'iPhone 8 Plus', '11.0', hash # IOS_11_0_IPHONE_8_PLUS
|
121
|
+
add_ios 'iPhone X', '11.0', hash # IOS_11_0_IPHONE_X
|
122
|
+
add_ios 'iPhone SE', '11.0', hash # IOS_11_0_IPHONE_SE
|
123
|
+
add_ios 'iPhone 6', '11.0', hash # IOS_11_0_IPHONE_6
|
124
|
+
add_ios 'iPhone 6S', '11.0', hash # IOS_11_0_IPHONE_6S
|
125
|
+
add_ios 'iPhone 6S Plus', '11.0', hash # IOS_11_0_IPHONE_6S_PLUS
|
126
|
+
add_ios 'iPad 5th', '11.0', hash # IOS_11_0_IPAD_5TH
|
127
|
+
add_ios 'iPad Mini 4', '11.0', hash # IOS_11_0_IPAD_MINI_4
|
128
|
+
add_ios 'iPad Pro 9.7 2016', '11.0', hash # IOS_11_0_IPAD_PRO_9_7_2016
|
129
|
+
add_ios 'iPad 6th', '11.0', hash # IOS_11_0_IPAD_6TH
|
130
|
+
add_ios 'iPad Pro 12.9', '11.0', hash # IOS_11_0_IPAD_PRO_12_9
|
131
|
+
|
132
|
+
hash
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
# The hash of device capabilities, accessible by simple names
|
137
|
+
DEVICE_HASH = create_hash
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Maze
|
2
|
+
module Client
|
3
|
+
module Appium
|
4
|
+
class BrowserStackLegacyClient < BrowserStackClient
|
5
|
+
def device_capabilities
|
6
|
+
config = Maze.config
|
7
|
+
capabilities = {
|
8
|
+
'app' => config.app,
|
9
|
+
'browserstack.console' => 'errors',
|
10
|
+
'deviceOrientation' => 'portrait',
|
11
|
+
'noReset' => 'true'
|
12
|
+
}
|
13
|
+
device_caps = Maze::Client::Appium::BrowserStackDevices::DEVICE_HASH[config.device]
|
14
|
+
capabilities.deep_merge! device_caps
|
15
|
+
capabilities.deep_merge! JSON.parse(config.capabilities_option)
|
16
|
+
capabilities.merge! project_name_capabilities
|
17
|
+
capabilities['browserstack.appium_version'] = config.appium_version unless config.appium_version.nil?
|
18
|
+
unless device_caps['platformName'] == 'android' && device_caps['platformVersion'].to_i <= 6
|
19
|
+
capabilities['disableAnimations'] = 'true'
|
20
|
+
end
|
21
|
+
if Maze.config.start_tunnel
|
22
|
+
capabilities['browserstack.localIdentifier'] = Maze.run_uuid
|
23
|
+
capabilities['browserstack.local'] = 'true'
|
24
|
+
end
|
25
|
+
|
26
|
+
capabilities
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Maze
|
2
|
+
module Client
|
3
|
+
module Appium
|
4
|
+
class LocalClient < BaseClient
|
5
|
+
def prepare_session
|
6
|
+
# Attempt to start the local appium server
|
7
|
+
appium_uri = URI(Maze.config.appium_server_url)
|
8
|
+
Maze::AppiumServer.start(address: appium_uri.host, port: appium_uri.port.to_s) if Maze.config.start_appium
|
9
|
+
end
|
10
|
+
|
11
|
+
def device_capabilities
|
12
|
+
config = Maze.config
|
13
|
+
platform = Maze::Helper.get_current_platform
|
14
|
+
capabilities = case platform
|
15
|
+
when 'android'
|
16
|
+
{
|
17
|
+
'platformName' => 'Android',
|
18
|
+
'automationName' => 'UiAutomator2',
|
19
|
+
'autoGrantPermissions' => 'true',
|
20
|
+
'noReset' => 'true'
|
21
|
+
}
|
22
|
+
when 'ios'
|
23
|
+
{
|
24
|
+
'platformName' => 'iOS',
|
25
|
+
'automationName' => 'XCUITest',
|
26
|
+
'deviceName' => config.device_id,
|
27
|
+
'xcodeOrgId' => config.apple_team_id,
|
28
|
+
'xcodeSigningId' => 'iPhone Developer',
|
29
|
+
'udid' => config.device_id,
|
30
|
+
'noReset' => 'true',
|
31
|
+
'waitForQuiescence' => false,
|
32
|
+
'newCommandTimeout' => 0
|
33
|
+
}
|
34
|
+
when 'macos'
|
35
|
+
{
|
36
|
+
'platformName' => 'Mac'
|
37
|
+
}
|
38
|
+
else
|
39
|
+
raise "Unsupported platform: #{config.os}"
|
40
|
+
end
|
41
|
+
common = {
|
42
|
+
'app' => config.app,
|
43
|
+
'os' => platform,
|
44
|
+
'autoAcceptAlerts': 'true'
|
45
|
+
}
|
46
|
+
capabilities.merge! common
|
47
|
+
capabilities.merge! JSON.parse(config.capabilities_option)
|
48
|
+
capabilities
|
49
|
+
end
|
50
|
+
|
51
|
+
def log_run_intro
|
52
|
+
# Nothing to do
|
53
|
+
end
|
54
|
+
|
55
|
+
def log_run_outro
|
56
|
+
# Nothing to do
|
57
|
+
end
|
58
|
+
|
59
|
+
def stop_session
|
60
|
+
super
|
61
|
+
# Acquire and output the logs for the current session
|
62
|
+
Maze::Runner.run_command("log show --predicate '(process == \"#{Maze.config.app}\")' --style syslog --start '#{Maze.start_time}' > #{Maze.config.app}.log")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Maze
|
2
|
+
module Client
|
3
|
+
module Appium
|
4
|
+
def self.start
|
5
|
+
client_class =
|
6
|
+
case Maze.config.farm
|
7
|
+
when :bb then BitBarClient
|
8
|
+
when :bs
|
9
|
+
if Maze.config.legacy_driver?
|
10
|
+
$logger.info 'Using the Legacy (JWP) Appium client'
|
11
|
+
BrowserStackLegacyClient
|
12
|
+
else
|
13
|
+
$logger.info 'Using the W3C Appium client'
|
14
|
+
BrowserStackClient
|
15
|
+
end
|
16
|
+
when :local then LocalClient
|
17
|
+
end
|
18
|
+
|
19
|
+
client_class.new.tap(&:start_session)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|