bugsnag-maze-runner 9.18.0 → 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: c6c149e156ab34e2716d12ea70903fe9731d9806cf96c7a1bb6505fef007d97b
4
- data.tar.gz: 1152cb99ceeb9cf8882d43b931655cb0ba9abf20baac77770e6c98a5b53fd78b
3
+ metadata.gz: 2ed96ef59a28728acac2405e11e0838fdee4e47b2971236e98a0142f2eb72211
4
+ data.tar.gz: 75c6d6c2c0c0a45928c2da61fe6b8deb584acc71ef7a841aeb0d0fa981c6b6c5
5
5
  SHA512:
6
- metadata.gz: b2f057457f5d2e9c51c8b7509ab276ca34ddbd7510e8821af07e89b58ea8b519e556f3ae5c15abfb16f20ca0e44e3dafa9861680edbc079e82bde903610dc3eb
7
- data.tar.gz: 10f760389cd942ffc3c7b5116feefdd2f0dbf00f7abcbd7f03927f794e7d5b4ce3f2656fe9f04226be5faa7f60f862817838c77f86a0abf37272b5b386c9ccd7
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.0'
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.0
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-07 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
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 1.7.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: uri
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.13.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.13.0
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: appium_lib
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -460,6 +474,7 @@ files:
460
474
  - lib/maze/document_server.rb
461
475
  - lib/maze/driver/appium.rb
462
476
  - lib/maze/driver/browser.rb
477
+ - lib/maze/error_captor.rb
463
478
  - lib/maze/errors.rb
464
479
  - lib/maze/generator.rb
465
480
  - lib/maze/helper.rb