bugsnag-maze-runner 9.24.0 → 9.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0228273568f007261eae073c5e86b4110a49457315b720af8c8485b852654c14'
4
- data.tar.gz: 6e02c9d0d6dc533970fa04513fbbcef5a1d3922bd94ad56320ec94ec68728371
3
+ metadata.gz: 46bf8f5d1c29e09f7227b584c2f716d35051c11553bfff1ee811ae1ce3ea8301
4
+ data.tar.gz: 13adf959087e9fea8dcfd9abf914dcca0d39692a594b5052dc9c8e4c264ba6ab
5
5
  SHA512:
6
- metadata.gz: c1f163e4176bffeb2a3c87f94513af887b51a586797c91ab615d44eba321f4bcc11a998b1f7ae5f1524a872dc3f3bd01538eeb4f36e25ec1c545be0a768db034
7
- data.tar.gz: 03343e37dbd74f6d528c6a72ec7d818ae8ddb2725ed4788591e2dce4e0183b3a1a8d8ec3294ddb2e677544dce6e1da13de8400d5ea396413efdb6b5fd42b8905
6
+ metadata.gz: 1d8b85bf8aaf4e2689f53958cfc3758829351f955666ebb3280b1a0e86a326dd989acab928352140141b50cd865327fcf63db6a419710ece36c8c8ad253220f3
7
+ data.tar.gz: 95928d06b7051df121c8fcfec30c32ac7c925621029da75ceb0b05bc47d75e0fd41ac5e4cd7bf17d13f7bd21296c2fabaea554ba6e5336c11c6c124e59c6e96e
data/bin/maze-runner CHANGED
@@ -29,6 +29,7 @@ require_relative '../lib/maze/client/appium/bs_client'
29
29
  require_relative '../lib/maze/client/appium/bs_legacy_client'
30
30
  require_relative '../lib/maze/client/appium/bs_devices'
31
31
  require_relative '../lib/maze/client/appium/local_client'
32
+ require_relative '../lib/maze/client/appium/session_metadata'
32
33
  require_relative '../lib/maze/client/selenium'
33
34
  require_relative '../lib/maze/client/selenium/base_client'
34
35
  require_relative '../lib/maze/client/selenium/bb_client'
@@ -51,7 +52,6 @@ require_relative '../lib/maze/network'
51
52
  require_relative '../lib/maze/proxy'
52
53
  require_relative '../lib/maze/retry_handler'
53
54
  require_relative '../lib/maze/repeaters/request_repeater'
54
- require_relative '../lib/maze/repeaters/aspecto_repeater'
55
55
  require_relative '../lib/maze/repeaters/bugsnag_repeater'
56
56
  require_relative '../lib/maze/runner'
57
57
  require_relative '../lib/maze/terminating_server'
@@ -19,7 +19,7 @@ module Maze
19
19
  true
20
20
  rescue Selenium::WebDriver::Error::ServerError => e
21
21
  # Assume the remote appium session has stopped, so crash out of the session
22
- fail_driver
22
+ fail_driver(e.message)
23
23
  raise e
24
24
  end
25
25
 
@@ -35,7 +35,7 @@ module Maze
35
35
  true
36
36
  rescue Selenium::WebDriver::Error::ServerError => e
37
37
  # Assume the remote appium session has stopped, so crash out of the session
38
- fail_driver
38
+ fail_driver(e.message)
39
39
  raise e
40
40
  end
41
41
 
@@ -51,7 +51,7 @@ module Maze
51
51
  true
52
52
  rescue Selenium::WebDriver::Error::ServerError => e
53
53
  # Assume the remote appium session has stopped, so crash out of the session
54
- fail_driver
54
+ fail_driver(e.message)
55
55
  raise e
56
56
  end
57
57
 
@@ -67,7 +67,7 @@ module Maze
67
67
  true
68
68
  rescue Selenium::WebDriver::Error::ServerError => e
