bugsnag-maze-runner 8.12.1 → 8.13.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: 3762714f1e7360f56d166b5b03a857da81bae9a13a2cf304638cda47a0a192da
4
- data.tar.gz: d1db769adbb399e9b4a4cbd4c63db6dbf128de730504c3382c3b885a803bc3d9
3
+ metadata.gz: 1c4179797bd1c2f213229a61382af46e4961ed8e1c927752082bef991edb7763
4
+ data.tar.gz: 3861468539c18e1e1ab53a9937eb6fc5fea67147a5a5016d660189ac95103dab
5
5
  SHA512:
6
- metadata.gz: a7150ffbcf0259314d085e2ade70f31589e0386fe01e2b2d656fe88c99868b9f098bb4c45ac0708cee81d2d1b62e94a5959985ef515d3008db35f513b4fd4e3e
7
- data.tar.gz: 2ef4b990914573038c66c1ff824681d9ba29752ea5746831d303a9ee2e5b3706cc66734a6c307387dfbb1a72df99a7e1f6e0f34f65af848a5d987a9615029d69
6
+ metadata.gz: f92c80ce71906d9b16ca07b70a8e2637beb6643e864851667fbca53d28cd464663850480b381c89f31b5afc79928125a6362cc69c227889239771d3938a1582a
7
+ data.tar.gz: 9641dba3a1675bf5d6afdad3fd7244db7bba1e73e4d3cba91ed0a146f886fe8ead9278b8874b53f194ec73701f508f13b5a0ad1028225c818bc1c5da225ce7a2
data/bin/download-logs CHANGED
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ # Workaround for running on ARM macOS machines
5
+ require 'em/pure_ruby'
6
+
4
7
  require_relative '../lib/maze'
5
8
  require_relative '../lib/maze/client/bs_client_utils'
6
9
  require_relative '../lib/maze/logger'
data/bin/maze-runner CHANGED
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ # Workaround for running on ARM macOS machines
5
+ require 'em/pure_ruby'
6
+
4
7
  require 'cucumber/cli/main'
5
8
 
6
9
  require_relative '../lib/utils/deep_merge'
data/bin/purge-projects CHANGED
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ # Workaround for running on ARM macOS machines
5
+ require 'em/pure_ruby'
6
+
4
7
  require_relative '../lib/maze'
5
8
  require_relative '../lib/maze/client/bb_api_client'
6
9
  require_relative '../lib/maze/logger'
data/bin/upload-app CHANGED
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ # Workaround for running on ARM macOS machines
5
+ require 'em/pure_ruby'
6
+
4
7
  require_relative '../lib/maze'
5
8
  require_relative '../lib/maze/client/bs_client_utils'
6
9
  require_relative '../lib/maze/client/bb_client_utils'
@@ -11,6 +11,7 @@ module Maze
11
11
  APP_UPLOAD_FAILURE = 100
12
12
  TUNNEL_FAILURE = 101
13
13
  SESSION_CREATION_FAILURE = 102
14
+ APPIUM_SESSION_FAILURE = 103
14
15
  end
15
16
  end
16
17
  end
@@ -19,41 +19,61 @@ module Maze
19
19
  # @param api_key [String] The BitBar API key
20
20
  # @param app [String] A path to the application file
21
21
  # @param app_id_file [String] the file to write the uploaded app url to BitBar
22
- def upload_app(api_key, app, app_id_file=nil)
22
+ # @param max_attempts [Integer] the maximum number of attempts to upload the app
23
+ def upload_app(api_key, app, app_id_file=nil, max_attempts=5)
23
24
  uuid_regex = /\A[0-9]+\z/
24
25
 
25
26
  if uuid_regex.match? app
26
27
  $logger.info "Using pre-uploaded app with ID #{app}"
27
28
  app_uuid = app
28
29
  else
29
- expanded_app = Maze::Helper.expand_path(app)
30
- $logger.info "Uploading app: #{expanded_app}"
30
+ upload_proc = Proc.new do |app_path|
31
+ $logger.info "Uploading app: #{app_path}"
31
32
 
