bugsnag-maze-runner 6.27.0 → 7.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/bin/download-logs +14 -16
  3. data/bin/maze-runner +53 -15
  4. data/bin/upload-app +6 -6
  5. data/lib/features/steps/breadcrumb_steps.rb +44 -14
  6. data/lib/features/steps/error_reporting_steps.rb +16 -0
  7. data/lib/features/steps/network_steps.rb +66 -6
  8. data/lib/features/steps/payload_steps.rb +23 -0
  9. data/lib/features/steps/request_assertion_steps.rb +87 -8
  10. data/lib/features/steps/runner_steps.rb +22 -0
  11. data/lib/features/steps/session_tracking_steps.rb +1 -1
  12. data/lib/features/steps/trace_steps.rb +254 -0
  13. data/lib/features/support/internal_hooks.rb +31 -84
  14. data/lib/maze/api/appium/file_manager.rb +29 -0
  15. data/lib/maze/aws_public_ip.rb +53 -0
  16. data/lib/maze/checks/assert_check.rb +9 -31
  17. data/lib/maze/client/appium/base_client.rb +131 -0
  18. data/lib/maze/client/appium/bb_client.rb +102 -0
  19. data/lib/maze/client/appium/bb_devices.rb +127 -0
  20. data/lib/maze/client/appium/bs_client.rb +91 -0
  21. data/lib/maze/client/appium/bs_devices.rb +141 -0
  22. data/lib/maze/client/appium/bs_legacy_client.rb +31 -0
  23. data/lib/maze/client/appium/local_client.rb +67 -0
  24. data/lib/maze/client/appium.rb +23 -0
  25. data/lib/maze/client/bb_api_client.rb +102 -0
  26. data/lib/maze/client/bb_client_utils.rb +181 -0
  27. data/lib/maze/client/bs_client_utils.rb +168 -0
  28. data/lib/maze/client/selenium/base_client.rb +15 -0
  29. data/lib/maze/client/selenium/bb_browsers.yml +188 -0
  30. data/lib/maze/client/selenium/bb_client.rb +38 -0
  31. data/lib/maze/client/selenium/bs_browsers.yml +257 -0
  32. data/lib/maze/client/selenium/bs_client.rb +89 -0
  33. data/lib/maze/client/selenium/local_client.rb +16 -0
  34. data/lib/maze/client/selenium.rb +16 -0
  35. data/lib/maze/configuration.rb +18 -10
  36. data/lib/maze/docker.rb +40 -1
  37. data/lib/maze/driver/appium.rb +5 -24
  38. data/lib/maze/driver/browser.rb +12 -26
  39. data/lib/maze/errors.rb +32 -0
  40. data/lib/maze/generator.rb +55 -0
  41. data/lib/maze/helper.rb +7 -3
  42. data/lib/maze/hooks/appium_hooks.rb +29 -190
  43. data/lib/maze/hooks/browser_hooks.rb +2 -55
  44. data/lib/maze/hooks/error_code_hook.rb +49 -0
  45. data/lib/maze/hooks/hooks.rb +2 -2
  46. data/lib/maze/http_request.rb +21 -0
  47. data/lib/maze/logger.rb +16 -3
  48. data/lib/maze/maze_output.rb +88 -0
  49. data/lib/maze/option/parser.rb +17 -22
  50. data/lib/maze/option/processor.rb +21 -34
  51. data/lib/maze/option/validator.rb +38 -67
  52. data/lib/maze/option.rb +16 -18
  53. data/lib/maze/plugins/cucumber_report_plugin.rb +1 -1
  54. data/lib/maze/plugins/error_code_plugin.rb +21 -0
  55. data/lib/maze/request_list.rb +10 -5
  56. data/lib/maze/request_repeater.rb +49 -0
  57. data/lib/maze/retry_handler.rb +4 -13
  58. data/lib/maze/schemas/OtelTraceSchema.json +390 -0
  59. data/lib/maze/schemas/trace_schema.rb +7 -0
  60. data/lib/maze/schemas/trace_validator.rb +98 -0
  61. data/lib/maze/server.rb +74 -30
  62. data/lib/maze/servlets/base_servlet.rb +10 -5
  63. data/lib/maze/servlets/command_servlet.rb +10 -7
  64. data/lib/maze/servlets/log_servlet.rb +2 -2
  65. data/lib/maze/servlets/reflective_servlet.rb +12 -11
  66. data/lib/maze/servlets/servlet.rb +47 -8
  67. data/lib/maze/servlets/temp.rb +0 -0
  68. data/lib/maze/servlets/trace_servlet.rb +13 -0
  69. data/lib/maze.rb +2 -2
  70. data/lib/utils/deep_merge.rb +17 -0
  71. data/lib/utils/selenium_money_patch.rb +17 -0
  72. metadata +97 -17
  73. data/lib/maze/bitbar_devices.rb +0 -84
  74. data/lib/maze/bitbar_utils.rb +0 -112
  75. data/lib/maze/browser_stack_devices.rb +0 -160
  76. data/lib/maze/browser_stack_utils.rb +0 -164
  77. data/lib/maze/browsers_bs.yml +0 -220
  78. data/lib/maze/browsers_cbt.yml +0 -100
  79. data/lib/maze/capabilities.rb +0 -126
  80. data/lib/maze/driver/resilient_appium.rb +0 -51
  81. data/lib/maze/sauce_labs_utils.rb +0 -96
  82. data/lib/maze/smart_bear_utils.rb +0 -71
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag-maze-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.27.0
4
+ version: 7.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Kirkland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-16 00:00:00.000000000 Z
11
+ date: 2023-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 3.5.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: rack
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.2'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.2'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: webrick
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +86,42 @@ dependencies:
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: 11.2.0
89
+ version: 12.0.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 12.0.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: appium_lib_core
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 5.4.0
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 5.4.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: selenium-webdriver
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '4.0'
76
118
  type: :runtime