69
69
  # Assume the remote appium session has stopped, so crash out of the session
70
- fail_driver
70
+ fail_driver(e.message)
71
71
  raise e
72
72
  end
73
73
 
@@ -82,7 +82,7 @@ module Maze
82
82
  @driver.app_state(@driver.app_id)
83
83
  rescue Selenium::WebDriver::Error::ServerError => e
84
84
  # Assume the remote appium session has stopped, so crash out of the session
85
- fail_driver
85
+ fail_driver(e.message)
86
86
  raise e
87
87
  end
88
88
  end
@@ -20,7 +20,7 @@ module Maze
20
20
  true
21
21
  rescue Selenium::WebDriver::Error::ServerError => e
22
22
  # Assume the remote appium session has stopped, so crash out of the session
23
- fail_driver
23
+ fail_driver(e.message)
24
24
  raise e
25
25
  end
26
26
 
@@ -37,7 +37,7 @@ module Maze
37
37
  true
38
38
  rescue Selenium::WebDriver::Error::ServerError => e
39
39
  # Assume the remote appium session has stopped, so crash out of the session
40
- fail_driver
40
+ fail_driver(e.message)
41
41
  raise e
42
42
  end
43
43
 
@@ -52,7 +52,7 @@ module Maze
52
52
  JSON.generate(@driver.device_info)
53
53
  rescue Selenium::WebDriver::Error::ServerError => e
54
54
  # Assume the remote appium session has stopped, so crash out of the session
55
- fail_driver
55
+ fail_driver(e.message)
56
56
  raise e
57
57
  end
58
58
  end
@@ -36,7 +36,7 @@ module Maze
36
36
  false
37
37
  rescue Selenium::WebDriver::Error::ServerError => e
38
38
  # Assume the remote appium session has stopped, so crash out of the session
39
- fail_driver
39
+ fail_driver(e.message)
40
40
  raise e
41
41
  end
42
42
 
@@ -73,7 +73,7 @@ module Maze
73
73
  nil
74
74
  rescue Selenium::WebDriver::Error::ServerError => e
75
75
  # Assume the remote appium session has stopped, so crash out of the session
76
- fail_driver
76
+ fail_driver(e.message)
77
77
  raise e
78
78
  end
79
79
  end
@@ -11,8 +11,8 @@ module Maze
11
11
  @driver.failed?
12
12
  end
13
13
 
14
- def fail_driver
15
- @driver.fail_driver
14
+ def fail_driver(message)
15
+ @driver.fail_driver(message)
16
16
  end
17
17
  end
18
18
  end
@@ -8,7 +8,6 @@ module Maze
8
8
  FIXTURE_CONFIG = 'fixture_config.json'
9
9
 
10
10
  def initialize
11
- @session_ids = []
12
11
  @start_attempts = 0
13
12
  end
14
13
 
@@ -79,9 +78,9 @@ module Maze
79
78
  if result
80
79
  # Log details of this session
81
80
  $logger.info "Created Appium session: #{driver.session_id}"
82
- @session_ids << driver.session_id
83
- udid = driver.session_capabilities['udid']
84
- $logger.info "Running on device: #{udid}" unless udid.nil?
81
+ @session_metadata = Maze::Client::Appium::SessionMetadata.new
82
+ @session_metadata.id = driver.session_id
83
+ @session_metadata.farm = Maze.config.farm.to_s
85
84
  end
86
85
  driver
87
86
  end
@@ -147,9 +146,47 @@ module Maze
147
146
  end
148
147
 
149
148
  def stop_session
150
- Maze.driver.driver_quit unless Maze.driver.failed?
149
+ if Maze.driver.failed?
150
+ @session_metadata.success = false
151
+ @session_metadata.failure_message = Maze.driver.failure_reason
152
+ else
153
+ # TODO: The call to quit could also fail
154
+ Maze.driver.driver_quit
155
+ @session_metadata.success = true
156
+ end
157
+
158
+ # Report session outcome to Bugsnag
159
+ report_session if ENV['MAZE_APPIUM_BUGSNAG_API_KEY']
160
+
151
161
  Maze::AppiumServer.stop if Maze::AppiumServer.running
