bugsnag-maze-runner 9.7.0 → 9.9.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: f948d5bf3980cb7514127f60fbecb2ffdb4484c8d19a484e39ebccaaaebda535
4
- data.tar.gz: efb5c22b4c81824d63c2762ea0792ad6316dc8744660042b4c1d6357eb8b7a5c
3
+ metadata.gz: 05620dbfd42646b2996821130544d406245079555a8b6c527af25eb1b3c66bae
4
+ data.tar.gz: d58825fa3af12c8dcb65dd6d521e7eb3cc9c28afb973764db9d27679a52cfd97
5
5
  SHA512:
6
- metadata.gz: 100b68e6b60360ea1a0bad3eb51c2b7e28fce9328e0ebc5a8bfeba089621714cfb834d7c4ae568f4c88c7399ff2e2b0fef351cbf8dd97397b3fb4da5cd39644b
7
- data.tar.gz: ba9d6bbf2e966981d14be78688c119967278d662b5c0cc166fedba5302c829a3e9b2e93a0c4dfefc30893c5a9cebd09e1f7408de7c71ee7986d3fe89995eb748
6
+ metadata.gz: 16292e64ea5a965eb90b092e81e1daf38db6db4812275e7cbdbec12376c62ab536a9cd36d53dbc1cc20fbcdea8d3ea325d756c7c4f3d6c9fbf9b14d166851792
7
+ data.tar.gz: 28f90a054e75bb4ac6f9e38e06ed4f3de214c41c01e92e94b80f5f94aeca2642a496d8515fd7be17bbec5663500fe612da9641edd22e06acb7b4e819f35a972c
@@ -212,6 +212,30 @@ Then('a span named {string} has a parent named {string}') do |child_name, parent
212
212
  end
213
213
  end
214
214
 
215
+ Then('a span named {string} has the following properties:') do |span_name, table|
216
+ spans = spans_from_request_list(Maze::Server.list_for('traces'))
217
+ found_spans = spans.find_all { |span| span['name'].eql?(span_name) }
218
+ raise Test::Unit::AssertionFailedError.new "No spans were found with the name #{span_name}" if found_spans.empty?
219
+
220
+ expected_properties = table.hashes
221
+
222
+ match = false
223
+ found_spans.each do |span|
224
+ matches = expected_properties.map do |expected_property|
225
+ property = Maze::Helper.read_key_path(span, expected_property['property'])
226
+ expected_property['value'].eql?(property.to_s)
227
+ end
228
+ if matches.all? && !matches.empty?
229
+ match = true
230
+ break
231
+ end
232
+ end
233
+
234
+ unless match
235
+ raise Test::Unit::AssertionFailedError.new "No spans were found containing all of the given properties"
236
+ end
237
+ end
238
+
215
239
  def spans_from_request_list list
216
240
  return list.remaining
217
241
  .flat_map { |req| req[:body]['resourceSpans'] }
data/lib/maze/aws/sam.rb CHANGED
@@ -63,14 +63,16 @@ module Maze
63
63
  # @return [Hash]
64
64
  def parse(output)
65
65
  unless valid?(output)
66
- raise <<~ERROR
67
- Unable to parse Lambda output!
68
- The likely cause is:
66
+ message = <<-WARNING
67
+ The lambda function did not successfully complete.
68
+ This may be expected and a normal result of the text execution.
69
+ The listed cause is:
69
70
  > #{output.last.chomp}
70
71
 
71
72
  Full output:
72
73
  > #{output.map(&:chomp).join("\n > ")}
73
- ERROR
74
+ WARNING
75
+ $logger.warn message
74
76
  end
75
77
 
76
78
  # Attempt to parse the last line of output as this is where a JSON
@@ -34,6 +34,10 @@ module Maze
34
34
  interval = 10
35
35
  elsif error.message.include? 'Could not proxy command to the remote server'
36
36
  interval = 10
37
+ elsif error.message.include? 'Could not find a connected Android device'
38
+ interval = 10
39
+ elsif error.message.include? '\'platformVersion\' must be a valid version number.'
40
+ interval = 10
37
41
  else
38
42
  # Do not retry in any other case
39
43
  end
@@ -54,26 +58,24 @@ module Maze
54
58
  end
55
59
 
56
60
  def device_capabilities
