bugsnag-maze-runner 9.27.3 → 9.28.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: 0311fd0e499a676775d0b02bc1d5a9a73fba218845a531b60e4c2848bfd2f138
4
- data.tar.gz: b38995cabfda41bc015b509ca10185198be47ad65210c7bcb24748c58278679d
3
+ metadata.gz: 0cd6f7e392e3c048cf4775a2715f3d87f692bc0a34234ff31a887dbf45c9e01d
4
+ data.tar.gz: af10924777104f0532f7294f49350244280938fb022ecea647f8756902c3be43
5
5
  SHA512:
6
- metadata.gz: 48a00d3048487f3382bd4b7daeda0a3b27e3cce03037f1bd595d7e1217bdcf21428bd45af8c6d7097f858f655f434d8d8c1d740fb8ca66b78af7dbf88a4e9f9f
7
- data.tar.gz: 40b2f8ba974a603f680a99baa2dced5b3645641e7d6f6eae69188bc5fd3052543c9dffca252bd44fab76bcac7832b6e35144eb116fc43e0d5fe93289584804a3
6
+ metadata.gz: 95163d0e29cba6dc81ae339604626396233c4d7aeb2cf779f8e1f91e9877eb09c9e3d722d90822ec356b6cef28e6df0175b575a05bde7665820cfdfc5bea63e9
7
+ data.tar.gz: c61f7b8579b2e918d402b0736ab872c56cff6843df8e87386a4f1bfec849f2a83dd4dea900eb005dc518a2af0fecadf33717c0d79f2a064f7bee0be30e372a1f
@@ -38,7 +38,7 @@ end
38
38
  # Sends the app to the background indefinitely
39
39
  # Requires a running Appium driver
40
40
  When('I send the app to the background') do
41
- Maze.driver.background_app(-1)
41
+ Maze::Api::Appium::AppManager.new.background(-1)
42
42
  end
43
43
 
44
44
  # Sends the app to the background for a number of seconds
@@ -46,7 +46,7 @@ end
46
46
  #
47
47
  # @step_input timeout [Integer] The amount of time the app is in the background in seconds
48
48
  When('I send the app to the background for {int} second(s)') do |timeout|
49
- Maze.driver.background_app(timeout)
49
+ Maze::Api::Appium::AppManager.new.background(timeout)
50
50
  end
51
51
 
52
52
  # Clears a given element
@@ -100,13 +100,16 @@ end
100
100
 
101
101
  # Before each scenario
102
102
  Before do |scenario|
103
+ $logger.debug "Before hook - scenario.status: #{scenario.status}"
103
104
  next if scenario.status == :skipped
104
105
 
105
106
  Maze.scenario = Maze::Api::Cucumber::Scenario.new(scenario)
106
107
 
107
108
  # Skip scenario if the driver it needs has failed
109
+ $logger.debug "Before hook - Maze.driver&.failed?: #{Maze.driver&.failed?}"
108
110
  if (Maze.mode == :appium || Maze.mode == :browser) && Maze.driver.failed?
109
- skip_this_scenario
111
+ $logger.debug "Failing scenario because the #{Maze.mode.to_s} driver failed: #{Maze.driver.failure_reason}"
112
+ scenario.fail('Cannot run scenario - driver failed')
110
113
  end
111
114
 
112
115
  # Default to no dynamic retry
@@ -134,6 +137,7 @@ end
134
137
 
135
138
  # General processing to be run after each scenario
136
139
  After do |scenario|
140
+ $logger.debug "After hook 1 - scenario.status: #{scenario.status}"
137
141
  next if scenario.status == :skipped
138
142
 
139
143
  # If we're running on macos, take a screenshot if the scenario fails
@@ -227,6 +231,7 @@ end
227
231
  #
228
232
  # Furthermore, this hook should appear after the general hook as they are executed in reverse order by Cucumber.
229
233
  After do |scenario|
234
+ $logger.debug "After hook 2 - scenario.status: #{scenario.status}"
230
235
  next if scenario.status == :skipped
231
236
 
232
237
  # Call any pre_complete hooks registered by the client
@@ -238,8 +243,10 @@ After do |scenario|
238
243
  Maze.scenario.mark_as_failed msg
239
244
  end
240
245
 