77
119
  prerelease: false
78
120
  version_requirements: !ruby/object:Gem::Requirement
79
121
  requirements:
80
122
  - - "~>"
81
123
  - !ruby/object:Gem::Version
82
- version: 11.2.0
124
+ version: '4.0'
83
125
  - !ruby/object:Gem::Dependency
84
126
  name: bugsnag
85
127
  requirement: !ruby/object:Gem::Requirement
@@ -151,19 +193,19 @@ dependencies:
151
193
  - !ruby/object:Gem::Version
152
194
  version: 12.3.3
153
195
  - !ruby/object:Gem::Dependency
154
- name: selenium-webdriver
196
+ name: json_schemer
155
197
  requirement: !ruby/object:Gem::Requirement
156
198
  requirements:
157
199
  - - "~>"
158
200
  - !ruby/object:Gem::Version
159
- version: '3.11'
201
+ version: 0.2.24
160
202
  type: :runtime
161
203
  prerelease: false
162
204
  version_requirements: !ruby/object:Gem::Requirement
163
205
  requirements:
164
206
  - - "~>"
165
207
  - !ruby/object:Gem::Version
166
- version: '3.11'
208
+ version: 0.2.24
167
209
  - !ruby/object:Gem::Dependency
168
210
  name: rubyzip
169
211
  requirement: !ruby/object:Gem::Requirement
@@ -248,6 +290,20 @@ dependencies:
248
290
  - - "~>"
249
291
  - !ruby/object:Gem::Version
250
292
  version: 0.9.1
293
+ - !ruby/object:Gem::Dependency
294
+ name: timecop
295
+ requirement: !ruby/object:Gem::Requirement
296
+ requirements:
297
+ - - "~>"
298
+ - !ruby/object:Gem::Version
299
+ version: 0.9.6
300
+ type: :development
301
+ prerelease: false
302
+ version_requirements: !ruby/object:Gem::Requirement
303
+ requirements:
304
+ - - "~>"
305
+ - !ruby/object:Gem::Version
306
+ version: 0.9.6
251
307
  description: Automation steps and mock server to validaterequest payloads response.