57
- # Doubling up on capabilities in both the `appium:options` and `appium` sub dictionaries.
58
- # See PLAT-11087
59
61
  config = Maze.config
60
62
  common_caps = {
61
63
  'noReset' => true,
62
64
  'newCommandTimeout' => 600
63
65
  }
64
66
  capabilities = {
65
- 'appium:options' => common_caps,
66
- 'appium' => common_caps,
67
67
  'bitbar:options' => {
68
- # Some capabilities probably belong in the top level
69
- # of the hash, but BitBar picks them up from here.
70
68
  'apiKey' => config.access_key,
71
69
  'app' => config.app,
72
70
  'findDevice' => false,
73
71
  'testTimeout' => 7200
74
72
  }
75
73
  }
76
- capabilities.deep_merge! common_caps
74
+ if Maze.config.appium_version && Maze.config.appium_version.to_f < 2.0
75
+ capabilities.merge!(common_caps)
76
+ else
77
+ capabilities['appium:options'] = common_caps
78
+ end
77
79
  capabilities.deep_merge! BitBarClientUtils.dashboard_capabilities
78
80
  capabilities.deep_merge! BitBarDevices.get_available_device(config.device)
79
81
  capabilities['bitbar:options']['appiumVersion'] = config.appium_version unless config.appium_version.nil?
@@ -18,22 +18,44 @@ module Maze
18
18
  if device_group_ids
19
19
  # Device group found - find a free device in it
20
20
  $logger.trace "Got group ids #{device_group_ids} for #{device_or_group_names}"
21
- group_count, device = api_client.find_device_in_groups(device_group_ids)
22
- if device.nil?
23
- raise 'There are no devices available'
21
+ if device_group_ids.size > 1
22
+ group_id = false
23
+ group_count, device = api_client.find_device_in_groups(device_group_ids)
24
+ if device.nil?
25
+ raise 'There are no devices available'
26
+ else
27
+ $logger.info "#{group_count} device(s) currently available in group(s) '#{device_or_group_names}'"
28
+ end
24
29
  else
25
- $logger.info "#{group_count} device(s) currently available in group(s) '#{device_or_group_names}'"
30
+ # Since there is only one group, we can use it verbatim
31
+ $logger.info "Using device group #{device_or_group_names}"
32
+ group_id = true
33
+ device_name = device_group_ids.first
26
34
  end
27
35
  else
28
36
  # See if there is a device with the given name
29
37
  device = api_client.find_device device_or_group_names
30
38
  end
31
39
 
32
- device_name = device['displayName']
33
- platform = device['platform'].downcase
34
- platform_version = device['softwareVersion']['releaseVersion']
40
+ # If a single device has been identified use that to determine other characteristics
41
+ if device
42
+ device_name = device['displayName']
43
+ platform = device['platform'].downcase
44
+ platform_version = device['softwareVersion']['releaseVersion']
35
45
 
36
- $logger.info "Selected device: #{device_name} (#{platform} #{platform_version})"
46
+ $logger.info "Selected device: #{device_name} (#{platform} #{platform_version})"
47
+ else
48
+ # If a device group has been identified, extrapolate characteristics from the group name
49
+ if android_match = Regexp.new('(ANDROID|android)_(\d{1,2})').match(device_or_group_names)
50
+ platform = 'android'
51
+ platform_version = android_match[2]
52
+ elsif ios_match = Regexp.new('(IOS|ios)_(\d{1,2})').match(device_or_group_names)
53
+ platform = 'ios'
54
+ platform_version = ios_match[2]
55
+ end
56
+
57
+ $logger.info "Selected device group: #{device_or_group_names} (#{platform} #{platform_version})"
58
+ end
37
59
 
38
60
  # TODO: Setting the config here is rather a side effect and factoring it out would be better.
39
61
  # For now, though, it means not having to provide the --os and --os-version options on the command line.
@@ -42,9 +64,9 @@ module Maze
42
64
 
43
65
  case platform
44
66
  when 'android'
45
- make_android_hash(device_name)
67
+ make_android_hash(device_name, group_id)
46
68
  when 'ios'
47
- make_ios_hash(device_name)
69
+ make_ios_hash(device_name, group_id)
48
70
  else
49
71
  throw "Invalid device platform specified #{platform}"
