bugsnag-maze-runner 8.0.2 → 8.1.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: 75d2f1ce0990ec5a8d580a1bd3e9b70d8b9a4dac7350db35b92dc98d91030aee
4
- data.tar.gz: f4b6442090aa19321583db6d7cf2189a2637659da40996cfee029f6b32b51e96
3
+ metadata.gz: d6f92bf72a1c2fee8ebf3c02540b2421a51a9afeab840766d5ba877e305dcca2
4
+ data.tar.gz: 44f1e82ee95506911c62a8ab2aaac242796003a12aac67789568dc6ad318f22b
5
5
  SHA512:
6
- metadata.gz: a06060657a765dadf0b51ed6472ad5d597619b8ad1b920dd751b8f22599a0470a48afa3c708e43fefcc19b897d1b4e12fb1bdb5dd3640575c93accfcd418f297
7
- data.tar.gz: d0c61e16312abc8bae8632cd67a0163103899d0c50b4614a9466a333b9598760d91326a07e4507763a5b8ecd589ca9b6b33a24d4144aff32c954df295a9b0a76
6
+ metadata.gz: 2ec472a8d9dcf83eb227a7f4f365212cd6cce2fe6816496fdcc89f4f69486f31adeb35dcf107dab96ffb50e47001c3be9f0003d7624c0eb6a71008bcbf750eac
7
+ data.tar.gz: 76493e21cd52a3124b529e1c496bd27f1c3e71cb1f3c5eb8623b290666491b0d9f1d947b45de28d6e7c980113825ae255e9f8e4e9e0f6c7dc3d3db5b1c3c7992
@@ -261,12 +261,12 @@ def get_attribute_value(field, attribute, attr_type)
261
261
  end
262
262
 
263
263
  def check_attribute_equal(field, attribute, attr_type, expected)
264
- value = get_attribute_value field, attribute, attr_type
265
- Maze.check.equal value, expected
264
+ actual = get_attribute_value field, attribute, attr_type
265
+ Maze.check.equal(expected, actual)
266
266
  end
267
267
 
268
268
  def assert_attribute(field, key, expected)
269
269
  list = Maze::Server.traces
270
270
  attributes = Maze::Helper.read_key_path(list.current[:body], "#{field}.attributes")
271
- Maze.check.equal attributes.find { |a| a['key'] == key }, { 'key' => key, 'value' => expected }
271
+ Maze.check.equal({ 'key' => key, 'value' => expected }, attributes.find { |a| a['key'] == key })
272
272
  end
@@ -176,7 +176,19 @@ def output_received_requests(request_type)
176
176
  $logger.info "#{count} #{request_type} were received:"
177
177
  request_queue.all.each.with_index(1) do |request, number|
178
178
  $stdout.puts "--- #{request_type} #{number} of #{count}"
179
- Maze::LogUtil.log_hash(Logger::Severity::INFO, request)
179
+
180
+ $logger.info 'Request body:'
181
+ Maze::LogUtil.log_hash(Logger::Severity::INFO, request[:body])
182
+
183
+ $logger.info 'Request headers:'
184
+ Maze::LogUtil.log_hash(Logger::Severity::INFO, request[:request].header)
185
+
186
+ $logger.info 'Request digests:'
187
+ Maze::LogUtil.log_hash(Logger::Severity::INFO, request[:digests])
188
+
189
+ $logger.info "Response body: #{request[:response].body}"
190
+ $logger.info 'Response headers:'
191
+ Maze::LogUtil.log_hash(Logger::Severity::INFO, request[:response].header)
180
192
  end
181
193
  end
182
194
  end
@@ -111,7 +111,7 @@ module Maze
111
111
  end
112
112
 
113
113
  def delete_project (id)
114
- response = query_api "projects/#{id}"
114
+ response = query_api "projects/#{id}", nil, USER_SPECIFIC_URI, "delete"
115
115
  end
116
116
 
117
117
  private
@@ -22,10 +22,14 @@ module Maze
22
22
  elsif [:bb, :bs, :local].include? Maze.config.farm
23
23
  write_device_logs(scenario) if scenario.failed?
24
24
 
25
- # appium_lib 12 says that reset is deprecated and activate_app/terminate_app should be used
26
- # instead. However, they do not clear out app data, which we need between scenarios.
27
- # install_app/remove_app might also be an option to consider.
28
- Maze.driver.reset
25
+ # TODO: PLAT-10300 - Review our general approach to resetting the app between scenarios
26
+ re = Regexp.new('^1\.1[56]\.\d$')
27
+ if re.match? Maze.config.appium_version
28
+ Maze.driver.close_app
29
+ Maze.driver.launch_app
30
+ else
31
+ Maze.driver.reset
32
+ end
29
33
  end
