bugsnag-maze-runner 9.18.1 → 9.19.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: 1bf3a12cf3a22fdf973e3fd8ac7880475395ab7cd6a449b7c7484ef9f6b9f1a0
4
- data.tar.gz: 492d5ed9de4b7203253d641244c84f45f7e571ea4114e9059f608af179e64622
3
+ metadata.gz: 2ed96ef59a28728acac2405e11e0838fdee4e47b2971236e98a0142f2eb72211
4
+ data.tar.gz: 75c6d6c2c0c0a45928c2da61fe6b8deb584acc71ef7a841aeb0d0fa981c6b6c5
5
5
  SHA512:
6
- metadata.gz: 50c855d588fa42abc11d7547a09ea3994c7d2da56873f62dfea3654a38841a6f67c4e47453f5cc51fbf98a8918187a1efe46ca6d89f987daf11eb8dc49355744
7
- data.tar.gz: b2280139bc8e8ccf867c9c655d386f3be1d30990aa4ed392e343170338a2b95f173b6ae742ce513f5449d8d81e3a4d214101ce605b36c10a913f7e8aff5ea9a3
6
+ metadata.gz: b2871cd29e22a58fe4200a44beaffc56d385ffe7d6fc27ca7a0bc5c3391cc87fba32f3f12203059c0e54d1c79e15f5a43646ade01bef8a3919d8602b331ce0ff
7
+ data.tar.gz: e30d047f7f87f7d7f63985fa060f220e854b3d67ef3a2eb495b62c9f3a025da3291dce27b2472522430e0b05262ce4356d93c2871e8d73a8558ab31b407e0ced
data/bin/maze-runner CHANGED
@@ -36,6 +36,7 @@ require_relative '../lib/maze/aws_public_ip'
36
36
  require_relative '../lib/maze/compare'
37
37
  require_relative '../lib/maze/docker'
38
38
  require_relative '../lib/maze/document_server'
39
+ require_relative '../lib/maze/error_captor'
39
40
  require_relative '../lib/maze/errors'
40
41
  require_relative '../lib/maze/generator'
41
42
  require_relative '../lib/maze/helper'
@@ -186,6 +186,7 @@ ensure
186
186
  Maze::Runner.environment.clear
187
187
  Maze::Store.values.clear
188
188
  Maze::Aws::Sam.reset!
189
+ Maze::ErrorCaptor.reset
189
190
  end
190
191
 
191
192
  def output_received_requests(request_type)
@@ -33,6 +33,7 @@ module Maze
33
33
  end
34
34
  config.middleware.use(AssertErrorMiddleware)
35
35
  config.middleware.use(AmbiguousErrorMiddleware)
36
+ config.middleware.use(ErrorCaptureMiddleware)
36
37
  config.add_metadata(:'buildkite', metadata)
37
38
  config.project_root = Dir.pwd
38
39
  end
@@ -88,5 +89,18 @@ module Maze
88
89
  @middleware.call(report)
89
90
  end
90
91
  end
92
+
93
+ class ErrorCaptureMiddleware
94
+
95
+ def initialize(middleware)
96
+ @middleware = middleware
97
+ end
98
+
99
+ def call(report)
100
+ Maze::ErrorCaptor.instance.add_captured_error(report.dup)
101
+
102
+ @middleware.call(report)
103
+ end
104
+ end
91
105
  end
92
106
  end
@@ -65,16 +65,16 @@ edge_latest:
65
65
  version: 'latest'
66
66
  resolution: '1920x1080'
67
67
 
68
- safari_16:
68
+ safari_18:
69
69
  platform: 'macOS'
70
70
  osVersion: '13'
71
71
  browserName: 'safari'
72
- version: '16'
72
+ version: '18'
73
73
  resolution: '2560x1920'
74
74
 
75
- safari_15:
75
+ safari_17:
76
76
  platform: 'macOS'
77
77
  osVersion: '12'
78
78
  browserName: 'safari'
79
- version: '15'
79
+ version: '17'
80
80
  resolution: '2560x1920'
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Maze
4
+ class ErrorCaptor
5
+ attr_reader :captured_errors
6
+
7
+ class << self
8
+
9
+ # Sets the last error report that BugSnag has captured
10
+ #
11
+ # @param report [Bugsnag::Report] The report to set
12
+ def add(report)
13
+ captured_errors << report
14
+ end
15
+
16
+ # Returns an array of the primary error classes of captured error reports
17
+ #
18
+ # @return [Array<String>] The error classes
19
+ def classes
20
+ captured_errors.map { |report| report.summary[:error_class] }
21
+ end
22
+
23
+ # Returns the primary error messages of the captured error reports
24
+ #
25
+ # @return [Array<String>] The error messages
26
+ def messages
27
+ captured_errors.map { |report| report.summary[:message] }
28
+ end
29
+
30
+ # Resets the captured errors array
31
+ def reset
32
+ @captured_errors = []
33
+ end
34
+
35
+ # Whether any error reports exist in the current context
36
+ #
37
+ # @return [Boolean] Whether a report exists
38
+ def empty?
39
+ captured_errors.empty?
40
+ end
41
+
42
+ def captured_errors
43
+ @captured_errors ||= []
44
+ end
45
+ end
46
+ end
47
+ end
@@ -3,6 +3,13 @@ module Maze
3
3
  module Hooks
