bugsnag-maze-runner 7.33.1 → 8.0.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 +9 -1
- data/bin/purge-projects +66 -0
- data/lib/features/steps/app_automator_steps.rb +9 -3
- data/lib/features/steps/header_steps.rb +13 -9
- data/lib/features/steps/multipart_request_steps.rb +10 -10
- data/lib/features/steps/network_steps.rb +7 -24
- data/lib/features/steps/payload_steps.rb +21 -21
- data/lib/features/steps/query_parameter_steps.rb +3 -3
- data/lib/features/steps/request_assertion_steps.rb +11 -18
- data/lib/features/steps/trace_steps.rb +0 -8
- data/lib/features/steps/value_steps.rb +9 -9
- data/lib/features/support/cucumber_types.rb +20 -0
- data/lib/features/support/internal_hooks.rb +0 -2
- data/lib/maze/api/appium/file_manager.rb +1 -1
- data/lib/maze/appium_server.rb +2 -2
- data/lib/maze/client/appium/bb_client.rb +1 -1
- data/lib/maze/client/appium/bb_devices.rb +1 -1
- data/lib/maze/client/appium/bs_devices.rb +7 -9
- data/lib/maze/client/bb_api_client.rb +46 -9
- data/lib/maze/client/bb_client_utils.rb +1 -61
- data/lib/maze/client/selenium/bb_client.rb +1 -6
- data/lib/maze/client/selenium/bs_browsers.yml +11 -11
- data/lib/maze/configuration.rb +0 -6
- data/lib/maze/logger.rb +29 -1
- data/lib/maze/option/parser.rb +39 -14
- data/lib/maze/option/processor.rb +2 -5
- data/lib/maze/option/validator.rb +3 -7
- data/lib/maze/option.rb +2 -6
- data/lib/maze/repeaters/request_repeater.rb +1 -1
- data/lib/maze/schemas/trace_validator.rb +0 -2
- data/lib/maze/server.rb +13 -3
- data/lib/maze/servlets/servlet.rb +13 -10
- data/lib/maze/servlets/trace_servlet.rb +15 -0
- data/lib/maze/terminating_server.rb +1 -1
- data/lib/maze.rb +1 -1
- metadata +5 -3
- data/lib/maze/plugins/cucumber_report_plugin.rb +0 -101
data/lib/maze/option/parser.rb
CHANGED
@@ -22,6 +22,9 @@ module Maze
|
|
22
22
|
'Print this help.'
|
23
23
|
opt :version,
|
24
24
|
'Display Maze Runner and Cucumber versions'
|
25
|
+
opt :expand,
|
26
|
+
'Output for Scenario Outlines is expanded by default, suppress using --no-expand',
|
27
|
+
short: :none
|
25
28
|
|
26
29
|
text ''
|
27
30
|
text 'General options:'
|
@@ -29,24 +32,29 @@ module Maze
|
|
29
32
|
opt Option::AWS_PUBLIC_IP,
|
30
33
|
'Intended for use on Buildkite with the Elastic CI Stack for CI. Enables awareness of being run with a public IP address.',
|
31
34
|
type: :boolean,
|
35
|
+
short: :none,
|
32
36
|
default: false
|
33
37
|
|
34
|
-
opt Option::
|
38
|
+
opt Option::RETRIES,
|
35
39
|
'Enables retrying failed scenarios when tagged',
|
36
40
|
type: :boolean,
|
41
|
+
short: :none,
|
37
42
|
default: true
|
38
43
|
|
39
|
-
opt Option::
|
44
|
+
opt Option::BUGSNAG,
|
40
45
|
'Enables reporting to Bugsnag on scenario failure (requires MAZE_BUGSNAG_API_KEY)',
|
41
46
|
type: :boolean,
|
47
|
+
short: :none,
|
42
48
|
default: true
|
43
49
|
|
44
50
|
opt Option::ASPECTO_REPEATER_API_KEY,
|
45
51
|
'Enables forwarding of all received POST requests to Aspecto, using the API key provided. MAZE_ASPECTO_REPEATER_API_KEY may also be set.',
|
52
|
+
short: :none,
|
46
53
|
type: :string
|
47
54
|
|
48
55
|
opt Option::BUGSNAG_REPEATER_API_KEY,
|
49
56
|
'Enables forwarding of all received POST requests to Bugsnag, using the API key provided. MAZE_REPEATER_API_KEY may also be set.',
|
57
|
+
short: :none,
|
50
58
|
type: :string
|
51
59
|
|
52
60
|
text ''
|
@@ -54,12 +62,15 @@ module Maze
|
|
54
62
|
|
55
63
|
opt Option::BIND_ADDRESS,
|
56
64
|
'Mock server bind address',
|
65
|
+
short: :none,
|
57
66
|
type: :string
|
58
67
|
opt Option::PORT,
|
59
68
|
'Mock server port',
|
69
|
+
short: :none,
|
60
70
|
default: 9339
|
61
71
|
opt Option::NULL_PORT,
|
62
72
|
'Terminating connection port',
|
73
|
+
short: :none,
|
63
74
|
default: 9341
|
64
75
|
|
65
76
|
text ''
|
@@ -67,12 +78,15 @@ module Maze
|
|
67
78
|
|
68
79
|
opt Option::DS_ROOT,
|
69
80
|
'Document server root',
|
81
|
+
short: :none,
|
70
82
|
type: :string
|
71
83
|
opt Option::DS_BIND_ADDRESS,
|
72
84
|
'Document server bind address',
|
85
|
+
short: :none,
|
73
86
|
type: :string
|
74
87
|
opt Option::DS_PORT,
|
75
88
|
'Document server port',
|
89
|
+
short: :none,
|
76
90
|
default: 9340
|
77
91
|
|
78
92
|
text ''
|
@@ -80,16 +94,20 @@ module Maze
|
|
80
94
|
|
81
95
|
opt Option::FARM,
|
82
96
|
'Device farm to use: "bs" (BrowserStack) or "local"',
|
97
|
+
short: :none,
|
83
98
|
type: :string
|
84
99
|
opt Option::APP,
|
85
100
|
'The app to be installed and run against. Assumed to be contained in a file if prefixed with @.',
|
101
|
+
short: :none,
|
86
102
|
type: :string
|
87
103
|
opt Option::A11Y_LOCATOR,
|
88
104
|
'Locate elements by accessibility id rather than id',
|
105
|
+
short: :none,
|
89
106
|
type: :boolean,
|
90
107
|
default: false
|
91
108
|
opt Option::CAPABILITIES,
|
92
109
|
'Additional desired Appium capabilities as a JSON string',
|
110
|
+
short: :none,
|
93
111
|
default: '{}'
|
94
112
|
|
95
113
|
text ''
|
@@ -106,49 +124,50 @@ module Maze
|
|
106
124
|
type: :string
|
107
125
|
opt Option::USERNAME,
|
108
126
|
'Device farm username. Consumes env var from environment based on farm set',
|
127
|
+
short: :none,
|
109
128
|
type: :string
|
110
129
|
opt Option::ACCESS_KEY,
|
111
130
|
'Device farm access key. Consumes env var from environment based on farm set',
|
131
|
+
short: :none,
|
112
132
|
type: :string
|
113
133
|
opt Option::APPIUM_VERSION,
|
114
134
|
'The Appium version to use',
|
135
|
+
short: :none,
|
115
136
|
type: :string
|
116
137
|
opt Option::LIST_DEVICES,
|
117
138
|
'Lists the devices available for the configured device farm, or all devices if none are specified',
|
139
|
+
short: :none,
|
118
140
|
default: false
|
119
141
|
opt Option::APP_BUNDLE_ID,
|
120
142
|
'The bundle identifier of the test application',
|
143
|
+
short: :none,
|
121
144
|
type: :string
|
122
145
|
opt Option::TUNNEL,
|
123
146
|
'Start the device farm secure tunnel',
|
147
|
+
short: :none,
|
124
148
|
default: true
|
125
149
|
opt Option::APPIUM_SERVER,
|
126
150
|
"Appium server URL. Defaults are: \n" +
|
127
151
|
" --farm=local - MAZE_APPIUM_SERVER or http://localhost:4723/wd/hub\n" +
|
128
152
|
" --farm=bb - MAZE_APPIUM_SERVER or https://us-west-mobile-hub.bitbar.com/wd/hub\n" +
|
129
153
|
'Not used for --farm=bs',
|
154
|
+
short: :none,
|
130
155
|
type: :string
|
131
156
|
opt Option::SELENIUM_SERVER,
|
132
157
|
"Selenium server URL. Only used for --farm=bb, defaulting to MAZE_SELENIUM_SERVER or https://us-west-desktop-hub.bitbar.com/wd/hub",
|
158
|
+
short: :none,
|
133
159
|
type: :string
|
134
160
|
|
135
161
|
# SmartBear-only options
|
136
162
|
opt Option::SB_LOCAL,
|
137
163
|
'(SB only) Path to the SBSecureTunnel binary. MAZE_SB_LOCAL env var or "/SBSecureTunnel" by default',
|
164
|
+
short: :none,
|
138
165
|
type: :string
|
139
166
|
|
140
167
|
# BrowserStack-only options
|
141
168
|
opt Option::BS_LOCAL,
|
142
169
|
'(BS only) Path to the BrowserStackLocal binary. MAZE_BS_LOCAL env var or "/BrowserStackLocal" by default',
|
143
|
-
|
144
|
-
|
145
|
-
# TMS options
|
146
|
-
opt Option::TMS_URI,
|
147
|
-
'URI of the test management server root. MAZE_TMS_URI env var',
|
148
|
-
type: :string
|
149
|
-
|
150
|
-
opt Option::TMS_TOKEN,
|
151
|
-
'Token used to access the test management server. MAZE_TMS_TOKEN env var',
|
170
|
+
short: :none,
|
152
171
|
type: :string
|
153
172
|
|
154
173
|
text ''
|
@@ -156,21 +175,27 @@ module Maze
|
|
156
175
|
|
157
176
|
opt Option::OS,
|
158
177
|
'OS type to use ("ios", "android")',
|
178
|
+
short: :none,
|
159
179
|
type: :string
|
160
180
|
opt Option::OS_VERSION,
|
161
181
|
'The intended OS version when running on a local device',
|
182
|
+
short: :none,
|
162
183
|
type: :string
|
163
184
|
opt Option::START_APPIUM,
|
164
185
|
'Whether a local Appium server should be start. Only used for --farm=local.',
|
186
|
+
short: :none,
|
165
187
|
default: true
|
166
188
|
opt Option::APPIUM_LOGFILE,
|
167
189
|
'The file local appium server output is logged to, defaulting to "appium_server.log"',
|
190
|
+
short: :none,
|
168
191
|
default: 'appium_server.log'
|
169
192
|
opt Option::APPLE_TEAM_ID,
|
170
193
|
'Apple Team Id, required for local iOS testing. MAZE_APPLE_TEAM_ID env var by default',
|
194
|
+
short: :none,
|
171
195
|
type: :string
|
172
196
|
opt Option::UDID,
|
173
197
|
'Apple UDID, required for local iOS testing. MAZE_UDID env var by default',
|
198
|
+
short: :none,
|
174
199
|
type: :string
|
175
200
|
|
176
201
|
text ''
|
@@ -178,16 +203,19 @@ module Maze
|
|
178
203
|
|
179
204
|
opt Option::FILE_LOG,
|
180
205
|
"Writes lists of received requests to the maze_output folder for all scenarios",
|
206
|
+
short: :none,
|
181
207
|
type: :boolean,
|
182
208
|
default: true
|
183
209
|
|
184
210
|
opt Option::LOG_REQUESTS,
|
185
211
|
"Log lists of received requests to the console in the event of scenario failure. Defaults to true if the BUILDKITE environment variable is set",
|
212
|
+
short: :none,
|
186
213
|
type: :boolean,
|
187
214
|
default: false
|
188
215
|
|
189
216
|
opt Option::ALWAYS_LOG,
|
190
217
|
"Always log all received requests at the end of a scenario, whether is passes or fails",
|
218
|
+
short: :none,
|
191
219
|
type: :boolean,
|
192
220
|
default: false
|
193
221
|
|
@@ -231,7 +259,6 @@ module Maze
|
|
231
259
|
when 'bb'
|
232
260
|
options[Option::USERNAME] ||= ENV['BITBAR_USERNAME']
|
233
261
|
options[Option::ACCESS_KEY] ||= ENV['BITBAR_ACCESS_KEY']
|
234
|
-
options[Option::TMS_URI] ||= ENV['MAZE_TMS_URI']
|
235
262
|
options[Option::APPIUM_SERVER] ||= ENV['MAZE_APPIUM_SERVER'] || 'https://us-west-mobile-hub.bitbar.com/wd/hub'
|
236
263
|
options[Option::SELENIUM_SERVER] ||= ENV['MAZE_SELENIUM_SERVER'] || 'https://us-west-desktop-hub.bitbar.com/wd/hub'
|
237
264
|
end
|
@@ -239,8 +266,6 @@ module Maze
|
|
239
266
|
options[Option::ASPECTO_REPEATER_API_KEY] ||= ENV['MAZE_ASPECTO_REPEATER_API_KEY']
|
240
267
|
options[Option::BUGSNAG_REPEATER_API_KEY] ||= ENV['MAZE_REPEATER_API_KEY']
|
241
268
|
options[Option::SB_LOCAL] ||= ENV['MAZE_SB_LOCAL'] || '/SBSecureTunnel'
|
242
|
-
options[Option::TMS_URI] ||= ENV['MAZE_TMS_URI']
|
243
|
-
options[Option::TMS_TOKEN] ||= ENV['MAZE_TMS_TOKEN']
|
244
269
|
options[Option::BS_LOCAL] ||= ENV['MAZE_BS_LOCAL'] || '/BrowserStackLocal'
|
245
270
|
options[Option::APPIUM_SERVER] ||= ENV['MAZE_APPIUM_SERVER'] || 'http://localhost:4723/wd/hub'
|
246
271
|
options[Option::APPLE_TEAM_ID] ||= ENV['MAZE_APPLE_TEAM_ID']
|
@@ -19,10 +19,8 @@ module Maze
|
|
19
19
|
|
20
20
|
# General options
|
21
21
|
config.aws_public_ip = options[Maze::Option::AWS_PUBLIC_IP]
|
22
|
-
config.enable_retries = options[Maze::Option::
|
23
|
-
config.enable_bugsnag = options[Maze::Option::
|
24
|
-
config.tms_uri = options[Maze::Option::TMS_URI]
|
25
|
-
config.tms_token = options[Maze::Option::TMS_TOKEN]
|
22
|
+
config.enable_retries = options[Maze::Option::RETRIES]
|
23
|
+
config.enable_bugsnag = options[Maze::Option::BUGSNAG]
|
26
24
|
config.aspecto_repeater_api_key = options[Maze::Option::ASPECTO_REPEATER_API_KEY]
|
27
25
|
config.bugsnag_repeater_api_key = options[Maze::Option::BUGSNAG_REPEATER_API_KEY]
|
28
26
|
|
@@ -80,7 +78,6 @@ module Maze
|
|
80
78
|
when :bb then
|
81
79
|
config.username = options[Maze::Option::USERNAME]
|
82
80
|
config.access_key = options[Maze::Option::ACCESS_KEY]
|
83
|
-
config.tms_uri = options[Maze::Option::TMS_URI]
|
84
81
|
config.appium_version = options[Maze::Option::APPIUM_VERSION]
|
85
82
|
device_option = options[Maze::Option::DEVICE]
|
86
83
|
if device_option.nil? || device_option.empty?
|
@@ -89,13 +89,9 @@ module Maze
|
|
89
89
|
def validate_bitbar(options, errors)
|
90
90
|
browser = options[Option::BROWSER]
|
91
91
|
device = options[Option::DEVICE]
|
92
|
-
|
93
|
-
if
|
94
|
-
|
95
|
-
else
|
96
|
-
errors << "--#{Option::USERNAME} must be specified" if options[Option::USERNAME].nil?
|
97
|
-
errors << "--#{Option::ACCESS_KEY} must be specified" if options[Option::ACCESS_KEY].nil?
|
98
|
-
end
|
92
|
+
|
93
|
+
errors << "--#{Option::USERNAME} must be specified" if options[Option::USERNAME].nil?
|
94
|
+
errors << "--#{Option::ACCESS_KEY} must be specified" if options[Option::ACCESS_KEY].nil?
|
99
95
|
|
100
96
|
# Device
|
101
97
|
if browser.nil? && device.empty?
|
data/lib/maze/option.rb
CHANGED
@@ -39,10 +39,6 @@ module Maze
|
|
39
39
|
# BrowserStack-only options
|
40
40
|
BS_LOCAL = 'bs-local'
|
41
41
|
|
42
|
-
# BitBar-only options
|
43
|
-
TMS_URI = 'tms-uri'
|
44
|
-
TMS_TOKEN = 'tms-token'
|
45
|
-
|
46
42
|
# Local-only options
|
47
43
|
APPIUM_LOGFILE = 'appium-logfile'
|
48
44
|
APPLE_TEAM_ID = 'apple-team-id'
|
@@ -58,7 +54,7 @@ module Maze
|
|
58
54
|
AWS_PUBLIC_IP = 'aws-public-ip'
|
59
55
|
ASPECTO_REPEATER_API_KEY = 'aspecto-repeater-api-key'
|
60
56
|
BUGSNAG_REPEATER_API_KEY = 'repeater-api-key'
|
61
|
-
|
62
|
-
|
57
|
+
BUGSNAG = 'bugsnag'
|
58
|
+
RETRIES = 'retries'
|
63
59
|
end
|
64
60
|
end
|
@@ -25,8 +25,6 @@ module Maze
|
|
25
25
|
# Runs the validation against the trace given
|
26
26
|
def validate
|
27
27
|
@success = true
|
28
|
-
# Shortcut the validation if the body is empty for initial P gathering reasons
|
29
|
-
return if @body.keys.eql?(['resourceSpans']) && @body['resourceSpans'].empty?
|
30
28
|
|
31
29
|
regex_comparison('resourceSpans.0.scopeSpans.0.spans.0.spanId', '^[A-Fa-f0-9]{16}$')
|
32
30
|
regex_comparison('resourceSpans.0.scopeSpans.0.spans.0.traceId', '^[A-Fa-f0-9]{32}$')
|
data/lib/maze/server.rb
CHANGED
@@ -85,6 +85,8 @@ module Maze
|
|
85
85
|
logs
|
86
86
|
when 'metric', 'metrics'
|
87
87
|
metrics
|
88
|
+
when 'sampling request', 'sampling requests'
|
89
|
+
sampling_requests
|
88
90
|
when 'trace', 'traces'
|
89
91
|
traces
|
90
92
|
when 'upload', 'uploads'
|
@@ -107,14 +109,21 @@ module Maze
|
|
107
109
|
|
108
110
|
# A list of session requests received
|
109
111
|
#
|
110
|
-
# @return [RequestList] Received
|
112
|
+
# @return [RequestList] Received session requests
|
111
113
|
def sessions
|
112
114
|
@sessions ||= RequestList.new
|
113
115
|
end
|
114
116
|
|
117
|
+
# A list of sampling requests received
|
118
|
+
#
|
119
|
+
# @return [RequestList] Received sampling requests
|
120
|
+
def sampling_requests
|
121
|
+
@sampling_requests ||= RequestList.new
|
122
|
+
end
|
123
|
+
|
115
124
|
# A list of trace requests received
|
116
125
|
#
|
117
|
-
# @return [RequestList] Received
|
126
|
+
# @return [RequestList] Received trace requests
|
118
127
|
def traces
|
119
128
|
@traces ||= RequestList.new
|
120
129
|
end
|
@@ -195,7 +204,7 @@ module Maze
|
|
195
204
|
|
196
205
|
# Mount a block to respond to all requests with status:200
|
197
206
|
server.mount_proc '/' do |_request, response|
|
198
|
-
$logger.
|
207
|
+
$logger.trace 'Received request on server root, responding with 200'
|
199
208
|
response.header['Access-Control-Allow-Origin'] = '*'
|
200
209
|
response.body = 'Maze runner received request'
|
201
210
|
response.status = 200
|
@@ -252,6 +261,7 @@ module Maze
|
|
252
261
|
builds.clear
|
253
262
|
uploads.clear
|
254
263
|
sourcemaps.clear
|
264
|
+
sampling_requests.clear
|
255
265
|
traces.clear
|
256
266
|
logs.clear
|
257
267
|
invalid_requests.clear
|
@@ -37,7 +37,6 @@ module Maze
|
|
37
37
|
def initialize(server, request_type, schema=nil)
|
38
38
|
super server
|
39
39
|
@request_type = request_type
|
40
|
-
@requests = Server.list_for request_type
|
41
40
|
@schema = JSONSchemer.schema(schema) unless schema.nil?
|
42
41
|
@aspecto_repeater = Maze::Repeaters::AspectoRepeater.new(@request_type)
|
43
42
|
@bugsnag_repeater = Maze::Repeaters::BugsnagRepeater.new(@request_type)
|
@@ -88,7 +87,7 @@ module Maze
|
|
88
87
|
schema_errors = @schema.validate(hash[:body])
|
89
88
|
hash[:schema_errors] = schema_errors.to_a
|
90
89
|
end
|
91
|
-
|
90
|
+
add_request(hash)
|
92
91
|
|
93
92
|
# For the response, delaying if configured to do so
|
94
93
|
response_delay_ms = Server.response_delay_ms
|
@@ -144,10 +143,14 @@ module Maze
|
|
144
143
|
|
145
144
|
private
|
146
145
|
|
146
|
+
def add_request(request)
|
147
|
+
Server.list_for(@request_type).add(request)
|
148
|
+
end
|
149
|
+
|
147
150
|
def log_request(request)
|
148
|
-
$logger.
|
149
|
-
$logger.
|
150
|
-
$logger.
|
151
|
+
$logger.trace "#{request.request_method} request received"
|
152
|
+
$logger.trace "URI: #{request.unparsed_uri}"
|
153
|
+
$logger.trace "HEADERS: #{request.raw_header}"
|
151
154
|
return if request.body.nil?
|
152
155
|
|
153
156
|
case request['Content-Type']
|
@@ -156,12 +159,12 @@ module Maze
|
|
156
159
|
when %r{^multipart/form-data; boundary=([^;]+)}
|
157
160
|
boundary = WEBrick::HTTPUtils.dequote(Regexp.last_match(1))
|
158
161
|
body = WEBrick::HTTPUtils.parse_form_data(request.body, boundary)
|
159
|
-
$logger.
|
160
|
-
LogUtil.log_hash(Logger::Severity::
|
162
|
+
$logger.trace 'BODY:'
|
163
|
+
LogUtil.log_hash(Logger::Severity::TRACE, body)
|
161
164
|
when %r{^application/json$}
|
162
|
-
$logger.
|
165
|
+
$logger.trace "BODY: #{JSON.pretty_generate(JSON.parse(request.body))}"
|
163
166
|
else
|
164
|
-
$logger.
|
167
|
+
$logger.trace "BODY: #{request.body}"
|
165
168
|
end
|
166
169
|
end
|
167
170
|
|
@@ -183,7 +186,7 @@ module Maze
|
|
183
186
|
# Both digest types are stored whatever
|
184
187
|
sha1 = Digest::SHA1.hexdigest(request.body)
|
185
188
|
simple = request.body.bytesize
|
186
|
-
$logger.
|
189
|
+
$logger.trace "DIGESTS computed: sha1=#{sha1} simple=#{simple}"
|
187
190
|
|
188
191
|
# Check digests match
|
189
192
|
case parts[0]
|
@@ -11,6 +11,21 @@ module Maze
|
|
11
11
|
|
12
12
|
header['Access-Control-Expose-Headers'] = 'Bugsnag-Sampling-Probability'
|
13
13
|
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def add_request(request)
|
18
|
+
if sampling_request? request
|
19
|
+
Server.sampling_requests.add request
|
20
|
+
else
|
21
|
+
Server.traces.add request
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def sampling_request?(request)
|
26
|
+
body = request[:body]
|
27
|
+
body.keys.eql?(['resourceSpans']) && body['resourceSpans'].empty?
|
28
|
+
end
|
14
29
|
end
|
15
30
|
end
|
16
31
|
end
|
@@ -107,7 +107,7 @@ module Maze
|
|
107
107
|
while (request = socket.gets) && (request.chomp.length > 0)
|
108
108
|
key, val = request.chomp.split(': ')
|
109
109
|
headers[key] = val
|
110
|
-
$logger.
|
110
|
+
$logger.trace "Received #{headers.size} headers"
|
111
111
|
end
|
112
112
|
headers
|
113
113
|
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 = '
|
10
|
+
VERSION = '8.0.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:
|
4
|
+
version: 8.0.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-
|
11
|
+
date: 2023-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -325,6 +325,7 @@ executables:
|
|
325
325
|
- bugsnag-print-load-paths
|
326
326
|
- download-logs
|
327
327
|
- maze-runner
|
328
|
+
- purge-projects
|
328
329
|
- upload-app
|
329
330
|
extensions: []
|
330
331
|
extra_rdoc_files: []
|
@@ -332,6 +333,7 @@ files:
|
|
332
333
|
- bin/bugsnag-print-load-paths
|
333
334
|
- bin/download-logs
|
334
335
|
- bin/maze-runner
|
336
|
+
- bin/purge-projects
|
335
337
|
- bin/upload-app
|
336
338
|
- lib/features/scripts/await-android-emulator.sh
|
337
339
|
- lib/features/scripts/clear-android-app-data.sh
|
@@ -360,6 +362,7 @@ files:
|
|
360
362
|
- lib/features/steps/session_tracking_steps.rb
|
361
363
|
- lib/features/steps/trace_steps.rb
|
362
364
|
- lib/features/steps/value_steps.rb
|
365
|
+
- lib/features/support/cucumber_types.rb
|
363
366
|
- lib/features/support/env.rb
|
364
367
|
- lib/features/support/internal_hooks.rb
|
365
368
|
- lib/maze.rb
|
@@ -415,7 +418,6 @@ files:
|
|
415
418
|
- lib/maze/option/processor.rb
|
416
419
|
- lib/maze/option/validator.rb
|
417
420
|
- lib/maze/plugins/bugsnag_reporting_plugin.rb
|
418
|
-
- lib/maze/plugins/cucumber_report_plugin.rb
|
419
421
|
- lib/maze/plugins/datadog_metrics_plugin.rb
|
420
422
|
- lib/maze/plugins/error_code_plugin.rb
|
421
423
|
- lib/maze/plugins/global_retry_plugin.rb
|
@@ -1,101 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'bugsnag'
|
4
|
-
require 'cucumber/core/filter'
|
5
|
-
require 'json'
|
6
|
-
|
7
|
-
# Required to access the options
|
8
|
-
module Cucumber
|
9
|
-
class Configuration
|
10
|
-
attr_accessor :options
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
module Maze
|
15
|
-
module Plugins
|
16
|
-
class CucumberReportPlugin
|
17
|
-
|
18
|
-
def initialize
|
19
|
-
configured_data = {
|
20
|
-
driver_class: Maze.driver.class,
|
21
|
-
device_farm: Maze.config.farm,
|
22
|
-
device: Maze.config.device,
|
23
|
-
os: Maze.config.os,
|
24
|
-
os_version: Maze.config.os_version
|
25
|
-
}
|
26
|
-
buildkite_data = {
|
27
|
-
pipeline: ENV['BUILDKITE_PIPELINE_NAME'],
|
28
|
-
repo: ENV['BUILDKITE_REPO'],
|
29
|
-
build_url: ENV['BUILDKITE_BUILD_URL'],
|
30
|
-
branch: ENV['BUILDKITE_BRANCH'],
|
31
|
-
message: ENV['BUILDKITE_MESSAGE'],
|
32
|
-
step: ENV['BUILDKITE_LABEL'],
|
33
|
-
commit: ENV['BUILDKITE_COMMIT']
|
34
|
-
}
|
35
|
-
report['configuration'] = configured_data
|
36
|
-
report['build'] = buildkite_data
|
37
|
-
end
|
38
|
-
|
39
|
-
def install_plugin(cuc_config)
|
40
|
-
unless Maze.config.tms_uri && Maze.config.tms_token && ENV['BUILDKITE']
|
41
|
-
$logger.info 'No test report will be delivered for this run'
|
42
|
-
return
|
43
|
-
end
|
44
|
-
# Add installation hook
|
45
|
-
cuc_config.formats << ['json', {}, json_report_stream]
|
46
|
-
|
47
|
-
# Add exit hook
|
48
|
-
at_exit do
|
49
|
-
finish_report
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def json_report_stream
|
54
|
-
@json_report_stream ||= StringIO.new
|
55
|
-
end
|
56
|
-
|
57
|
-
def report
|
58
|
-
@report ||= {}
|
59
|
-
end
|
60
|
-
|
61
|
-
private
|
62
|
-
|
63
|
-
def finish_report
|
64
|
-
session_hash = JSON.parse(json_report_stream.string)
|
65
|
-
report[:session] = session_hash
|
66
|
-
output_folder = File.join(Dir.pwd, 'maze_output')
|
67
|
-
filename = 'maze_report.json'
|
68
|
-
filepath = File.join(output_folder, filename)
|
69
|
-
|
70
|
-
begin
|
71
|
-
File.open(filepath, 'w') do |file|
|
72
|
-
file.puts JSON.pretty_generate(report)
|
73
|
-
end
|
74
|
-
rescue => e
|
75
|
-
$logger.warn 'Report could not be saved locally'
|
76
|
-
$logger.warn e.message
|
77
|
-
end
|
78
|
-
|
79
|
-
send_report
|
80
|
-
end
|
81
|
-
|
82
|
-
def send_report
|
83
|
-
uri = URI("#{Maze.config.tms_uri}/report")
|
84
|
-
request = Net::HTTP::Post.new(uri)
|
85
|
-
request['Content-Type'] = 'application/json'
|
86
|
-
request['Authorization'] = Maze.config.tms_token
|
87
|
-
request.body = JSON.generate(report)
|
88
|
-
|
89
|
-
begin
|
90
|
-
http = Net::HTTP.new(uri.hostname, uri.port)
|
91
|
-
http.request(request)
|
92
|
-
rescue => e
|
93
|
-
$logger.warn 'Report delivery attempt failed'
|
94
|
-
$logger.warn e.message
|
95
|
-
else
|
96
|
-
$logger.info 'Cucumber report delivered to test report server'
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|