30
34
  end
31
35
 
data/lib/maze/logger.rb CHANGED
@@ -79,7 +79,8 @@ module Maze
79
79
  log_hash_by_field severity, data
80
80
  end
81
81
  rescue Encoding::UndefinedConversionError
82
- log_hash_by_field severity, data
82
+ # Just give up, we don't want to risk a further error trying to log garbage
83
+ $logger.error 'Unable to log hash as JSON'
83
84
  end
84
85
  end
85
86
 
@@ -26,6 +26,8 @@ module Maze
26
26
  File.open(filepath, 'w+') do |file|
27
27
  list.each do |request|
28
28
  file.puts "=== Request #{counter} of #{list.size} ==="
29
+ file.puts
30
+
29
31
  if request[:invalid]
30
32
  invalid_request = true
31
33
  uri = request[:request][:request_uri]
@@ -37,13 +39,18 @@ module Maze
37
39
  headers = request[:request].header
38
40
  body = request[:body]
39
41
  end
42
+
40
43
  file.puts "URI: #{uri}"
41
- file.puts "HEADERS:"
44
+ file.puts
45
+
46
+ # Request
47
+ file.puts "Request:"
42
48
  headers.each do |key, values|
43
49
  file.puts " #{key}: #{values.map {|v| "'#{v}'"}.join(' ')}"
44
50
  end
45
51
  file.puts
46
- file.puts "BODY:"
52
+
53
+ file.puts "Request body:"
47
54
  if !invalid_request && headers["content-type"].first == 'application/json'
48
55
  file.puts JSON.pretty_generate(body)
49
56
  else
@@ -55,6 +62,22 @@ module Maze
55
62
  file.puts request[:reason]
56
63
  file.puts
57
64
  end
65
+ file.puts
66
+
67
+ file.puts "Request digests:"
68
+ file.puts JSON.pretty_generate(request[:digests])
69
+ file.puts
70
+
71
+ # Response
72
+ response = request[:response]
73
+ file.puts "Response headers:"
74
+ file.puts JSON.pretty_generate(response.header)
75
+ file.puts
76
+
77
+ file.puts "Response body: #{response.body}"
78
+ file.puts
79
+ file.puts
80
+
58
81
  counter += 1
59
82
  end
60
83
  end
@@ -22,7 +22,8 @@ module Maze
22
22
  def do_POST(request, response)
23
23
  hash = {
24
24
  body: JSON.parse(request.body),
25
- request: request
25
+ request: request,
26
+ response: response
26
27
  }
27
28
  @requests.add(hash)
28
29
 
@@ -34,6 +35,7 @@ module Maze
34
35
  Server.invalid_requests.add({
35
36
  reason: msg,
36
37
  request: request,
38
+ response: response,
37
39
  body: request.body
38
40
  })
39
41
  rescue StandardError => e
@@ -45,7 +47,8 @@ module Maze
45
47
  request_uri: request.request_uri,
46
48
  header: request.header.to_h,
47
49
  body: request.inspect
48
- }
50
+ },
51
+ response: response
49
52
  })
50
53
  end
51
54
 
@@ -62,7 +62,7 @@ module Maze
62
62
  @bugsnag_repeater.repeat request
63
63
 
64
64
  # Turn the WEBrick HttpRequest into our internal HttpRequest delegate
65
- request = HttpRequest.new(request)
65
+ request = Maze::HttpRequest.new(request)
66
66
 
67
67
  content_type = request['Content-Type']
68
68
  if %r{^multipart/form-data; boundary=([^;]+)}.match(content_type)
@@ -70,7 +70,8 @@ module Maze
70
70
  body = WEBrick::HTTPUtils.parse_form_data(request.body, boundary)
71
71
  hash = {
72
72
  body: body,
73
- request: request
73
+ request: request,
74
+ response: response
74
75
  }
75
76
  else
76
77
  # "content-type" is assumed to be JSON (which mimics the behaviour of
@@ -80,6 +81,7 @@ module Maze
80
81
  hash = {
81
82
  body: JSON.parse(request.body),
82
83
  request: request,
84
+ response: response,
83
85
  digests: digests
84
86
  }
85
87
  end
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 = '8.0.2'
10
+ VERSION = '8.1.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: 8.0.2
4
+ version: 8.1.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-06-15 00:00:00.000000000 Z
11
+ date: 2023-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber