bugsnag-maze-runner 9.3.1 → 9.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/features/steps/request_assertion_steps.rb +14 -0
- data/lib/features/support/cucumber_types.rb +1 -1
- data/lib/features/support/internal_hooks.rb +2 -2
- data/lib/maze/api/exit_code.rb +2 -0
- data/lib/maze/bugsnag_config.rb +23 -1
- data/lib/maze/maze_output.rb +6 -1
- data/lib/maze/option/parser.rb +1 -1
- data/lib/maze/plugins/bugsnag_reporting_plugin.rb +3 -0
- data/lib/maze/server.rb +10 -0
- data/lib/maze/servlets/reflective_servlet.rb +22 -0
- data/lib/maze.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae769213765ead600bb5d24630e7ee9e64cb9cd4a0af662d907254aad577b325
|
4
|
+
data.tar.gz: '08c6383f74a282fc41e04e5d12828ca27506da7205bbc979992794edc468c242'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 995669002344c3dd20206512b9a3cd1efa17db026d2355b5db6f0e1e5b4f4911113b13f2366919468acf5ff5c9d49361e143bfa918596f08a406c78a4ea4cc40
|
7
|
+
data.tar.gz: 7bf1354e0233fc6f760bb2b6fa35827cb597cb005f3d80ee3f2f9182c3379186817fb5dca4bf248d6c65eaa83b4bd43282164e858e9b437ed1629deb4bf39b64
|
@@ -149,3 +149,17 @@ Then('the received errors match:') do |table|
|
|
149
149
|
end
|
150
150
|
Maze.check.equal(requests.size, match_count, 'Unexpected number of requests matched the received payloads')
|
151
151
|
end
|
152
|
+
|
153
|
+
# Verifies that a request was sent via a given method.
|
154
|
+
# Currently only supported with the reflective servlet.
|
155
|
+
#
|
156
|
+
# @step_input request_type [String] The type of request (error, session, build, etc)
|
157
|
+
# @step_input method [String] The request method expected (GET, POST, etc)
|
158
|
+
Then('the {request_type} request method equals {string}') do |request_type, method|
|
159
|
+
list = Maze::Server.list_for(request_type)
|
160
|
+
payload = list.current
|
161
|
+
if payload[:method].nil?
|
162
|
+
raise Test::Unit::AssertionFailedError.new("#{request_type} request had no receipt method listed")
|
163
|
+
end
|
164
|
+
Maze.check.equal(method, payload[:method], "Expected #{request_type} request method to be #{method}")
|
165
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
ParameterType(
|
2
2
|
name: 'request_type',
|
3
|
-
regexp: /errors?|sessions?|builds?|logs?|metrics?|sampling requests?|traces?|uploads?|sourcemaps?|invalid requests?/,
|
3
|
+
regexp: /errors?|sessions?|builds?|logs?|metrics?|sampling requests?|traces?|uploads?|sourcemaps?|reflects?|reflections?|invalid requests?/,
|
4
4
|
type: String,
|
5
5
|
transformer: ->(s) { s }
|
6
6
|
)
|
@@ -95,8 +95,8 @@ InstallPlugin do |config|
|
|
95
95
|
# Add step logging
|
96
96
|
config.filters << Maze::Plugins::LoggingScenariosPlugin.new(config)
|
97
97
|
|
98
|
-
#
|
99
|
-
|
98
|
+
# Add bugsnag failed scenario reporting only if ENV['MAZE_SCENARIO_BUGSNAG_API_KEY'] is present
|
99
|
+
config.filters << Maze::Plugins::BugsnagReportingPlugin.new(config) unless ENV['MAZE_SCENARIO_BUGSNAG_API_KEY'].nil?
|
100
100
|
end
|
101
101
|
|
102
102
|
# Before each scenario
|
data/lib/maze/api/exit_code.rb
CHANGED
@@ -12,6 +12,8 @@ module Maze
|
|
12
12
|
TUNNEL_FAILURE = 101
|
13
13
|
SESSION_CREATION_FAILURE = 102
|
14
14
|
APPIUM_SESSION_FAILURE = 103
|
15
|
+
# A catch-all for certain errors related to Appium failures when the app is running app hang or ANR tests
|
16
|
+
APPIUM_APP_HANG_FAILURE = 104
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
data/lib/maze/bugsnag_config.rb
CHANGED
@@ -11,7 +11,6 @@ module Maze
|
|
11
11
|
Bugsnag.configure do |config|
|
12
12
|
config.api_key = ENV['MAZE_BUGSNAG_API_KEY']
|
13
13
|
config.app_version = Maze::VERSION
|
14
|
-
config.discard_classes << 'Test::Unit::AssertionFailedError'
|
15
14
|
config.add_metadata(:'test driver', {
|
16
15
|
'driver type': Maze.driver.class,
|
17
16
|
'device farm': Maze.config.farm,
|
@@ -32,6 +31,7 @@ module Maze
|
|
32
31
|
metadata['job url'] = ENV['BUILDKITE_BUILD_URL'] + "#" + ENV['BUILDKITE_JOB_ID']
|
33
32
|
end
|
34
33
|
end
|
34
|
+
config.middleware.use(AssertErrorMiddleware)
|
35
35
|
config.add_metadata(:'buildkite', metadata)
|
36
36
|
config.project_root = Dir.pwd
|
37
37
|
end
|
@@ -45,5 +45,27 @@ module Maze
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
48
|
+
|
49
|
+
class AssertErrorMiddleware
|
50
|
+
IGNORE_CLASS_NAME = 'Test::Unit::AssertionFailedError'
|
51
|
+
|
52
|
+
# @param middleware [#call] The next middleware to call
|
53
|
+
def initialize(middleware)
|
54
|
+
@middleware = middleware
|
55
|
+
end
|
56
|
+
|
57
|
+
def call(report)
|
58
|
+
# Only ignore automated notifies with assertion errors
|
59
|
+
automated = report.unhandled
|
60
|
+
|
61
|
+
class_match = report.raw_exceptions.any? do |ex|
|
62
|
+
ex.class.name.eql?(IGNORE_CLASS_NAME)
|
63
|
+
end
|
64
|
+
|
65
|
+
report.ignore! if automated && class_match
|
66
|
+
|
67
|
+
@middleware.call(report)
|
68
|
+
end
|
69
|
+
end
|
48
70
|
end
|
49
71
|
end
|
data/lib/maze/maze_output.rb
CHANGED
@@ -13,7 +13,7 @@ module Maze
|
|
13
13
|
path = output_folder
|
14
14
|
FileUtils.makedirs(path)
|
15
15
|
|
16
|
-
request_types = %w[errors sessions builds uploads logs sourcemaps traces invalid]
|
16
|
+
request_types = %w[errors sessions builds uploads logs sourcemaps traces invalid reflections]
|
17
17
|
request_types << 'sampling requests'
|
18
18
|
|
19
19
|
request_types.each do |request_type|
|
@@ -51,6 +51,11 @@ module Maze
|
|
51
51
|
end
|
52
52
|
file.puts
|
53
53
|
|
54
|
+
if request.include?(:query)
|
55
|
+
file.puts "Query:"
|
56
|
+
file.puts JSON.pretty_generate(request[:query])
|
57
|
+
end
|
58
|
+
|
54
59
|
file.puts "Request body:"
|
55
60
|
if !invalid_request && headers["content-type"].first == 'application/json'
|
56
61
|
file.puts JSON.pretty_generate(body)
|
data/lib/maze/option/parser.rb
CHANGED
@@ -42,7 +42,7 @@ module Maze
|
|
42
42
|
default: true
|
43
43
|
|
44
44
|
opt Option::BUGSNAG,
|
45
|
-
'Enables reporting to Bugsnag on scenario failure (requires MAZE_BUGSNAG_API_KEY)',
|
45
|
+
'Enables reporting to Bugsnag on scenario failure (requires MAZE_BUGSNAG_API_KEY for errors, MAZE_SCENARIO_BUGSNAG_API_KEY for test failures)',
|
46
46
|
type: :boolean,
|
47
47
|
short: :none,
|
48
48
|
default: true
|
@@ -25,6 +25,9 @@ module Maze
|
|
25
25
|
next unless event.test_case.eql?(test_case) && event.result.failed?
|
26
26
|
|
27
27
|
Bugsnag.notify(event.result.exception) do |bsg_event|
|
28
|
+
|
29
|
+
bsg_event.api_key = ENV['MAZE_SCENARIO_BUGSNAG_API_KEY']
|
30
|
+
|
28
31
|
unless @last_test_step.nil?
|
29
32
|
|
30
33
|
repo = ENV['BUILDKITE_PIPELINE_SLUG']
|
data/lib/maze/server.rb
CHANGED
@@ -93,6 +93,8 @@ module Maze
|
|
93
93
|
uploads
|
94
94
|
when 'sourcemap', 'sourcemaps'
|
95
95
|
sourcemaps
|
96
|
+
when 'reflect', 'reflects', 'reflection', 'reflections'
|
97
|
+
reflections
|
96
98
|
when 'invalid', 'invalid requests'
|
97
99
|
invalid_requests
|
98
100
|
else
|
@@ -163,6 +165,13 @@ module Maze
|
|
163
165
|
@metrics ||= RequestList.new
|
164
166
|
end
|
165
167
|
|
168
|
+
# A list of reflection requests received
|
169
|
+
#
|
170
|
+
# @return [RequestList] Received reflection requests
|
171
|
+
def reflections
|
172
|
+
@reflections ||= RequestList.new
|
173
|
+
end
|
174
|
+
|
166
175
|
# A list of commands for a test fixture to perform. Strictly speaking these are responses to HTTP
|
167
176
|
# requests, but the list behavior is all we need.
|
168
177
|
#
|
@@ -272,6 +281,7 @@ module Maze
|
|
272
281
|
traces.clear
|
273
282
|
logs.clear
|
274
283
|
invalid_requests.clear
|
284
|
+
reflections.clear
|
275
285
|
end
|
276
286
|
end
|
277
287
|
end
|
@@ -11,6 +11,8 @@ module Maze
|
|
11
11
|
# for POST requests they are expected to be given as JSON fields.
|
12
12
|
class ReflectiveServlet < BaseServlet
|
13
13
|
|
14
|
+
REFLECTION_REQUEST_TYPE = 'reflection'
|
15
|
+
|
14
16
|
# Accepts a GET request to provide a reflective response to.
|
15
17
|
#
|
16
18
|
# @param request [HTTPRequest] The incoming GET request
|
@@ -18,6 +20,16 @@ module Maze
|
|
18
20
|
def do_GET(request, response)
|
19
21
|
delay_ms = request.query['delay_ms']
|
20
22
|
status = request.query['status']
|
23
|
+
|
24
|
+
logged_request = {
|
25
|
+
body: {},
|
26
|
+
query: Rack::Utils.parse_nested_query(request.query_string),
|
27
|
+
request: request,
|
28
|
+
response: response,
|
29
|
+
method: 'GET'
|
30
|
+
}
|
31
|
+
Server.list_for(REFLECTION_REQUEST_TYPE).add(logged_request)
|
32
|
+
|
21
33
|
reflect response, delay_ms, status
|
22
34
|
end
|
23
35
|
|
@@ -36,10 +48,20 @@ module Maze
|
|
36
48
|
status = body['status']
|
37
49
|
else
|
38
50
|
query = Rack::Utils.parse_nested_query(request.query_string)
|
51
|
+
body = {}
|
39
52
|
delay_ms = query['delay_ms']
|
40
53
|
status = query['status']
|
41
54
|
end
|
42
55
|
|
56
|
+
logged_request = {
|
57
|
+
body: body,
|
58
|
+
request: request,
|
59
|
+
response: response,
|
60
|
+
method: 'POST'
|
61
|
+
}
|
62
|
+
logged_request[:query] = query if query
|
63
|
+
Server.list_for(REFLECTION_REQUEST_TYPE).add(logged_request)
|
64
|
+
|
43
65
|
reflect response, delay_ms, status
|
44
66
|
rescue JSON::ParserError => e
|
45
67
|
Bugsnag.notify e
|
data/lib/maze.rb
CHANGED
@@ -7,7 +7,7 @@ require_relative 'maze/timers'
|
|
7
7
|
# Glues the various parts of MazeRunner together that need to be accessed globally,
|
8
8
|
# providing an alternative to the proliferation of global variables or singletons.
|
9
9
|
module Maze
|
10
|
-
VERSION = '9.
|
10
|
+
VERSION = '9.5.0'
|
11
11
|
|
12
12
|
class << self
|
13
13
|
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.
|
4
|
+
version: 9.5.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: 2024-03-
|
11
|
+
date: 2024-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|