bugsnag-maze-runner 8.12.1 → 8.13.1

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: 8edd9312852fa9f431bf8b2ed42473a111eec241ca23a4b5993121a64b4bfddc
4
+ data.tar.gz: 836546b1088e2d66727d062009748cc88ead618e9ec90e851ca87541cbad5b1e
5
5
  SHA512:
6
- metadata.gz: a7150ffbcf0259314d085e2ade70f31589e0386fe01e2b2d656fe88c99868b9f098bb4c45ac0708cee81d2d1b62e94a5959985ef515d3008db35f513b4fd4e3e
7
- data.tar.gz: 2ef4b990914573038c66c1ff824681d9ba29752ea5746831d303a9ee2e5b3706cc66734a6c307387dfbb1a72df99a7e1f6e0f34f65af848a5d987a9615029d69
6
+ metadata.gz: d8574f48c04eb96a0821fef71e041b39399f9aa65e07add2745aa64aa1b66de3819369a41c88b2b9a2583df3ceb31bca4bd90ef6e086368adb1333a7b5c12ec7
7
+ data.tar.gz: 8f4ed901c5e5b08cbba9c4bc7183aae1c20c0a8f769161956844f177e90c2014f8e1d829369ba2a62130c2f48c55ba86eb2265cfc8e42a5a64a9fe31c4f513a0
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
@@ -96,7 +96,8 @@ module Maze
96
96
  appium_options = {
97
97
  'automationName' => 'UiAutomator2',
98
98
  'autoGrantPermissions' => true,
99
- 'uiautomator2ServerInstallTimeout' => 60000
99
+ 'uiautomator2ServerInstallTimeout' => 60000,
100
+ 'uiautomator2ServerLaunchTimeout' => 60000
100
101
  }
101
102
  hash = {
102
103
  'platformName' => 'Android',
@@ -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.1'
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Kirkland
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-09 00:00:00.000000000 Z
11
+ date: 2023-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -448,11 +448,11 @@ files:
448
448
  - lib/maze/wait.rb
449
449
  - lib/utils/deep_merge.rb
450
450
  - lib/utils/selenium_money_patch.rb
451
- homepage:
451
+ homepage:
452
452
  licenses:
453
453
  - MIT
454
454
  metadata: {}
455
- post_install_message:
455
+ post_install_message:
456
456
  rdoc_options: []
457
457
  require_paths:
458
458
  - lib
@@ -468,7 +468,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
468
468
  version: '0'
469
469
  requirements: []
470
470
  rubygems_version: 3.1.6
471
- signing_key:
471
+ signing_key:
472
472
  specification_version: 4
473
473
  summary: Bugsnag API request validation harness
474
474
  test_files: []