152
162
  end
163
+
164
+ def report_session
165
+ message = @session_metadata.success ? 'Success' : @session_metadata.failure_message
166
+ error = Exception.new(message)
167
+
168
+ Bugsnag.notify(error) do |event|
169
+ event.api_key = ENV['MAZE_APPIUM_BUGSNAG_API_KEY']
170
+ event.grouping_hash = event.exceptions.first[:message]
171
+
172
+ metadata = {
173
+ 'session id': @session_metadata.id,
174
+ 'success': @session_metadata.success,
175
+ 'device farm': @session_metadata.farm.to_s,
176
+ }
177
+ metadata['device'] = @session_metadata.device if @session_metadata.device
178
+
179
+ if @session_metadata.success
180
+ event.severity = 'info'
181
+ else
182
+ event.severity = 'error'
183
+ event.unhandled = true
184
+ metadata['failure message'] = @session_metadata.failure_message
185
+ end
186
+
187
+ event.add_metadata(:'Appium Session', metadata)
188
+ end
189
+ end
153
190
  end
154
191
  end
155
192
  end
@@ -91,14 +91,12 @@ module Maze
91
91
  def log_run_outro
92
92
  api_client = BitBarApiClient.new(Maze.config.access_key)
93
93
 
94
- $logger.info 'Appium session(s) created:'
95
- @session_ids.each do |id|
96
- info = api_client.get_device_session_info(id)
97
- if info
98
- link = Maze::Loggers::LogUtil.linkify(info[:dashboard_link], "BitBar session: #{id}")
99
- $logger.info link
100
- $logger.info "Device used: #{info[:device_name]}"
101
- end
94
+ info = api_client.get_device_session_info(@session_metadata.id)
95
+ if info
96
+ link = Maze::Loggers::LogUtil.linkify(info[:dashboard_link], "BitBar session: #{@session_metadata.id}")
97
+ $logger.info link
98
+ @session_metadata.device = info[:device_name]
99
+ $logger.info "Device used: #{@session_metadata.device}"
102
100
  end
103
101
  end
104
102
 
@@ -72,8 +72,7 @@ module Maze
72
72
  end
73
73
 
74
74
  def log_run_outro
75
- $logger.info 'Appium session(s) created:'
76
- @session_ids.each { |id| $logger.info " #{id}" }
75
+ $logger.info "Appium session created: #{@session_metadata.id}"
77
76
  log_run_intro
78
77
  end
79
78
 
@@ -75,7 +75,7 @@ module Maze
75
75
  'ANDROID_14' => make_android_hash('Google Pixel 8', '14.0'),
76
76
  'ANDROID_13' => make_android_hash('Google Pixel 6 Pro', '13.0'),
77
77
  'ANDROID_12' => make_android_hash('Google Pixel 5', '12.0'),
78
- 'ANDROID_11' => make_android_hash('Google Pixel 4', '11.0'),
78
+ 'ANDROID_11' => make_android_hash('Samsung Galaxy S21', '11.0'),
79
79
  'ANDROID_10' => make_android_hash('Google Pixel 4', '10.0'),
80
80
  'ANDROID_9' => make_android_hash('Google Pixel 3', '9.0'),
81
81
  'ANDROID_8' => make_android_hash('Samsung Galaxy S9', '8.0'),
@@ -92,8 +92,6 @@ module Maze
92
92
  }
93
93
 
94
94
  # Specific Android devices
95
- add_android 'Google Pixel 4', '11.0', hash # ANDROID_11_0_GOOGLE_PIXEL_4
96
-
97
95
  add_android 'Xiaomi Redmi Note 9', '10.0', hash # ANDROID_10_0_XIAOMI_REDMI_NOTE_9