252
308
  email:
253
309
  - steve@bugsnag.com
@@ -288,39 +344,56 @@ files:
288
344
  - lib/features/steps/request_assertion_steps.rb
289
345
  - lib/features/steps/runner_steps.rb
290
346
  - lib/features/steps/session_tracking_steps.rb
347
+ - lib/features/steps/trace_steps.rb
291
348
  - lib/features/steps/value_steps.rb
292
349
  - lib/features/support/env.rb
293
350
  - lib/features/support/internal_hooks.rb
294
351
  - lib/maze.rb
352
+ - lib/maze/api/appium/file_manager.rb
295
353
  - lib/maze/appium_server.rb
296
354
  - lib/maze/assertions/request_set_assertions.rb
297
355
  - lib/maze/aws/sam.rb
298
- - lib/maze/bitbar_devices.rb
299
- - lib/maze/bitbar_utils.rb
300
- - lib/maze/browser_stack_devices.rb
301
- - lib/maze/browser_stack_utils.rb
302
- - lib/maze/browsers_bs.yml
303
- - lib/maze/browsers_cbt.yml
356
+ - lib/maze/aws_public_ip.rb
304
357
  - lib/maze/bugsnag_config.rb
305
- - lib/maze/capabilities.rb
306
358
  - lib/maze/checks/assert_check.rb
307
359
  - lib/maze/checks/noop_check.rb
360
+ - lib/maze/client/appium.rb
361
+ - lib/maze/client/appium/base_client.rb
362
+ - lib/maze/client/appium/bb_client.rb
363
+ - lib/maze/client/appium/bb_devices.rb
364
+ - lib/maze/client/appium/bs_client.rb
365
+ - lib/maze/client/appium/bs_devices.rb
366
+ - lib/maze/client/appium/bs_legacy_client.rb
367
+ - lib/maze/client/appium/local_client.rb
368
+ - lib/maze/client/bb_api_client.rb
369
+ - lib/maze/client/bb_client_utils.rb
370
+ - lib/maze/client/bs_client_utils.rb
371
+ - lib/maze/client/selenium.rb
372
+ - lib/maze/client/selenium/base_client.rb
373
+ - lib/maze/client/selenium/bb_browsers.yml
374
+ - lib/maze/client/selenium/bb_client.rb
375
+ - lib/maze/client/selenium/bs_browsers.yml
376
+ - lib/maze/client/selenium/bs_client.rb
377
+ - lib/maze/client/selenium/local_client.rb
308
378
  - lib/maze/compare.rb
309
379
  - lib/maze/configuration.rb
310
380
  - lib/maze/docker.rb
311
381
  - lib/maze/document_server.rb
312
382
  - lib/maze/driver/appium.rb
313
383
  - lib/maze/driver/browser.rb
314
- - lib/maze/driver/resilient_appium.rb
315
384
  - lib/maze/errors.rb
385
+ - lib/maze/generator.rb
316
386
  - lib/maze/helper.rb
317
387
  - lib/maze/hooks/appium_hooks.rb
318
388
  - lib/maze/hooks/browser_hooks.rb
319
389
  - lib/maze/hooks/command_hooks.rb
390
+ - lib/maze/hooks/error_code_hook.rb
320
391
  - lib/maze/hooks/hooks.rb
392
+ - lib/maze/http_request.rb
321
393
  - lib/maze/interactive_cli.rb
322
394
  - lib/maze/logger.rb
323
395
  - lib/maze/macos_utils.rb
396
+ - lib/maze/maze_output.rb
324
397
  - lib/maze/network.rb
325
398
  - lib/maze/option.rb
326
399
  - lib/maze/option/parser.rb
@@ -328,23 +401,30 @@ files:
328
401
  - lib/maze/option/validator.rb