50
72
  end
@@ -90,9 +112,7 @@ module Maze
90
112
  end
91
113
  end
92
114
 
93
- def make_android_hash(device)
94
- # Tripling up on capabilities in the `appium:options`, `appium` sub dictionaries and base dictionary.
95
- # See PLAT-11087
115
+ def android_base_hash
96
116
  appium_options = {
97
117
  'automationName' => 'UiAutomator2',
98
118
  'autoGrantPermissions' => true,
@@ -103,20 +123,31 @@ module Maze
103
123
  appium_options['appPackage'] = Maze.config.app_package unless Maze.config.app_package.nil?
104
124
  hash = {
105
125
  'platformName' => 'Android',
106
- 'deviceName' => 'Android Phone',
107
- 'appium:options' => appium_options,
108
- 'appium' => appium_options,
109
- 'bitbar:options' => {
110
- 'device' => device,
111
- }
126
+ 'deviceName' => 'Android Phone'
112
127
  }
113
- hash.merge!(appium_options)
128
+ if Maze.config.appium_version && Maze.config.appium_version.to_f < 2.0
129
+ hash.merge!(appium_options)
130
+ else
131
+ hash['appium:options'] = appium_options
132
+ end
133
+ hash.dup
134
+ end
135
+
136
+ def make_android_hash(device, group_id = false)
137
+ hash = android_base_hash
138
+ if group_id
139
+ hash['bitbar:options'] = {
140
+ 'deviceGroupId' => device
141
+ }
142
+ else
143
+ hash['bitbar:options'] = {
144
+ 'device' => device
145
+ }
146
+ end
114
147
  hash.freeze
115
148
  end
116
149
 
117
- def make_ios_hash(device)
118
- # Tripling up on capabilities in the `appium:options`, `appium` sub dictionaries and base dictionary.
119
- # See PLAT-11087
150
+ def ios_base_hash
120
151
  appium_options = {
121
152
  'automationName' => 'XCUITest',
122
153
  'shouldTerminateApp' => 'true',
@@ -125,13 +156,26 @@ module Maze
125
156
  hash = {
126
157
  'platformName' => 'iOS',
127
158
  'deviceName' => 'iPhone device',
128
- 'appium:options' => appium_options,
129
- 'appium' => appium_options,
130
- 'bitbar:options' => {
159
+ }
160
+ if Maze.config.appium_version && Maze.config.appium_version.to_f < 2.0
161
+ hash.merge!(appium_options)
162
+ else
163
+ hash['appium:options'] = appium_options
164
+ end
165
+ hash.dup
166
+ end
167
+
168
+ def make_ios_hash(device, group_id = false)
169
+ hash = ios_base_hash
170
+ if group_id
171
+ hash['bitbar:options'] = {
172
+ 'deviceGroupId' => device
173
+ }
174
+ else
175
+ hash['bitbar:options'] = {
131
176
  'device' => device
132
177
  }
133
- }
134
- hash.merge!(appium_options)
178
+ end
135
179
  hash.freeze
136
180
  end
137
181
  end
data/lib/maze/server.rb CHANGED
@@ -242,6 +242,7 @@ module Maze
242
242
  server.mount '/logs', Servlets::LogServlet
243
243
  server.mount '/metrics', Servlets::Servlet, :metrics
244
244
  server.mount '/reflect', Servlets::ReflectiveServlet
245
+ server.mount '/docs', WEBrick::HTTPServlet::FileHandler, Maze.config.document_server_root unless Maze.config.document_server_root.nil?
245
246
  server.start
246
247
  rescue StandardError => e
247
248
  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.7.0'
10
+ VERSION = '9.9.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.7.0
4
+ version: 9.9.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-04-08 00:00:00.000000000 Z
11
+ date: 2024-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -240,14 +240,14 @@ dependencies:
240
240
  requirements:
241
241
  - - "~>"
242
242
  - !ruby/object:Gem::Version
243
- version: 6.12.0
243
+ version: '7.0'
244
244
  type: :development
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
248
  - - "~>"
249
249
  - !ruby/object:Gem::Version
250
- version: 6.12.0
250
+ version: '7.0'
251
251
  - !ruby/object:Gem::Dependency
252
252
  name: markdown
253
253
  requirement: !ruby/object:Gem::Requirement