98
96
  add_android 'Samsung Galaxy Note 20', '10.0', hash # ANDROID_10_0_SAMSUNG_GALAXY_NOTE_20
99
97
  add_android 'Motorola Moto G9 Play', '10.0', hash # ANDROID_10_0_MOTOROLA_MOTO_G9_PLAY
@@ -0,0 +1,18 @@
1
+ module Maze
2
+ module Client
3
+ module Appium
4
+ class SessionMetadata
5
+ def initialize
6
+ @success = false
7
+ @failure_message = 'Default failure message'
8
+ end
9
+
10
+ attr_accessor :id
11
+ attr_accessor :farm
12
+ attr_accessor :device
13
+ attr_accessor :success
14
+ attr_accessor :failure_message
15
+ end
16
+ end
17
+ end
18
+ end
@@ -88,6 +88,7 @@ module Maze
88
88
  }
89
89
  else
90
90
  $logger.warn "Could not retrieve details for device session #{session_id}, BitBar may not have had time to create it yet."
91
+ nil
91
92
  end
92
93
  end
93
94
 
@@ -72,9 +72,6 @@ module Maze
72
72
  # The server endpoints for which invalid requests should be captured and cause tests to fail
73
73
  attr_accessor :captured_invalid_requests
74
74
 
75
- # API key to use when repeating requests to Bugsnag
76
- attr_accessor :aspecto_repeater_api_key
77
-
78
75
  # API key to use when repeating requests to Bugsnag
79
76
  attr_accessor :bugsnag_repeater_api_key
80
77
 
@@ -33,6 +33,7 @@ module Maze
33
33
  capabilities ||= {}
34
34
 
35
35
  @failed = false
36
+ @failure_reason = ''
36
37
  @element_locator = locator
37
38
  @capabilities = capabilities
38
39
 
@@ -70,10 +71,15 @@ module Maze
70
71
  @failed
71
72
  end
72
73
 
74
+ def failure_reason
75
+ @failure_reason
76
+ end
77
+
73
78
  # Marks the driver as failed
74
- def fail_driver
75
- $logger.error 'Appium driver failed, remaining scenarios will be skipped'
79
+ def fail_driver(reason)
80
+ $logger.error "Appium driver failed: #{reason}"
76
81
  @failed = true
82
+ @failure_reason = reason
77
83
  end
78
84
 
79
85
  # Checks for an element, waiting until it is present or the method times out
@@ -95,7 +101,7 @@ module Maze
95
101
  end
96
102
  rescue Selenium::WebDriver::Error::ServerError => e
97
103
  # Assume the remote appium session has stopped, so crash out of the session
98
- fail_driver
104
+ fail_driver(e.message)
99
105
  raise e
100
106
  else
101
107
  true
@@ -106,7 +112,7 @@ module Maze
106
112
  super
107
113
  rescue Selenium::WebDriver::Error::ServerError => e
108
114
  # Assume the remote appium session has stopped, so crash out of the session
109
- fail_driver
115
+ fail_driver(e.message)
110
116
  raise e
111
117
  end
112
118
 
@@ -115,7 +121,7 @@ module Maze
115
121
  super
116
122
  rescue Selenium::WebDriver::Error::ServerError => e
117
123
  # Assume the remote appium session has stopped, so crash out of the session
118
- fail_driver
124
+ fail_driver(e.message)
119
125
  raise e
120
126
  end
121
127
 
@@ -126,7 +132,7 @@ module Maze
126
132
  end
127
133
  rescue Selenium::WebDriver::Error::ServerError => e
128
134
  # Assume the remote appium session has stopped, so crash out of the session
129
- fail_driver
135
+ fail_driver(e.message)
130
136
  raise e
131
137
  end
132
138
 
@@ -140,7 +146,7 @@ module Maze
140
146
  end
141
147
  rescue Selenium::WebDriver::Error::ServerError => e
142
148
  # Assume the remote appium session has stopped, so crash out of the session
143
- fail_driver
149
+ fail_driver(e.message)
144
150
  raise e
145
151
  end
146
152
 
@@ -158,7 +164,7 @@ module Maze
158
164
  false
159
165
  rescue Selenium::WebDriver::Error::ServerError => e
160
166
  # Assume the remote appium session has stopped, so crash out of the session
161
- fail_driver
167
+ fail_driver(e.message)
162
168
  raise e
163
169
  end
164
170
 
@@ -172,7 +178,7 @@ module Maze
172
178
  end
173
179
  rescue Selenium::WebDriver::Error::ServerError => e
174
180
  # Assume the remote appium session has stopped, so crash out of the session
175
- fail_driver
181
+ fail_driver(e.message)
176
182
  raise e
177
183
  end
178
184
 
@@ -197,7 +203,7 @@ module Maze
197
203
  end
198
204
  rescue Selenium::WebDriver::Error::ServerError => e
199
205
  # Assume the remote appium session has stopped, so crash out of the session
200
- fail_driver
206
+ fail_driver(e.message)
201
207
  raise e
202
208
  end
203
209
 
@@ -234,7 +240,7 @@ module Maze
234
240
  end
235
241
  rescue Selenium::WebDriver::Error::ServerError => e
236
242
  # Assume the remote appium session has stopped, so crash out of the session
237
- fail_driver
243
+ fail_driver(e.message)
238
244
  raise e
239
245
  end
240
246
 
@@ -47,11 +47,6 @@ module Maze
47
47
  short: :none,
48
48
  default: true
49
49
 
50
- opt Option::ASPECTO_REPEATER_API_KEY,
51
- 'Enables forwarding of all received POST requests to Aspecto, using the API key provided. MAZE_ASPECTO_REPEATER_API_KEY may also be set.',
52
- short: :none,
53
- type: :string
54
-
55
50
  opt Option::BUGSNAG_REPEATER_API_KEY,
56
51
  'Enables forwarding of all received POST requests to Bugsnag, using the API key provided. MAZE_REPEATER_API_KEY may also be set.',
57
52
  short: :none,
@@ -281,7 +276,6 @@ module Maze
281
276
  options[Option::SELENIUM_SERVER] ||= ENV['MAZE_SELENIUM_SERVER'] || 'https://us-west-desktop-hub.bitbar.com/wd/hub'
282
277
  end
283
278
 
284
- options[Option::ASPECTO_REPEATER_API_KEY] ||= ENV['MAZE_ASPECTO_REPEATER_API_KEY']
285
279
  options[Option::BUGSNAG_REPEATER_API_KEY] ||= ENV['MAZE_REPEATER_API_KEY']
286
280
  options[Option::SB_LOCAL] ||= ENV['MAZE_SB_LOCAL'] || '/SBSecureTunnel'
287
281
  options[Option::BS_LOCAL] ||= ENV['MAZE_BS_LOCAL'] || '/BrowserStackLocal'
@@ -22,8 +22,6 @@ module Maze
22
22
  config.aws_public_ip = options[Maze::Option::AWS_PUBLIC_IP]
23
23
  config.enable_retries = options[Maze::Option::RETRIES]
24
24
  config.enable_bugsnag = options[Maze::Option::BUGSNAG]
25
- aspecto_repeater_api_key = options[Maze::Option::ASPECTO_REPEATER_API_KEY]
26
- config.aspecto_repeater_api_key = aspecto_repeater_api_key unless aspecto_repeater_api_key&.empty?
27
25
  bugsnag_repeater_api_key = options[Maze::Option::BUGSNAG_REPEATER_API_KEY]
28
26
  config.bugsnag_repeater_api_key = bugsnag_repeater_api_key unless bugsnag_repeater_api_key&.empty?