329
402
  - lib/maze/plugins/bugsnag_reporting_plugin.rb
330
403
  - lib/maze/plugins/cucumber_report_plugin.rb
404
+ - lib/maze/plugins/error_code_plugin.rb
331
405
  - lib/maze/plugins/global_retry_plugin.rb
332
406
  - lib/maze/proxy.rb
333
407
  - lib/maze/request_list.rb
408
+ - lib/maze/request_repeater.rb
334
409
  - lib/maze/retry_handler.rb
335
410
  - lib/maze/runner.rb
336
- - lib/maze/sauce_labs_utils.rb
411
+ - lib/maze/schemas/OtelTraceSchema.json
412
+ - lib/maze/schemas/trace_schema.rb
413
+ - lib/maze/schemas/trace_validator.rb
337
414
  - lib/maze/server.rb
338
415
  - lib/maze/servlets/base_servlet.rb
339
416
  - lib/maze/servlets/command_servlet.rb
340
417
  - lib/maze/servlets/log_servlet.rb
341
418
  - lib/maze/servlets/reflective_servlet.rb
342
419
  - lib/maze/servlets/servlet.rb
343
- - lib/maze/smart_bear_utils.rb
420
+ - lib/maze/servlets/temp.rb
421
+ - lib/maze/servlets/trace_servlet.rb
344
422
  - lib/maze/store.rb
345
423
  - lib/maze/terminating_server.rb
346
424
  - lib/maze/timers.rb
347
425
  - lib/maze/wait.rb
426
+ - lib/utils/deep_merge.rb
427
+ - lib/utils/selenium_money_patch.rb
348
428
  homepage:
349
429
  licenses:
350
430
  - MIT