241
- # Fail the scenario if the Appium driver failed
242
- if Maze.mode == :appium && Maze.driver.failed?
246
+ # Fail the scenario if the driver failed, if the scenario hasn't already failed
247
+ $logger.debug "After hook 2 - Maze.driver&.failed?: #{Maze.driver&.failed?}"
248
+ if (Maze.mode == :appium || Maze.mode == :browser) && Maze.driver.failed? && !scenario.failed?
249
+ $logger.debug "Marking scenario as failed because driver failed: #{Maze.driver.failure_reason}"
243
250
  Maze.scenario.mark_as_failed Maze.driver.failure_reason
244
251
  end
245
252
 
@@ -249,6 +256,7 @@ end
249
256
  # Test all requests against schemas or extra validation rules. These will only run if the schema/validation is
250
257
  # specified for the specific endpoint
251
258
  After do |scenario|
259
+ $logger.debug "After hook 3 - scenario.status: #{scenario.status}"
252
260
  next if scenario.status == :skipped
253
261
 
254
262
  ['error', 'session', 'build', 'trace'].each do |endpoint|
@@ -26,7 +26,7 @@ module Maze
26
26
 
27
27
  # Terminates the app. If terminate fails then clients may wish to ty the legacy close method, so an option
28
28
  # is provided to not fail the Appium driver.
29
- # @fail_driver [Boolean] Whether to fail the Appium driver if the app cannot be terminated
29
+ # @param fail_driver [Boolean] Whether to fail the Appium driver if the app cannot be terminated
30
30
  # @returns [Boolean] Whether the app was successfully closed
31
31
  def terminate(fail_driver = true)
32
32
  if failed_driver?
@@ -43,6 +43,24 @@ module Maze
43
43
  raise e
44
44
  end
45
45
 
46
+ # Instructs Appium to background the app
47
+ # @param seconds [Integers] The number of seconds to background the app for, or -1 for indefinitely
48
+ # @returns [Boolean] Whether the instruction to Appium was successfully made
49
+ def background(seconds = -1)
50
+ if failed_driver?
51
+ $logger.error 'Cannot background the app - Appium driver failed.'
52
+ return false
53
+ end
54
+
55
+ @driver.background_app(seconds)
56
+ true
57
+ rescue Selenium::WebDriver::Error::ServerError, Selenium::WebDriver::Error::UnknownError => e
58
+ $logger.error "Failed to background app: #{e.message}"
59
+ # Assume the remote appium session has stopped, so crash out of the session
60
+ fail_driver(e.message)
61
+ raise e
62
+ end
63
+
46
64
  # Launches the app (legacy method).
47
65
  # @returns [Boolean] Whether the app was successfully launched
48
66
  def launch
@@ -38,6 +38,8 @@ module Maze
38
38
  interval = 10
39
39
  elsif error.message.include? '\'platformVersion\' must be a valid version number.'
40
40
  interval = 10
41
+ elsif error.message.include?('Device model with name') && error.message.include?('is currently unavailable')
42
+ interval = 10
41
43
  else
42
44
  # Do not retry in any other case
43
45
  end
@@ -24,6 +24,8 @@ module Maze
24
24
  end
25
25
 
26
26
  def after(scenario)
27
+ $logger.debug "Appium after hook"
28
+
27
29
  manager = Maze::Api::Appium::AppManager.new
28
30
  if Maze.config.os == 'macos'
29
31
  # Close the app - without the sleep launching the app for the next scenario intermittently fails
@@ -37,7 +39,7 @@ module Maze
37
39
  $logger.warn 'terminate_app failed, using the slower but more forceful close_app instead'
38
40
  manager.close
39
41
  else
40
- $logger.warn 'terminate_app failed, future errors may occur if the application did not close remotely'
42
+ $logger.warn 'terminate_app failed, future errors may occur if the application did not close properly'
41
43
  end
42
44
  end
43
45
 
data/lib/maze.rb CHANGED
@@ -8,7 +8,7 @@ require_relative 'maze/timers'
8
8
  # providing an alternative to the proliferation of global variables or singletons.
9
9
  module Maze
10
10
 
11
- VERSION = '9.27.3'
11
+ VERSION = '9.28.0'
12
12
 
13
13
  class << self
14
14
  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.27.3
4
+ version: 9.28.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: 2025-04-10 00:00:00.000000000 Z
11
+ date: 2025-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber