bugsnag-maze-runner 9.30.1 → 9.30.2
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 +4 -4
- data/bin/maze-runner +3 -1
- data/lib/features/support/internal_hooks.rb +21 -8
- data/lib/maze/error_monitor/assert_error_middleware.rb +25 -0
- data/lib/maze/error_monitor/config.rb +59 -0
- data/lib/maze/error_monitor/selenium_error_middleware.rb +39 -0
- data/lib/maze.rb +1 -1
- data/lib/utils/selenium_money_patch.rb +2 -2
- metadata +5 -3
- data/lib/maze/bugsnag_config.rb +0 -89
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7b70886a65bf3d2dca12cbc185bf1acab92602ac09d9f6270545bdafd3e9a10
|
4
|
+
data.tar.gz: ecb634c131f56ba423a5e18ec7e0d7659a65093bf2de372cfe56c7fd1aa90618
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebd58859f86f68ff7494579679a24e62b9355f148a1f4a1310c0da2592f61694a0c0502513e83f623e09b57b1606d2d8a2ac9f99b8cd0d3c292abb436478cae6
|
7
|
+
data.tar.gz: bff5329c5ef8dff56f098db97089ac55e2327352be1c8fe8dd9950b2e676f608a8343d7533be3d74ea215083a87de9adaa0c716a796d97fed2d287fe8f8c926a
|
data/bin/maze-runner
CHANGED
@@ -18,7 +18,9 @@ require_relative '../lib/maze/api/appium/file_manager'
|
|
18
18
|
require_relative '../lib/maze/api/appium/ui_manager'
|
19
19
|
require_relative '../lib/maze/api/cucumber/scenario'
|
20
20
|
require_relative '../lib/maze/api/exit_code'
|
21
|
-
require_relative '../lib/maze/
|
21
|
+
require_relative '../lib/maze/error_monitor/selenium_error_middleware'
|
22
|
+
require_relative '../lib/maze/error_monitor/assert_error_middleware'
|
23
|
+
require_relative '../lib/maze/error_monitor/config'
|
22
24
|
require_relative '../lib/maze/client/bb_api_client'
|
23
25
|
require_relative '../lib/maze/client/bb_client_utils'
|
24
26
|
require_relative '../lib/maze/client/bs_client_utils'
|
@@ -80,7 +80,7 @@ end
|
|
80
80
|
# @param config The Cucumber config
|
81
81
|
InstallPlugin do |config|
|
82
82
|
# Start Bugsnag
|
83
|
-
Maze::
|
83
|
+
Maze::ErrorMonitor::Config.start_bugsnag(config)
|
84
84
|
|
85
85
|
if config.fail_fast?
|
86
86
|
# Register exit code handler
|
@@ -210,22 +210,35 @@ def output_received_requests(request_type)
|
|
210
210
|
request_queue.all.each.with_index(1) do |request, number|
|
211
211
|
$stdout.puts "--- #{request_type} #{number} of #{count}"
|
212
212
|
|
213
|
-
$logger.info 'Request
|
213
|
+
$logger.info 'Request:'
|
214
214
|
Maze::Loggers::LogUtil.log_hash(Logger::Severity::INFO, request[:body])
|
215
|
-
|
216
|
-
$logger.info 'Request headers:'
|
217
|
-
Maze::Loggers::LogUtil.log_hash(Logger::Severity::INFO, request[:request].header)
|
215
|
+
log_headers(request[:request])
|
218
216
|
|
219
217
|
$logger.info 'Request digests:'
|
220
218
|
Maze::Loggers::LogUtil.log_hash(Logger::Severity::INFO, request[:digests])
|
221
219
|
|
222
|
-
|
223
|
-
|
224
|
-
|
220
|
+
unless request[:response].nil?
|
221
|
+
$logger.info "Response: #{request[:response].body}"
|
222
|
+
log_headers(request[:response])
|
223
|
+
end
|
225
224
|
end
|
226
225
|
end
|
227
226
|
end
|
228
227
|
|
228
|
+
def log_headers(container)
|
229
|
+
header = if container.respond_to?(:header)
|
230
|
+
container.header
|
231
|
+
elsif container.key?('header') || container.key?(:header)
|
232
|
+
container['header'] || container[:header]
|
233
|
+
else
|
234
|
+
nil
|
235
|
+
end
|
236
|
+
unless header.nil?
|
237
|
+
$logger.info 'Headers:'
|
238
|
+
Maze::Loggers::LogUtil.log_hash(Logger::Severity::INFO, header)
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
229
242
|
# Check for invalid requests after each scenario. This is its own hook as failing a scenario (which
|
230
243
|
# Maze.scenario.complete may invoke) raises an exception and we need the logic in the other After hook to be performed.
|
231
244
|
#
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Maze
|
2
|
+
module ErrorMonitor
|
3
|
+
class AssertErrorMiddleware
|
4
|
+
IGNORE_CLASS_NAME = 'Test::Unit::AssertionFailedError'
|
5
|
+
|
6
|
+
# @param middleware [#call] The next middleware to call
|
7
|
+
def initialize(middleware)
|
8
|
+
@middleware = middleware
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(report)
|
12
|
+
# Only ignore automated notifies with assertion errors
|
13
|
+
automated = report.unhandled
|
14
|
+
|
15
|
+
class_match = report.raw_exceptions.any? do |ex|
|
16
|
+
ex.class.name.eql?(IGNORE_CLASS_NAME)
|
17
|
+
end
|
18
|
+
|
19
|
+
report.ignore! if automated && class_match
|
20
|
+
|
21
|
+
@middleware.call(report)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'bugsnag'
|
2
|
+
|
3
|
+
# Contains logic for running Bugsnag
|
4
|
+
module Maze
|
5
|
+
module ErrorMonitor
|
6
|
+
# This class is responsible for configuring Bugsnag
|
7
|
+
# and setting up the middleware for error reporting.
|
8
|
+
#
|
9
|
+
# @api private
|
10
|
+
#
|
11
|
+
# @see https://docs.bugsnag.com/platforms/ruby/rails/
|
12
|
+
# @see https://docs.bugsnag.com/platforms/ruby/rails/middleware/
|
13
|
+
class Config
|
14
|
+
class << self
|
15
|
+
def start_bugsnag(cucumber_config)
|
16
|
+
# Use MAZE_BUGSNAG_API_KEY explicitly to avoid collisions with test env
|
17
|
+
return unless Maze.config.enable_bugsnag && ENV['MAZE_BUGSNAG_API_KEY']
|
18
|
+
|
19
|
+
Bugsnag.configure do |config|
|
20
|
+
config.api_key = ENV['MAZE_BUGSNAG_API_KEY']
|
21
|
+
config.app_version = Maze::VERSION
|
22
|
+
config.add_metadata(:'test driver', {
|
23
|
+
'driver type': Maze.driver.class,
|
24
|
+
'device farm': Maze.config.farm,
|
25
|
+
'capabilities': Maze.config.capabilities
|
26
|
+
}) if Maze.driver
|
27
|
+
|
28
|
+
if ENV['BUILDKITE']
|
29
|
+
metadata = {
|
30
|
+
'pipeline': ENV['BUILDKITE_PIPELINE_NAME'],
|
31
|
+
'repo': ENV['BUILDKITE_REPO'],
|
32
|
+
'build url': ENV['BUILDKITE_BUILD_URL'],
|
33
|
+
'branch': ENV['BUILDKITE_BRANCH'],
|
34
|
+
'builder': ENV['BUILDKITE_BUILD_CREATOR'],
|
35
|
+
'message': ENV['BUILDKITE_MESSAGE'],
|
36
|
+
'step': ENV['BUILDKITE_LABEL']
|
37
|
+
}
|
38
|
+
if ENV['BUILDKITE_JOB_ID']
|
39
|
+
metadata['job url'] = ENV['BUILDKITE_BUILD_URL'] + "#" + ENV['BUILDKITE_JOB_ID']
|
40
|
+
end
|
41
|
+
end
|
42
|
+
config.middleware.use(AssertErrorMiddleware)
|
43
|
+
config.middleware.use(SeleniumErrorMiddleware)
|
44
|
+
config.add_metadata(:'buildkite', metadata)
|
45
|
+
config.project_root = Dir.pwd
|
46
|
+
end
|
47
|
+
|
48
|
+
Bugsnag.start_session
|
49
|
+
|
50
|
+
at_exit do
|
51
|
+
if $!
|
52
|
+
Bugsnag.notify($!)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Maze
|
2
|
+
module ErrorMonitor
|
3
|
+
class SeleniumErrorMiddleware
|
4
|
+
|
5
|
+
def initialize(middleware)
|
6
|
+
@middleware = middleware
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(report)
|
10
|
+
first_ex = report.raw_exceptions.first
|
11
|
+
if first_ex.class.name.start_with?('Selenium::WebDriver')
|
12
|
+
report.grouping_hash = first_ex.class.name.to_s + sanitise(first_ex.message.to_s)
|
13
|
+
end
|
14
|
+
|
15
|
+
@middleware.call(report)
|
16
|
+
end
|
17
|
+
|
18
|
+
def sanitise(message)
|
19
|
+
regexes = [
|
20
|
+
{
|
21
|
+
pattern: /(An unknown server-side error occurred while processing the command. Original error: ')(.*)(' is still running after 500ms timeout)/,
|
22
|
+
replacement: '\1APP_NAME\3'
|
23
|
+
},
|
24
|
+
{
|
25
|
+
pattern: /(unexpected end of stream on )(http:\/\/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}:[0-9]{1,5}\/\.\.\.)/,
|
26
|
+
replacement: '\1URL'
|
27
|
+
}
|
28
|
+
]
|
29
|
+
|
30
|
+
regex = regexes.find{|r| message =~ r[:pattern]}
|
31
|
+
if regex
|
32
|
+
message.gsub(regex[:pattern], regex[:replacement])
|
33
|
+
else
|
34
|
+
message
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
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.30.
|
11
|
+
VERSION = '9.30.2'
|
12
12
|
|
13
13
|
class << self
|
14
14
|
attr_accessor :check, :driver, :internal_hooks, :mode, :start_time, :dynamic_retry, :public_address,
|
@@ -6,8 +6,8 @@ module Selenium
|
|
6
6
|
def initialize(response)
|
7
7
|
if response.is_a? String
|
8
8
|
super(response)
|
9
|
-
elsif response.is_a?
|
10
|
-
super("Status code #{response.code}
|
9
|
+
elsif response.is_a?(Selenium::WebDriver::Remote::Response) && response.payload.key?('message')
|
10
|
+
super("Status code #{response.code}: #{response.payload['message']}")
|
11
11
|
else
|
12
12
|
super(response.inspect)
|
13
13
|
end
|
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.30.
|
4
|
+
version: 9.30.2
|
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-05-
|
11
|
+
date: 2025-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -451,7 +451,6 @@ files:
|
|
451
451
|
- lib/maze/assertions/request_set_assertions.rb
|
452
452
|
- lib/maze/aws/sam.rb
|
453
453
|
- lib/maze/aws_public_ip.rb
|
454
|
-
- lib/maze/bugsnag_config.rb
|
455
454
|
- lib/maze/checks/assert_check.rb
|
456
455
|
- lib/maze/checks/noop_check.rb
|
457
456
|
- lib/maze/client/appium.rb
|
@@ -479,6 +478,9 @@ files:
|
|
479
478
|
- lib/maze/document_server.rb
|
480
479
|
- lib/maze/driver/appium.rb
|
481
480
|
- lib/maze/driver/browser.rb
|
481
|
+
- lib/maze/error_monitor/assert_error_middleware.rb
|
482
|
+
- lib/maze/error_monitor/config.rb
|
483
|
+
- lib/maze/error_monitor/selenium_error_middleware.rb
|
482
484
|
- lib/maze/errors.rb
|
483
485
|
- lib/maze/generator.rb
|
484
486
|
- lib/maze/helper.rb
|
data/lib/maze/bugsnag_config.rb
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
require 'bugsnag'
|
2
|
-
|
3
|
-
# Contains logic for running Bugsnag
|
4
|
-
module Maze
|
5
|
-
class BugsnagConfig
|
6
|
-
class << self
|
7
|
-
def start_bugsnag(cucumber_config)
|
8
|
-
# Use MAZE_BUGSNAG_API_KEY explicitly to avoid collisions with test env
|
9
|
-
return unless Maze.config.enable_bugsnag && ENV['MAZE_BUGSNAG_API_KEY']
|
10
|
-
|
11
|
-
Bugsnag.configure do |config|
|
12
|
-
config.api_key = ENV['MAZE_BUGSNAG_API_KEY']
|
13
|
-
config.app_version = Maze::VERSION
|
14
|
-
config.add_metadata(:'test driver', {
|
15
|
-
'driver type': Maze.driver.class,
|
16
|
-
'device farm': Maze.config.farm,
|
17
|
-
'capabilities': Maze.config.capabilities
|
18
|
-
}) if Maze.driver
|
19
|
-
|
20
|
-
if ENV['BUILDKITE']
|
21
|
-
metadata = {
|
22
|
-
'pipeline': ENV['BUILDKITE_PIPELINE_NAME'],
|
23
|
-
'repo': ENV['BUILDKITE_REPO'],
|
24
|
-
'build url': ENV['BUILDKITE_BUILD_URL'],
|
25
|
-
'branch': ENV['BUILDKITE_BRANCH'],
|
26
|
-
'builder': ENV['BUILDKITE_BUILD_CREATOR'],
|
27
|
-
'message': ENV['BUILDKITE_MESSAGE'],
|
28
|
-
'step': ENV['BUILDKITE_LABEL']
|
29
|
-
}
|
30
|
-
if ENV['BUILDKITE_JOB_ID']
|
31
|
-
metadata['job url'] = ENV['BUILDKITE_BUILD_URL'] + "#" + ENV['BUILDKITE_JOB_ID']
|
32
|
-
end
|
33
|
-
end
|
34
|
-
config.middleware.use(AssertErrorMiddleware)
|
35
|
-
config.middleware.use(AmbiguousErrorMiddleware)
|
36
|
-
config.add_metadata(:'buildkite', metadata)
|
37
|
-
config.project_root = Dir.pwd
|
38
|
-
end
|
39
|
-
|
40
|
-
Bugsnag.start_session
|
41
|
-
|
42
|
-
at_exit do
|
43
|
-
if $!
|
44
|
-
Bugsnag.notify($!)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
class AssertErrorMiddleware
|
51
|
-
IGNORE_CLASS_NAME = 'Test::Unit::AssertionFailedError'
|
52
|
-
|
53
|
-
# @param middleware [#call] The next middleware to call
|
54
|
-
def initialize(middleware)
|
55
|
-
@middleware = middleware
|
56
|
-
end
|
57
|
-
|
58
|
-
def call(report)
|
59
|
-
# Only ignore automated notifies with assertion errors
|
60
|
-
automated = report.unhandled
|
61
|
-
|
62
|
-
class_match = report.raw_exceptions.any? do |ex|
|
63
|
-
ex.class.name.eql?(IGNORE_CLASS_NAME)
|
64
|
-
end
|
65
|
-
|
66
|
-
report.ignore! if automated && class_match
|
67
|
-
|
68
|
-
@middleware.call(report)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
class AmbiguousErrorMiddleware
|
73
|
-
AMBIGUOUS_ERROR_CLASSES = %w[Selenium::WebDriver::Error::ServerError Selenium::WebDriver::Error::UnknownError]
|
74
|
-
|
75
|
-
def initialize(middleware)
|
76
|
-
@middleware = middleware
|
77
|
-
end
|
78
|
-
|
79
|
-
def call(report)
|
80
|
-
first_ex = report.raw_exceptions.first
|
81
|
-
if AMBIGUOUS_ERROR_CLASSES.include?(first_ex.class.name)
|
82
|
-
report.grouping_hash = first_ex.class.name.to_s + first_ex.message.to_s
|
83
|
-
end
|
84
|
-
|
85
|
-
@middleware.call(report)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|