@@ -1,84 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'json'
3
-
4
- module Maze
5
- # Provides a source of capabilities used to run tests against specific BitBar devices
6
- # noinspection RubyStringKeysInHashInspection
7
- class BitBarDevices
8
- APPIUM_1_9_1 = '1.9.1'
9
- APPIUM_1_15_0 = '1.15.0'
10
- APPIUM_1_20_2 = '1.20.2'
11
-
12
- BASE_URI = 'https://cloud.bitbar.com/api/v2/me'
13
- FILTER_PATH = 'devices/filters'
14
-
15
- DEVICE_GROUP_IDS = {
16
- # Classic, non-specific devices for each Android version
17
- 'ANDROID_10_0' => '46024',
18
-
19
- # iOS devices
20
- 'IOS_14' => '46025'
21
- }
22
-
23
- class << self
24
- def call_bitbar_api(path, query, api_key)
25
- encoded_query = URI.encode_www_form(query)
26
- uri = URI("#{BASE_URI}/#{path}?#{encoded_query}")
27
- request = Net::HTTP::Get.new(uri)
28
- request.basic_auth(api_key, '')
29
-
30
- res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
31
- http.request(request)
32
- end
33
-
34
- JSON.parse(res.body)
35
- end
36
-
37
- def get_filtered_device_name(device_group_id, api_key)
38
- path = "device-groups/#{device_group_id}/devices"
39
- query = {
40
- 'filter': "online_eq_true"
41
- }
42
- all_devices = call_bitbar_api(path, query, api_key)
43
- filtered_devices = all_devices['data'].reject { |device| device['locked'] }
44
- filtered_devices.first['displayName']
45
- end
46
-
47
- def get_device(device_group, platform, platform_version, api_key)
48
- device_group_id = DEVICE_GROUP_IDS[device_group]
49
- device_name = get_filtered_device_name(device_group_id, api_key)
50
- case platform.downcase
51
- when 'android'
52
- automation_name = 'UiAutomator1' if platform_version.start_with?('5')
53
- make_android_hash(device_name, nil, automation_name)
54
- when 'ios'
55
- make_ios_hash(device_name)
56
- else
57
- throw "Invalid device platform specified #{platform}"
58
- end
59
- end
60
-
61
- def make_android_hash(device, appium_version = nil, automation_name = nil)
62
- hash = {
63
- 'platformName' => 'Android',
64
- 'bitbar_device' => device,
65
- 'bitbar_target' => 'android',
66
- 'deviceName' => 'Android Phone'
67
- }
68
- hash['bitbar_appiumVersion'] = appium_version if appium_version
69
- hash['automationName'] = automation_name if automation_name
70
- hash.freeze
71
- end
72
-
73
- def make_ios_hash(device)
74
- {
75
- 'platformName' => 'iOS',
76
- 'bitbar_device' => device,
77
- 'bitbar_target' => 'ios',
78
- 'deviceName' => 'iPhone device',
79
- 'automationName' => 'XCUITest'
80
- }.freeze
81
- end
82
- end
83
- end
84
- end
@@ -1,112 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'open3'
3
- require 'fileutils'
4
- require 'json'
5
-
6
- module Maze
7
- # Utils supporting the BitBar device farm integration
8
- class BitBarUtils
9
- BB_READY_FILE = 'bb.ready'
10
- BB_KILL_FILE = 'bb.kill'
11
- BB_USER_PREFIX = 'BB_USER_'
12
- BB_KEY_PREFIX = 'BB_KEY_'
13
-
14
- class << self
15
-
16
- # Uploads an app to BitBar for later consumption
17
- # @param api_key [String] The BitBar API key
18
- # @param app [String] A path to the application file
19
- def upload_app(api_key, app)
20
- uuid_regex = /\A[0-9]+\z/
21
-
22
- if uuid_regex.match? app
23
- $logger.info "Using pre-uploaded app with ID #{app}"
24
- app_uuid = app
25
- else
26
- expanded_app = Maze::Helper.expand_path(app)
27
- $logger.info "Uploading app: #{expanded_app}"
28
-
29
- # Upload the app to BitBar
30
- uri = URI('https://cloud.bitbar.com/api/me/files')
31
- request = Net::HTTP::Post.new(uri)
32
- request.basic_auth(api_key, '')
33
- request.set_form({ 'file' => File.new(expanded_app, 'rb') }, 'multipart/form-data')
34
-
35
- res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
36
- http.request(request)
37
- end
38
-
39
- # Pull the UUID from the response
40
- begin
41
- response = JSON.parse res.body
42
- if response.key?('id')
43
- app_uuid = response['id']
44
- $logger.info "Uploaded app ID: #{app_uuid}"
45
- $logger.info 'You can use this ID to avoid uploading the same app more than once.'
46
- else
47
- $logger.error "Unexpected response body: #{response}"
48
- raise 'App upload failed'
49
- end
50
- rescue JSON::ParserError
51
- $logger.error "Expected JSON response, received: #{res}"
52
- raise
53
- end
54
- end
55
- app_uuid
56
- end
57
-
58
- # Requests an unused account id from the test-management-service
59
- # @param tms_uri [String] The URI of the test-management-service
60
- #
61
- # @returns
62
- def account_credentials(tms_uri)
63
- Maze::Wait.new(interval: 10, timeout: 1800).until do
64
- output = request_account_index(tms_uri)
65
- case output.code
66
- when '200'
67
- body = JSON.parse(output.body, {symbolize_names: true})
68
- @account_id = account_id = body[:id]
69
- $logger.info "Using account #{account_id}, expiring at #{body[:expiry]}"
70
- {
71
- username: ENV["#{BB_USER_PREFIX}#{account_id}"],
72
- access_key: ENV["#{BB_KEY_PREFIX}#{account_id}"]
73
- }
74
- when '409'
75
- # All accounts are in use, wait for one to become available
76
- $logger.info 'All accounts are currently in use, retrying in 30s'
77
- false
78
- else
79
- # Something has gone wrong, throw an error
80
- $logger.error "Unexpected status code received from test-management server"
81
- raise
82
- end
83
- end
84
- end
85
-
86
- # Makes the HTTP call to acquire an account id
87
- # @param tms_uri [String] The URI of the test-management-service
88
- #
89
- # @returns
90
- def request_account_index(tms_uri)
91
- uri = URI("#{tms_uri}/account/request")
92
- request = Net::HTTP::Get.new(uri)
93
- request['Authorization'] = Maze.config.tms_token
94
- res = Net::HTTP.start(uri.hostname, uri.port) do |http|
95
- http.request(request)
96
- end
97
- res
98
- end
99
-
100
- # Informs the test-management-service that in-use account id is no longer in use
101
- # @param tms_uri [String] The URI of the test-management-service
102
- def release_account(tms_uri)
103
- uri = URI("#{tms_uri}/account/release?account_id=#{@account_id}")
104
- request = Net::HTTP::Get.new(uri)
105
- request['Authorization'] = Maze.config.tms_token
106
- res = Net::HTTP.start(uri.hostname, uri.port) do |http|
107
- http.request(request)
108
- end
109
- end
110
- end
111
- end
112
- end
@@ -1,160 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Maze
4
- # Provides a source of capabilities used to run tests against specific BrowserStack devices
5
- # noinspection RubyStringKeysInHashInspection
6
- class BrowserStackDevices
7
- APPIUM_1_7_0 = '1.7.0'
8
- APPIUM_1_9_1 = '1.9.1'
9
- APPIUM_1_15_0 = '1.15.0'
10
- APPIUM_1_20_2 = '1.20.2'
11
- APPIUM_1_21_0 = '1.21.0'
12
-
13
- class << self
14
-
15
- def list_devices(os)
16
- puts "BrowserStack #{os} devices available"
17
- devices = DEVICE_HASH.dup
18
- devices.select { |key, device|
19
- device['os'].eql?(os)
20
- }.map { |key, device|
21
- new_device = device.dup
22
- new_device['key'] = key
23
- new_device
24
- }.sort { |dev_1, dev_2|
25
- dev_1['os_version'].to_f <=> dev_2['os_version'].to_f
26
- }.each{ |device|
27
- puts '------------------------------'
28
- puts "Device key: #{device['key']}"
29
- puts "Device: #{device['device']}"
30
- puts "OS: #{device['os']}"
31
- puts "OS version: #{device['os_version']}"
32
- }
33
- end
34
-
35
- def make_android_hash(device, version, appium_version = APPIUM_1_20_2)
36
- hash = {
37
- 'device' => device,
38
- 'os_version' => version,
39
- 'autoGrantPermissions' => 'true',
40
- 'platformName' => 'Android',
41
- 'os' => 'android',
42
- 'browserstack.appium_version' => appium_version
43
- }
44
- # disableAnimations only allowed > Android 6
45
- if version.to_i > 6
46
- hash['disableAnimations'] = 'true'
47
- end
48
- hash.freeze
49
- end
50
-
51
- def add_android(device, version, hash, appium_version = APPIUM_1_20_2)
52
- # Key format is "ANDROID_<version>_<device>", with:
53
- # - dots in versions and all spaces replaced with underscores
54
- # - device made upper case
55
- name = device.upcase.gsub ' ', '_'
56
- new_version = version.gsub '.', '_'
57
- key = "ANDROID_#{new_version}_#{name}"
58
- hash[key] = make_android_hash device, version, appium_version
59
- end
60
-
61
- def make_ios_hash(device, version, appium_version = APPIUM_1_21_0)
62
- {
63
- 'device' => device,
64
- 'os_version' => version,
65
- 'platformName' => 'iOS',
66
- 'os' => 'ios',
67
- 'disableAnimations' => 'true',
68
- 'browserstack.appium_version' => appium_version
69
- }.freeze
70
- end
71
-
72
- def add_ios(device, version, hash, appium_version = APPIUM_1_21_0)
73
- # Key format is "IOS_<version>_<device>", with:
74
- # - dots in versions and all spaces replaced with underscores
75
- # - device made upper case
76
- name = device.upcase.gsub ' ', '_'
77
- name = name.gsub '.', '_'
78
- new_version = version.gsub '.', '_'
79
- key = "IOS_#{new_version}_#{name}"
80
- hash[key] = make_ios_hash device, version, appium_version
81
- end
82
-
83
- def create_hash
84
- hash = {
85
- # Classic, non-specific devices for each Android version
86
- 'ANDROID_13_0' => make_android_hash('Google Pixel 6 Pro', '13.0'),
87
- 'ANDROID_13_0_BETA' => make_android_hash('Google Pixel 6 Pro', '13 Beta'),
88
- 'ANDROID_12_0' => make_android_hash('Google Pixel 5', '12.0'),
89
- 'ANDROID_11_0' => make_android_hash('Google Pixel 4', '11.0'),
90
- 'ANDROID_10_0' => make_android_hash('Google Pixel 4', '10.0'),
91
- 'ANDROID_9_0' => make_android_hash('Google Pixel 3', '9.0'),
92
- 'ANDROID_8_1' => make_android_hash('Samsung Galaxy Note 9', '8.1'),
93
- 'ANDROID_8_0' => make_android_hash('Google Pixel 2', '8.0'),
94
- 'ANDROID_7_1' => make_android_hash('Google Pixel', '7.1'),
95
- 'ANDROID_6_0' => make_android_hash('Google Nexus 6', '6.0'),
96
- 'ANDROID_5_0' => make_android_hash('Google Nexus 6', '5.0'),
97
- 'ANDROID_4_4' => make_android_hash('Google Nexus 5', '4.4', APPIUM_1_9_1),
98
-
99
- # iOS devices
100
- 'IOS_16' => make_ios_hash('iPhone 14', '16'),
101
- 'IOS_15' => make_ios_hash('iPhone 11 Pro', '15'),
102
- 'IOS_14' => make_ios_hash('iPhone 11', '14'),
103
- 'IOS_13' => make_ios_hash('iPhone 8', '13'),
104
- 'IOS_12' => make_ios_hash('iPhone 8', '12'),
105
- 'IOS_11' => make_ios_hash('iPhone 8', '11', APPIUM_1_7_0),
106
- 'IOS_10' => make_ios_hash('iPhone 7', '10', APPIUM_1_7_0)
107
- }
108
-
109
- # Specific Android devices
110
- add_android 'Google Pixel 4', '11.0', hash # ANDROID_11_0_GOOGLE_PIXEL_4
111
-
112
- add_android 'Xiaomi Redmi Note 9', '10.0', hash # ANDROID_10_0_XIAOMI_REDMI_NOTE_9
113
- add_android 'Samsung Galaxy Note 20', '10.0', hash # ANDROID_10_0_SAMSUNG_GALAXY_NOTE_20
114
- add_android 'Motorola Moto G9 Play', '10.0', hash # ANDROID_10_0_MOTOROLA_MOTO_G9_PLAY
115
- add_android 'OnePlus 8', '10.0', hash # ANDROID_10_0_ONEPLUS_8
116
-
117
- add_android 'Google Pixel 2', '9.0', hash # ANDROID_9_0_GOOGLE_PIXEL_2
118
- add_android 'Samsung Galaxy Note 9', '8.1', hash # ANDROID_8_1_SAMSUNG_GALAXY_NOTE_9
119
- add_android 'Samsung Galaxy J7 Prime', '8.1', hash # ANDROID_8_1_SAMSUNG_GALAXY_J7_PRIME
120
- add_android 'Samsung Galaxy Tab S4', '8.1', hash # ANDROID_8_1_SAMSUNG_GALAXY_TAB_S4
121
- add_android 'Samsung Galaxy Tab S3', '8.0', hash # ANDROID_8_0_SAMSUNG_GALAXY_TAB_S3
122
- add_android 'Google Pixel', '8.0', hash # ANDROID_8_0_GOOGLE_PIXEL
123
- add_android 'Google Pixel 2', '8.0', hash # ANDROID_8_0_GOOGLE_PIXEL_2
124
- add_android 'Samsung Galaxy S9', '8.0', hash # ANDROID_8_0_SAMSUNG_GALAXY_S9
125
- add_android 'Samsung Galaxy S9 Plus', '8.0', hash # ANDROID_8_0_SAMSUNG_GALAXY_S9_PLUS
126
-
127
- add_android 'Samsung Galaxy A8', '7.1', hash # ANDROID_7_1_SAMSUNG_GALAXY_A8
128
- add_android 'Samsung Galaxy Note 8', '7.1', hash # ANDROID_7_1_SAMSUNG_GALAXY_NOTE_8
129
- add_android 'Samsung Galaxy S8', '7.0', hash # ANDROID_7_0_SAMSUNG_GALAXY_S8
130
- add_android 'Samsung Galaxy S8 Plus', '7.0', hash # ANDROID_7_0_SAMSUNG_GALAXY_S8_PLUS
131
-
132
- add_android 'Motorola Moto X 2nd Gen', '6.0', hash # ANDROID_6_0_MOTOROLA_MOTO_X_2ND_GEN
133
- add_android 'Google Nexus 6', '6.0', hash # ANDROID_6_0_GOOGLE_NEXUS_6
134
- add_android 'Samsung Galaxy S7', '6.0', hash # ANDROID_6_0_SAMSUNG_GALAXY_S7
135
- add_android 'Google Nexus 6', '5.0', hash # ANDROID_5_0_GOOGLE_NEXUS_6
136
- add_android 'Samsung Galaxy S6', '5.0', hash # ANDROID_5_0_SAMSUNG_GALAXY_S6
137
- add_android 'Samsung Galaxy Note 4', '4.4', hash, APPIUM_1_9_1 # ANDROID_4_4_SAMSUNG_GALAXY_NOTE_4
138
- add_android 'Samsung Galaxy Tab 4', '4.4', hash, APPIUM_1_9_1 # ANDROID_4_4_SAMSUNG_GALAXY_TAB_4
139
-
140
- # Specific iOS devices
141
- add_ios 'iPhone 8 Plus', '11.0', hash, APPIUM_1_7_0 # IOS_11_0_IPHONE_8_PLUS
142
- add_ios 'iPhone X', '11.0', hash, APPIUM_1_7_0 # IOS_11_0_IPHONE_X
143
- add_ios 'iPhone SE', '11.0', hash, APPIUM_1_7_0 # IOS_11_0_IPHONE_SE
144
- add_ios 'iPhone 6', '11.0', hash, APPIUM_1_7_0 # IOS_11_0_IPHONE_6
145
- add_ios 'iPhone 6S', '11.0', hash, APPIUM_1_7_0 # IOS_11_0_IPHONE_6S
146
- add_ios 'iPhone 6S Plus', '11.0', hash, APPIUM_1_7_0 # IOS_11_0_IPHONE_6S_PLUS
147
- add_ios 'iPad 5th', '11.0', hash, APPIUM_1_7_0 # IOS_11_0_IPAD_5TH
148
- add_ios 'iPad Mini 4', '11.0', hash, APPIUM_1_7_0 # IOS_11_0_IPAD_MINI_4
149
- add_ios 'iPad Pro 9.7 2016', '11.0', hash, APPIUM_1_7_0 # IOS_11_0_IPAD_PRO_9_7_2016
150
- add_ios 'iPad 6th', '11.0', hash, APPIUM_1_7_0 # IOS_11_0_IPAD_6TH
151
- add_ios 'iPad Pro 12.9', '11.0', hash, APPIUM_1_7_0 # IOS_11_0_IPAD_PRO_12_9
152
-
153
- hash
154
- end
155
- end
156
-
157
- # The hash of device capabilities, accessible by simple names
158
- DEVICE_HASH = create_hash
159
- end
160
- end