32
- # Upload the app to BitBar
33
- uri = URI('https://cloud.bitbar.com/api/me/files')
34
- request = Net::HTTP::Post.new(uri)
35
- request.basic_auth(api_key, '')
36
- request.set_form({ 'file' => File.new(expanded_app, 'rb') }, 'multipart/form-data')
33
+ # Upload the app to BitBar
34
+ uri = URI('https://cloud.bitbar.com/api/me/files')
35
+ request = Net::HTTP::Post.new(uri)
36
+ request.basic_auth(api_key, '')
37
+ request.set_form({ 'file' => File.new(app_path, 'rb') }, 'multipart/form-data')
37
38
 
38
- res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
39
- http.request(request)
39
+ Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
40
+ http.request(request)
41
+ end
40
42
  end
41
43
 
42
- # Pull the UUID from the response
43
- begin
44
- response = JSON.parse res.body
45
- if response.key?('id')
46
- app_uuid = response['id'].to_s
47
- $logger.info "Uploaded app ID: #{app_uuid}"
48
- $logger.info 'You can use this ID to avoid uploading the same app more than once.'
49
- else
50
- $logger.error "Unexpected response body: #{response}"
51
- raise 'App upload failed'
44
+ expanded_app = Maze::Helper.expand_path(app)
45
+
46
+ attempts = 0
47
+ app_uuid = nil
48
+ last_error = nil
49
+ while attempts < max_attempts && app_uuid.nil?
50
+ attempts += 1
51
+ begin
52
+ response = upload_proc.call(expanded_app)
53
+ body = JSON.parse(response.body)
54
+ if body.key?('id')
55
+ app_uuid = body['id'].to_s
56
+ $logger.info "Uploaded app ID: #{app_uuid}"
57
+ $logger.info 'You can use this ID to avoid uploading the same app more than once.'
58
+ else
59
+ error_string = "Unexpected response body: #{body}"
60
+ $logger.error error_string
61
+ last_error = RuntimeError.new(error_string)
62
+ end
63
+ rescue JSON::ParserError => error
64
+ last_error = error
65
+ Bugsnag.notify error
66
+ $logger.error "Expected JSON response, received: #{response}"
67
+ rescue => error
68
+ last_error = error
69
+ Bugsnag.notify error
70
+ $logger.error "Unexpected error uploading app: #{error}"
52
71
  end
53
- rescue JSON::ParserError => error
54
- Bugsnag.notify error
55
- $logger.error "Expected JSON response, received: #{res}"
56
- raise
72
+ end
73
+
74
+ if app_uuid.nil?
75
+ $logger.error "App upload to BitBar failed after #{attempts} attempts"
76
+ raise last_error
57
77
  end
58
78
  end
59
79
 
@@ -20,10 +20,16 @@ module Maze
20
20
  return false if !Maze.config.enable_retries || retried_previously?(test_case)
21
21
 
22
22
  if retry_on_driver_error?(event)
23
- $logger.warn "Retrying #{test_case.name} due to driver error: #{event.result.exception}"
24
23
  if Maze.driver.is_a?(Maze::Driver::Appium)
25
- Maze.driver.restart
24
+ if Maze.config.farm.eql?(:bb)
25
+ Maze::Hooks::ErrorCodeHook.exit_code = Maze::Api::ExitCode::APPIUM_SESSION_FAILURE
26
+ return false
27
+ else
28
+ $logger.warn "Retrying #{test_case.name} due to appium driver error: #{event.result.exception}"
29
+ Maze.driver.restart
30
+ end
26
31
  elsif Maze.driver.is_a?(Maze::Driver::Browser)
32
+ $logger.warn "Retrying #{test_case.name} due to selenium driver error: #{event.result.exception}"
27
33
  Maze.driver.refresh
28
34
  end
29
35
  elsif retry_on_tag?(test_case)
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 = '8.12.1'
10
+ VERSION = '8.13.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: 8.12.1
4
+ version: 8.13.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-11-09 00:00:00.000000000 Z
11
+ date: 2023-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber