bugsnag-maze-runner 8.12.0 → 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: 8a017d7683954e867a7ce32bf3d1b0a6391a27b86ed8a4dad3861d30e9090499
4
- data.tar.gz: 7c0c32bfc1e03fbe59c714ddd6766bf9e0e4bd413c2470b4268b6f5843d73f04
3
+ metadata.gz: 1c4179797bd1c2f213229a61382af46e4961ed8e1c927752082bef991edb7763
4
+ data.tar.gz: 3861468539c18e1e1ab53a9937eb6fc5fea67147a5a5016d660189ac95103dab
5
5
  SHA512:
6
- metadata.gz: 8b7a5be493f590641dbbd23bbe9effd0dac6a5207ee1f66401c1511c92765396df08f2a4016ce640af41c7705dd785b836211fb6f680543f8cbd8a5676678f95
7
- data.tar.gz: 841b495ddff85d3047afffa356730136f80873a13f7bf0fdb777983eb6fca93a3acb0c5bf5c37287c6382b16234299bef2e7c535628064ae337a847a651896f3
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
@@ -91,46 +91,44 @@ module Maze
91
91
  end
92
92
 
93
93
  def make_android_hash(device)
94
- # Doubling up on capabilities in both the `appium:options` and `appium` sub dictionaries.
94
+ # Tripling up on capabilities in the `appium:options`, `appium` sub dictionaries and base dictionary.
95
95
  # See PLAT-11087
96
+ appium_options = {
97
+ 'automationName' => 'UiAutomator2',
98
+ 'autoGrantPermissions' => true,
99
+ 'uiautomator2ServerInstallTimeout' => 60000
100
+ }
96
101
  hash = {
97
102
  'platformName' => 'Android',
98
103
  'deviceName' => 'Android Phone',
99
- 'appium:options' => {
100
- 'automationName' => 'UiAutomator2',
101
- 'autoGrantPermissions' => true,
102
- 'uiautomator2ServerInstallTimeout' => 60000
103
- },
104
- 'appium' => {
105
- 'automationName' => 'UiAutomator2',
106
- 'autoGrantPermissions' => true,
107
- 'uiautomator2ServerInstallTimeout' => 60000
108
- },
104
+ 'appium:options' => appium_options,
105
+ 'appium' => appium_options,
109
106
  'bitbar:options' => {
110
107
  'device' => device,
111
108
  }
112
109
  }
110
+ hash.merge!(appium_options)
113
111
  hash.freeze
114
112
  end
115
113
 
116
114
  def make_ios_hash(device)
117
- # Doubling up on capabilities in both the `appium:options` and `appium` sub dictionaries.
115
+ # Tripling up on capabilities in the `appium:options`, `appium` sub dictionaries and base dictionary.
118
116
  # See PLAT-11087
119
- {
117
+ appium_options = {
118
+ 'automationName' => 'XCUITest',
119
+ 'shouldTerminateApp' => 'true'
120
+ }
121
+ hash = {
120
122
  'platformName' => 'iOS',
121
123
  'deviceName' => 'iPhone device',
122
- 'appium:options' => {
123
- 'automationName' => 'XCUITest',
124
- 'shouldTerminateApp' => 'true'
125
- },
126
- 'appium' => {
127
- 'automationName' => 'XCUITest',
128
- 'shouldTerminateApp' => 'true'
129
- },
124
+ 'appium:options' => appium_options,
125
+ 'appium' => appium_options,
130
126
  'bitbar:options' => {
131
127
  'device' => device
132
128
  }
133
- }.freeze
129
+ }
130
+ hash.merge!(appium_options)
131
+ hash.freeze
134
132
  end
135
133
  end
136
134
  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.0'
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.0
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-07 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