bugsnag-maze-runner 7.26.1 → 7.27.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 +4 -4
- data/bin/maze-runner +1 -0
- data/lib/features/steps/request_assertion_steps.rb +0 -54
- data/lib/features/steps/trace_steps.rb +3 -0
- data/lib/features/support/internal_hooks.rb +9 -0
- data/lib/maze/client/selenium/bb_browsers.yml +0 -70
- data/lib/maze/client/selenium/bb_client.rb +1 -3
- data/lib/maze/configuration.rb +6 -3
- data/lib/maze/option/parser.rb +11 -3
- data/lib/maze/option/processor.rb +2 -1
- data/lib/maze/option.rb +2 -1
- data/lib/maze/schemas/validator.rb +74 -0
- data/lib/maze.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2158a5376e4ff1d6c63a70eb138c33a2021aa7baff47f28882821e62a09fd0f
|
4
|
+
data.tar.gz: cd74c9cc69173584b6bf4c28a7fbaffdc3e115db09b38bfc507242f14726689e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 541182a68461d87cb7e2dd118cb6418fec9c4f3f2624622673ea12d16e695b81fd10ad6398e6a04c1446096a4c67e0b067f003687d326053258c20c77fc3e0cb
|
7
|
+
data.tar.gz: f033d06ba478c06163397026626b180cabdcbf7f2b246878d7415905c0af8a3ca46c26a044dbbf111599cc0860445ace5c8eb89b74d3a0f1d94cb9be907e2573
|
data/bin/maze-runner
CHANGED
@@ -58,6 +58,7 @@ require_relative '../lib/maze/assertions/request_set_assertions'
|
|
58
58
|
|
59
59
|
require_relative '../lib/maze/schemas/trace_schema'
|
60
60
|
require_relative '../lib/maze/schemas/trace_validator'
|
61
|
+
require_relative '../lib/maze/schemas/validator'
|
61
62
|
|
62
63
|
require_relative '../lib/maze/store'
|
63
64
|
require_relative '../lib/maze/timers'
|
@@ -31,60 +31,6 @@ def assert_received_requests(request_count, list, list_name, precise = true)
|
|
31
31
|
else
|
32
32
|
Maze.check.operator(request_count, :<=, list.size_remaining, "#{list.size_remaining} #{list_name} received")
|
33
33
|
end
|
34
|
-
|
35
|
-
verify_schema_matches(list, list_name)
|
36
|
-
validate_payload_elements(list, list_name)
|
37
|
-
end
|
38
|
-
|
39
|
-
def verify_schema_matches(list, list_name)
|
40
|
-
request_schema_results = list.all.map { |request| request[:schema_errors] }
|
41
|
-
passed = true
|
42
|
-
request_schema_results.each.with_index(1) do |schema_errors, index|
|
43
|
-
next if schema_errors.nil?
|
44
|
-
if schema_errors.size > 0
|
45
|
-
passed = false
|
46
|
-
$stdout.puts "\n"
|
47
|
-
$stdout.puts "\e[31m--- #{list_name} #{index} failed validation with errors at the following locations:\e[0m"
|
48
|
-
schema_errors.each do |error|
|
49
|
-
$stdout.puts "\e[31m#{error["data_pointer"]} failed to match #{error["schema_pointer"]}\e[0m"
|
50
|
-
end
|
51
|
-
$stdout.puts "\n"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
unless passed
|
56
|
-
raise Test::Unit::AssertionFailedError.new 'The received payloads did not match the endpoint schema. A full list of the errors can be found above'
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def validate_payload_elements(list, list_name)
|
61
|
-
validator_class = case list_name
|
62
|
-
when 'trace', 'traces'
|
63
|
-
Maze::Schemas::TraceValidator
|
64
|
-
else
|
65
|
-
nil
|
66
|
-
end
|
67
|
-
|
68
|
-
if validator_class
|
69
|
-
validators = list.all.map do |request|
|
70
|
-
validator = validator_class.new(request[:body])
|
71
|
-
validator.validate
|
72
|
-
validator
|
73
|
-
end
|
74
|
-
|
75
|
-
return if validators.all? { |validator| validator.success }
|
76
|
-
validators.each.with_index(1) do |validator, index|
|
77
|
-
unless validator.success
|
78
|
-
$stdout.puts "\n"
|
79
|
-
$stdout.puts "\e[31m--- #{list_name} #{index} failed validation with the following errors:\e[0m"
|
80
|
-
validator.errors.each do |error|
|
81
|
-
$stdout.puts "\e[31m#{error}\e[0m"
|
82
|
-
end
|
83
|
-
$stdout.puts "\n"
|
84
|
-
end
|
85
|
-
end
|
86
|
-
raise Test::Unit::AssertionFailedError.new("One or more #{list_name} payloads failed validation. A full list of the errors can be found above")
|
87
|
-
end
|
88
34
|
end
|
89
35
|
|
90
36
|
#
|
@@ -255,6 +255,9 @@ def assert_received_spans(span_count, list)
|
|
255
255
|
end
|
256
256
|
|
257
257
|
Maze.check.operator(span_count, :<=, received_count, "#{received_count} spans received")
|
258
|
+
|
259
|
+
Maze::Schemas::Validator.verify_against_schema(list, 'trace')
|
260
|
+
Maze::Schemas::Validator.validate_payload_elements(list, 'trace')
|
258
261
|
end
|
259
262
|
|
260
263
|
def get_attribute_value(field, attribute, attr_type)
|
@@ -186,6 +186,15 @@ After do |scenario|
|
|
186
186
|
end
|
187
187
|
end
|
188
188
|
|
189
|
+
# Test all requests against schemas or extra validation rules. These will only run if the schema/validation is
|
190
|
+
# specified for the specific endpoint
|
191
|
+
After do |scenario|
|
192
|
+
['error', 'session', 'build', 'trace'].each do |endpoint|
|
193
|
+
Maze::Schemas::Validator.verify_against_schema(Maze::Server.list_for(endpoint), endpoint)
|
194
|
+
Maze::Schemas::Validator.validate_payload_elements(Maze::Server.list_for(endpoint), endpoint)
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
189
198
|
# After all tests
|
190
199
|
AfterAll do
|
191
200
|
|
@@ -19,34 +19,6 @@ chrome_107:
|
|
19
19
|
version: '107'
|
20
20
|
resolution: '1920x1080'
|
21
21
|
|
22
|
-
chrome_106:
|
23
|
-
platform: 'Windows'
|
24
|
-
osVersion: '11'
|
25
|
-
browserName: 'chrome'
|
26
|
-
version: '106'
|
27
|
-
resolution: '1920x1080'
|
28
|
-
|
29
|
-
chrome_105:
|
30
|
-
platform: 'Windows'
|
31
|
-
osVersion: '11'
|
32
|
-
browserName: 'chrome'
|
33
|
-
version: '105'
|
34
|
-
resolution: '1920x1080'
|
35
|
-
|
36
|
-
chrome_104:
|
37
|
-
platform: 'Windows'
|
38
|
-
osVersion: '11'
|
39
|
-
browserName: 'chrome'
|
40
|
-
version: '104'
|
41
|
-
resolution: '1920x1080'
|
42
|
-
|
43
|
-
chrome_103:
|
44
|
-
platform: 'Windows'
|
45
|
-
osVersion: '11'
|
46
|
-
browserName: 'chrome'
|
47
|
-
version: '103'
|
48
|
-
resolution: '1920x1080'
|
49
|
-
|
50
22
|
chrome_72:
|
51
23
|
platform: 'Windows'
|
52
24
|
osVersion: '10'
|
@@ -131,48 +103,6 @@ edge_latest:
|
|
131
103
|
version: 'latest'
|
132
104
|
resolution: '1920x1080'
|
133
105
|
|
134
|
-
edge_106:
|
135
|
-
platform: 'Windows'
|
136
|
-
osVersion: '11'
|
137
|
-
browserName: 'MicrosoftEdge'
|
138
|
-
version: '106'
|
139
|
-
resolution: '1920x1080'
|
140
|
-
|
141
|
-
edge_105:
|
142
|
-
platform: 'Windows'
|
143
|
-
osVersion: '11'
|
144
|
-
browserName: 'MicrosoftEdge'
|
145
|
-
version: '105'
|
146
|
-
resolution: '1920x1080'
|
147
|
-
|
148
|
-
edge_104:
|
149
|
-
platform: 'Windows'
|
150
|
-
osVersion: '11'
|
151
|
-
browserName: 'MicrosoftEdge'
|
152
|
-
version: '104'
|
153
|
-
resolution: '1920x1080'
|
154
|
-
|
155
|
-
edge_103:
|
156
|
-
platform: 'Windows'
|
157
|
-
osVersion: '11'
|
158
|
-
browserName: 'MicrosoftEdge'
|
159
|
-
version: '103'
|
160
|
-
resolution: '1920x1080'
|
161
|
-
|
162
|
-
edge_102:
|
163
|
-
platform: 'Windows'
|
164
|
-
osVersion: '11'
|
165
|
-
browserName: 'MicrosoftEdge'
|
166
|
-
version: '102'
|
167
|
-
resolution: '1920x1080'
|
168
|
-
|
169
|
-
edge_101:
|
170
|
-
platform: 'Windows'
|
171
|
-
osVersion: '11'
|
172
|
-
browserName: 'MicrosoftEdge'
|
173
|
-
version: '101'
|
174
|
-
resolution: '1920x1080'
|
175
|
-
|
176
106
|
safari_16:
|
177
107
|
platform: 'macOS'
|
178
108
|
osVersion: '13'
|
@@ -20,9 +20,7 @@ module Maze
|
|
20
20
|
config.username,
|
21
21
|
config.access_key
|
22
22
|
|
23
|
-
|
24
|
-
# selenium_url = 'https://us-west-desktop-hub.bitbar.com/wd/hub'
|
25
|
-
selenium_url = 'https://eu-desktop-hub.bitbar.com/wd/hub'
|
23
|
+
selenium_url = Maze.config.selenium_server_url
|
26
24
|
Maze.driver = Maze::Driver::Browser.new :remote, selenium_url, config.capabilities
|
27
25
|
Maze.driver.start_driver
|
28
26
|
end
|
data/lib/maze/configuration.rb
CHANGED
@@ -132,6 +132,12 @@ module Maze
|
|
132
132
|
# Access token for the test-management service
|
133
133
|
attr_accessor :tms_token
|
134
134
|
|
135
|
+
# URL of the Appium server
|
136
|
+
attr_accessor :appium_server_url
|
137
|
+
|
138
|
+
# URL of the Selenium server
|
139
|
+
attr_accessor :selenium_server_url
|
140
|
+
|
135
141
|
# Whether the legacy (JSON-WP) Appium driver should be used
|
136
142
|
def legacy_driver?
|
137
143
|
@legacy_driver
|
@@ -157,9 +163,6 @@ module Maze
|
|
157
163
|
# Device id for running on local iOS devices
|
158
164
|
attr_accessor :device_id
|
159
165
|
|
160
|
-
# URL of the Appium server
|
161
|
-
attr_accessor :appium_server_url
|
162
|
-
|
163
166
|
# Whether an appium server should be started
|
164
167
|
attr_accessor :start_appium
|
165
168
|
|
data/lib/maze/option/parser.rb
CHANGED
@@ -118,6 +118,15 @@ module Maze
|
|
118
118
|
opt Option::TUNNEL,
|
119
119
|
'Start the device farm secure tunnel',
|
120
120
|
default: true
|
121
|
+
opt Option::APPIUM_SERVER,
|
122
|
+
"Appium server URL. Defaults are: \n" +
|
123
|
+
" --farm=local - MAZE_APPIUM_SERVER or http://localhost:4723/wd/hub\n" +
|
124
|
+
" --farm=bb - MAZE_APPIUM_SERVER or https://us-west-mobile-hub.bitbar.com/wd/hub\n" +
|
125
|
+
'Not used for --farm=bs',
|
126
|
+
type: :string
|
127
|
+
opt Option::SELENIUM_SERVER,
|
128
|
+
"Selenium server URL. Only used for --farm=bb, defaulting to MAZE_SELENIUM_SERVER or https://us-west-desktop-hub.bitbar.com/wd/hub",
|
129
|
+
type: :string
|
121
130
|
|
122
131
|
# SmartBear-only options
|
123
132
|
opt Option::SB_LOCAL,
|
@@ -147,9 +156,6 @@ module Maze
|
|
147
156
|
opt Option::OS_VERSION,
|
148
157
|
'The intended OS version when running on a local device',
|
149
158
|
type: :string
|
150
|
-
opt Option::APPIUM_SERVER,
|
151
|
-
'Appium server URL, only used for --farm=local. MAZE_APPIUM_SERVER env var or "http://localhost:4723/wd/hub" by default',
|
152
|
-
type: :string
|
153
159
|
opt Option::START_APPIUM,
|
154
160
|
'Whether a local Appium server should be start. Only used for --farm=local.',
|
155
161
|
default: true
|
@@ -222,6 +228,8 @@ module Maze
|
|
222
228
|
options[Option::USERNAME] ||= ENV['BITBAR_USERNAME']
|
223
229
|
options[Option::ACCESS_KEY] ||= ENV['BITBAR_ACCESS_KEY']
|
224
230
|
options[Option::TMS_URI] ||= ENV['MAZE_TMS_URI']
|
231
|
+
options[Option::APPIUM_SERVER] ||= ENV['MAZE_APPIUM_SERVER'] || 'https://us-west-mobile-hub.bitbar.com/wd/hub'
|
232
|
+
options[Option::SELENIUM_SERVER] ||= ENV['MAZE_SELENIUM_SERVER'] || 'https://us-west-desktop-hub.bitbar.com/wd/hub'
|
225
233
|
end
|
226
234
|
|
227
235
|
options[Option::REPEATER_API_KEY] ||= ENV['MAZE_REPEATER_API_KEY']
|
@@ -97,7 +97,8 @@ module Maze
|
|
97
97
|
config.os = options[Maze::Option::OS]
|
98
98
|
config.os_version = options[Maze::Option::OS_VERSION]
|
99
99
|
config.sb_local = Maze::Helper.expand_path(options[Maze::Option::SB_LOCAL])
|
100
|
-
config.appium_server_url =
|
100
|
+
config.appium_server_url = options[Maze::Option::APPIUM_SERVER]
|
101
|
+
config.selenium_server_url = options[Maze::Option::SELENIUM_SERVER]
|
101
102
|
config.app_bundle_id = options[Maze::Option::APP_BUNDLE_ID]
|
102
103
|
when :local then
|
103
104
|
if options[Maze::Option::BROWSER]
|
data/lib/maze/option.rb
CHANGED
@@ -30,6 +30,8 @@ module Maze
|
|
30
30
|
OS_VERSION = 'os-version'
|
31
31
|
TUNNEL = 'tunnel'
|
32
32
|
USERNAME = 'username'
|
33
|
+
APPIUM_SERVER = 'appium-server'
|
34
|
+
SELENIUM_SERVER = 'selenium-server'
|
33
35
|
|
34
36
|
# BitBar options
|
35
37
|
SB_LOCAL = 'sb-local'
|
@@ -43,7 +45,6 @@ module Maze
|
|
43
45
|
|
44
46
|
# Local-only options
|
45
47
|
APPIUM_LOGFILE = 'appium-logfile'
|
46
|
-
APPIUM_SERVER = 'appium-server'
|
47
48
|
APPLE_TEAM_ID = 'apple-team-id'
|
48
49
|
START_APPIUM = 'start-appium'
|
49
50
|
UDID = 'udid'
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Maze
|
4
|
+
module Schemas
|
5
|
+
|
6
|
+
# A general entry point for running validation with schemas and other validation methods
|
7
|
+
class Validator
|
8
|
+
|
9
|
+
class << self
|
10
|
+
|
11
|
+
# Tests that payloads for a specific path have passed any schema checks implemented on receipt
|
12
|
+
# Throws an AssertionFailedError with a list of issues on failure
|
13
|
+
#
|
14
|
+
# @param list [Array] An array of received requests
|
15
|
+
# @param list_name [String] The name of the payload list for received requests
|
16
|
+
def verify_against_schema(list, list_name)
|
17
|
+
request_schema_results = list.all.map { |request| request[:schema_errors] }
|
18
|
+
passed = true
|
19
|
+
request_schema_results.each.with_index(1) do |schema_errors, index|
|
20
|
+
next if schema_errors.nil?
|
21
|
+
if schema_errors.size > 0
|
22
|
+
passed = false
|
23
|
+
$stdout.puts "\n"
|
24
|
+
$stdout.puts "\e[31m--- #{list_name} #{index} failed validation:\e[0m"
|
25
|
+
schema_errors.each do |error|
|
26
|
+
$stdout.puts "\e[31m#{JSONSchemer::Errors.pretty(error)}\e[0m"
|
27
|
+
end
|
28
|
+
$stdout.puts "\n"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
unless passed
|
33
|
+
raise Test::Unit::AssertionFailedError.new 'The received payloads did not match the endpoint schema. A full list of the errors can be found above'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Tests that payloads for a specific path pass any additional validation checks
|
38
|
+
# Throws an AssertionFailedError with a list of issues on failure
|
39
|
+
#
|
40
|
+
# @param list [Array] An array of received requests
|
41
|
+
# @param list_name [String] The name of the payload list for received requests
|
42
|
+
def validate_payload_elements(list, list_name)
|
43
|
+
validator_class = case list_name
|
44
|
+
when 'trace', 'traces'
|
45
|
+
Maze::Schemas::TraceValidator
|
46
|
+
else
|
47
|
+
nil
|
48
|
+
end
|
49
|
+
|
50
|
+
if validator_class
|
51
|
+
validators = list.all.map do |request|
|
52
|
+
validator = validator_class.new(request[:body])
|
53
|
+
validator.validate
|
54
|
+
validator
|
55
|
+
end
|
56
|
+
|
57
|
+
return if validators.all? { |validator| validator.success }
|
58
|
+
validators.each.with_index(1) do |validator, index|
|
59
|
+
unless validator.success
|
60
|
+
$stdout.puts "\n"
|
61
|
+
$stdout.puts "\e[31m--- #{list_name} #{index} failed validation with the following errors:\e[0m"
|
62
|
+
validator.errors.each do |error|
|
63
|
+
$stdout.puts "\e[31m#{error}\e[0m"
|
64
|
+
end
|
65
|
+
$stdout.puts "\n"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
raise Test::Unit::AssertionFailedError.new("One or more #{list_name} payloads failed validation. A full list of the errors can be found above")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
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 = '7.
|
10
|
+
VERSION = '7.27.0'
|
11
11
|
|
12
12
|
class << self
|
13
13
|
attr_accessor :check, :driver, :internal_hooks, :mode, :start_time, :dynamic_retry, :public_address, :run_uuid
|
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: 7.
|
4
|
+
version: 7.27.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-04-
|
11
|
+
date: 2023-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -427,6 +427,7 @@ files:
|
|
427
427
|
- lib/maze/schemas/OtelTraceSchema.json
|
428
428
|
- lib/maze/schemas/trace_schema.rb
|
429
429
|
- lib/maze/schemas/trace_validator.rb
|
430
|
+
- lib/maze/schemas/validator.rb
|
430
431
|
- lib/maze/server.rb
|
431
432
|
- lib/maze/servlets/base_servlet.rb
|
432
433
|
- lib/maze/servlets/command_servlet.rb
|