bugsnag-maze-runner 9.4.0 → 9.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebfe5ec9f34345cf0f5c2cbb5d94f9ed3ebfce52ad87f4e69580103c57c57870
4
- data.tar.gz: cf4a7628f486f944dda441b62caa8945fe315106e96966f4ffde1a40cee23c6d
3
+ metadata.gz: 7c5244250d40c6b3b44f775401c136e2f61e87779135858b5533e40875658190
4
+ data.tar.gz: 9cab0c07bc4db58a9ec93e4b25157a7749f5bb53a03812e1420270da48f38729
5
5
  SHA512:
6
- metadata.gz: a03d87778582af7a94ff562b0794db23dfb4b9fc73df5545fec781514583f38b7f1cdf7cdf98dd9363a51089680bc84c43d8361d8471e08e29fd4182ae16d4f1
7
- data.tar.gz: 00d069f3ad7eb7f6d96bd89d08714f82507567c94ef518b3373fb0c5a533752e1fc63c396bc2ffee47be6042fa41975a00a21da91e249cc6b6e24559ed845b77
6
+ metadata.gz: b80d77bb8d388956f6acbefce51c3482b7450feb01dda66d655e9e682c89dc4b118f20d14bd63b0289092a27bce4dfb923332bf364a051e382b46e86ad8cf852
7
+ data.tar.gz: 3ddc5d20186dee38db31c3db556e5454b9bd825caf6cef96ef18b92b3f503c2771f2f78afa8bf22d262fbdef0165d66e280daae764ab0b15d4db441811eac63e
@@ -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
  )
@@ -32,6 +32,7 @@ module Maze
32
32
  end
33
33
  end
34
34
  config.middleware.use(AssertErrorMiddleware)
35
+ config.middleware.use(AmbiguousErrorMiddleware)
35
36
  config.add_metadata(:'buildkite', metadata)
36
37
  config.project_root = Dir.pwd
37
38
  end
@@ -67,5 +68,25 @@ module Maze
67
68
  @middleware.call(report)
68
69
  end
69
70
  end
71
+
72
+ class AmbiguousErrorMiddleware
73
+ AMBIGUOUS_ERROR_CLASSES = [
74
+ 'Selenium::WebDriver::Error::ServerError',
75
+ 'Selenium::WebDriver::Error::UnknownError'
76
+ ]
77
+
78
+ def initialize(middleware)
79
+ @middleware = middleware
80
+ end
81
+
82
+ def call(report)
83
+ first_ex = report.raw_exceptions.first
84
+ if AMBIGUOUS_ERROR_CLASSES.include?(first_ex.class.name)
85
+ report.grouping_hash = first_ex.class.name.to_s + first_ex.message.to_s
86
+ end
87
+
88
+ @middleware.call(report)
89
+ end
90
+ end
70
91
  end
71
92
  end
@@ -84,10 +84,8 @@ module Maze
84
84
  'IOS_16' => make_ios_hash('iPhone 14', '16'),
85
85
  'IOS_15' => make_ios_hash('iPhone 11 Pro', '15'),
86
86
  'IOS_14' => make_ios_hash('iPhone 11', '14'),
87
- 'IOS_13' => make_ios_hash('iPhone 8', '13'),
87
+ 'IOS_13' => make_ios_hash('iPhone 11', '13'),
88
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
89
  }
92
90
 
93
91
  # Specific Android devices
@@ -100,10 +98,8 @@ module Maze
100
98
 
101
99
  add_android 'Google Pixel 2', '9.0', hash # ANDROID_9_0_GOOGLE_PIXEL_2
102
100
  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
101
  add_android 'Samsung Galaxy Tab S4', '8.1', hash # ANDROID_8_1_SAMSUNG_GALAXY_TAB_S4
105
102
  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
103
  add_android 'Samsung Galaxy S9', '8.0', hash # ANDROID_8_0_SAMSUNG_GALAXY_S9
108
104
  add_android 'Samsung Galaxy S9 Plus', '8.0', hash # ANDROID_8_0_SAMSUNG_GALAXY_S9_PLUS
109
105
 
@@ -119,18 +115,6 @@ module Maze
119
115
  add_ios 'iPhone 14 Pro', '16.0', hash # IOS_16_0_IPHONE_14_PRO
120
116
  add_ios 'iPhone 14 Pro Max', '16.0', hash # IOS_16_0_IPHONE_14_PRO_MAX
121
117
 
122
- add_ios 'iPhone 8 Plus', '11.0', hash # IOS_11_0_IPHONE_8_PLUS
123
- add_ios 'iPhone X', '11.0', hash # IOS_11_0_IPHONE_X
124
- add_ios 'iPhone SE', '11.0', hash # IOS_11_0_IPHONE_SE
125
- add_ios 'iPhone 6', '11.0', hash # IOS_11_0_IPHONE_6
126
- add_ios 'iPhone 6S', '11.0', hash # IOS_11_0_IPHONE_6S
127
- add_ios 'iPhone 6S Plus', '11.0', hash # IOS_11_0_IPHONE_6S_PLUS
128
- add_ios 'iPad 5th', '11.0', hash # IOS_11_0_IPAD_5TH
129
- add_ios 'iPad Mini 4', '11.0', hash # IOS_11_0_IPAD_MINI_4
130
- add_ios 'iPad Pro 9.7 2016', '11.0', hash # IOS_11_0_IPAD_PRO_9_7_2016
131
- add_ios 'iPad 6th', '11.0', hash # IOS_11_0_IPAD_6TH
132
- add_ios 'iPad Pro 12.9', '11.0', hash # IOS_11_0_IPAD_PRO_12_9
133
-
134
118
  hash
135
119
  end
136
120
  end
@@ -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/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.4.0'
10
+ VERSION = '9.6.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.0
4
+ version: 9.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Kirkland
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-07 00:00:00.000000000 Z
11
+ date: 2024-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -454,11 +454,11 @@ files:
454
454
  - lib/maze/wait.rb
455
455
  - lib/utils/deep_merge.rb
456
456
  - lib/utils/selenium_money_patch.rb
457
- homepage:
457
+ homepage:
458
458
  licenses:
459
459
  - MIT
460
460
  metadata: {}
461
- post_install_message:
461
+ post_install_message:
462
462
  rdoc_options: []
463
463
  require_paths:
464
464
  - lib
@@ -473,8 +473,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
473
473
  - !ruby/object:Gem::Version
474
474
  version: '0'
475
475
  requirements: []
476
- rubygems_version: 3.1.6
477
- signing_key:
476
+ rubygems_version: 3.5.3
477
+ signing_key:
478
478
  specification_version: 4
479
479
  summary: Bugsnag API request validation harness
480
480
  test_files: []