29
27
 
data/lib/maze/option.rb CHANGED
@@ -56,7 +56,6 @@ module Maze
56
56
 
57
57
  # General options
58
58
  AWS_PUBLIC_IP = 'aws-public-ip'
59
- ASPECTO_REPEATER_API_KEY = 'aspecto-repeater-api-key'
60
59
  BUGSNAG_REPEATER_API_KEY = 'repeater-api-key'
61
60
  BUGSNAG = 'bugsnag'
62
61
  RETRIES = 'retries'
@@ -39,7 +39,6 @@ module Maze
39
39
  super server
40
40
  @request_type = request_type
41
41
  @schema = JSONSchemer.schema(schema) unless schema.nil?
42
- @aspecto_repeater = Maze::Repeaters::AspectoRepeater.new(@request_type)
43
42
  @bugsnag_repeater = Maze::Repeaters::BugsnagRepeater.new(@request_type)
44
43
  end
45
44
 
@@ -59,7 +58,6 @@ module Maze
59
58
  # @param response [HTTPResponse] The response to return
60
59
  def do_POST(request, response)
61
60
 
62
- @aspecto_repeater.repeat request
63
61
  @bugsnag_repeater.repeat request
64
62
 
65
63
  # Turn the WEBrick HttpRequest into our internal HttpRequest delegate
data/lib/maze.rb CHANGED
@@ -8,7 +8,7 @@ require_relative 'maze/timers'
8
8
  # providing an alternative to the proliferation of global variables or singletons.
9
9
  module Maze
10
10
 
11
- VERSION = '9.24.0'
11
+ VERSION = '9.25.0'
12
12
 
13
13
  class << self
14
14
  attr_accessor :check, :driver, :internal_hooks, :mode, :start_time, :dynamic_retry, :public_address,
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: 9.24.0
4
+ version: 9.25.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: 2025-03-04 00:00:00.000000000 Z
11
+ date: 2025-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -461,6 +461,7 @@ files:
461
461
  - lib/maze/client/appium/bs_devices.rb
462
462
  - lib/maze/client/appium/bs_legacy_client.rb
463
463
  - lib/maze/client/appium/local_client.rb
464
+ - lib/maze/client/appium/session_metadata.rb
464
465
  - lib/maze/client/bb_api_client.rb
465
466
  - lib/maze/client/bb_client_utils.rb
466
467
  - lib/maze/client/bs_client_utils.rb
@@ -507,7 +508,6 @@ files:
507
508
  - lib/maze/plugins/global_retry_plugin.rb
508
509
  - lib/maze/plugins/logging_scenarios_plugin.rb
509
510
  - lib/maze/proxy.rb
510
- - lib/maze/repeaters/aspecto_repeater.rb
511
511
  - lib/maze/repeaters/bugsnag_repeater.rb
512
512
  - lib/maze/repeaters/request_repeater.rb
513
513
  - lib/maze/request_list.rb
@@ -1,34 +0,0 @@
1
- module Maze
2
- module Repeaters
3
- # Repeats Bugsnag requests
4
- class AspectoRepeater < RequestRepeater
5
-
6
- private
7
-
8
- def set_headers(request)
9
- request['Authorization'] = Maze.config.aspecto_repeater_api_key
10
- end
11
-
12
- def enabled?
13
- # enabled if the config option is on and this request type should be repeated
14
- Maze.config.aspecto_repeater_api_key && url_for_request_type
15
- end
16
-
17
- def gzip_supported
18
- false
19
- end
20
-
21
- def url_for_request_type
22
- url = case @request_type
23
- when :traces then 'https://otelcol.aspecto.io:4318/v1/traces'
24
- else return nil
25
- end
26
- URI.parse(url)
27
- end
28
-
29
- def include_header?(key, _value)
30
- true unless key.start_with? 'bugsnag'
31
- end
32
- end
33
- end
34
- end