4
4
  # Hooks for Appium mode use
5
5
  class AppiumHooks < InternalHooks
6
+
7
+ APPIUM_DRIVER_FAILED_ERRORS = [
8
+ Selenium::WebDriver::Error::UnknownError,
9
+ Selenium::WebDriver::Error::ServerError,
10
+ Selenium::WebDriver::Error::WebDriverError
11
+ ]
12
+
6
13
  @client
7
14
 
8
15
  def before_all
@@ -23,21 +30,23 @@ module Maze
23
30
  end
24
31
 
25
32
  def after(scenario)
33
+ if scenario.failed?
34
+ Maze.driver = nil if driver_has_failed?
35
+ $logger.warn('The appium driver has failed, removing it to prevent future errors')
36
+ end
26
37
 
27
38
  if Maze.config.os == 'macos'
28
39
  # Close the app - without the sleep, launching the app for the next scenario intermittently fails
29
40
  system("killall -KILL #{Maze.config.app} && sleep 1")
30
41
  elsif [:bb, :bs, :local].include? Maze.config.farm
31
- write_device_logs(scenario) if scenario.failed?
32
-
33
42
  # Reset the server to ensure that test fixtures cannot fetch
34
43
  # commands from the previous scenario (in idempotent mode).
35
44
  begin
36
- Maze.driver.terminate_app Maze.driver.app_id
37
- rescue Selenium::WebDriver::Error::UnknownError
45
+ Maze.driver.terminate_app Maze.driver&.app_id
46
+ rescue Selenium::WebDriver::Error::UnknownError, Selenium::WebDriver::Error::InvalidSessionIdError
38
47
  if Maze.config.appium_version && Maze.config.appium_version.to_f < 2.0
39
48
  $logger.warn 'terminate_app failed, using the slower but more forceful close_app instead'
40
- Maze.driver.close_app
49
+ Maze.driver&.close_app
41
50
  else
42
51
  $logger.warn 'terminate_app failed, future errors may occur if the application did not close remotely'
43
52
  end
@@ -73,6 +82,14 @@ module Maze
73
82
 
74
83
  private
75
84
 
85
+ def driver_has_failed?
86
+ return false if Maze::ErrorCaptor.empty?
87
+
88
+ Maze::ErrorCaptor.classes.any? do |error_class|
89
+ APPIUM_DRIVER_FAILED_ERRORS.include?(error_class)
90
+ end
91
+ end
92
+
76
93
  # Pulls the device logs using Appium and writes them to file in the maze_output folder
77
94
  def write_device_logs(scenario)
78
95
  log_name = case Maze::Helper.get_current_platform
@@ -81,9 +98,10 @@ module Maze
81
98
  when 'ios'
82
99
  'syslog'
83
100
  end
84
- logs = Maze.driver.get_log(log_name)
85
-
86
- Maze::MazeOutput.new(scenario).write_device_logs(logs)
101
+ unless Maze.driver.nil?
102
+ logs = Maze.driver.get_log(log_name)
103
+ Maze::MazeOutput.new(scenario).write_device_logs(logs)
104
+ end
87
105
  end
88
106
  end
89
107
  end
@@ -90,7 +90,7 @@ module Maze
90
90
  end
91
91
  end
92
92
 
93
- # Pulls the logs from the device if the scenario fails
93
+ # Writes a set of logs to a device logs file
94
94
  # @param logs [Array<String>] The lines of log to be written
95
95
  def write_device_logs(logs)
96
96
 
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.18.1'
10
+ VERSION = '9.19.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.18.1
4
+ version: 9.19.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-11-13 00:00:00.000000000 Z
11
+ date: 2024-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -474,6 +474,7 @@ files:
474
474
  - lib/maze/document_server.rb
475
475
  - lib/maze/driver/appium.rb
476
476
  - lib/maze/driver/browser.rb
477
+ - lib/maze/error_captor.rb
477
478
  - lib/maze/errors.rb
478
479
  - lib/maze/generator.rb
479
480
  - lib/maze/helper.rb