bugsnag-maze-runner 8.4.1 → 8.6.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: 7f4746e6a6b4789c6a7fe8b6f501f12f87a931fa8d4ecddc000f3a7aae7ea9ee
4
- data.tar.gz: c6da9d5ab45afc9bd4edd711d9122f4e022f4362871c3c369d25d145c496698e
3
+ metadata.gz: 96a68ab4f0db7889bf4889f9d3af3acaff592f9e24477df3e80c6d72ca32da0f
4
+ data.tar.gz: 949f8c4cc9d658f7535b9ec7adb06a087ff5d649f68c08d9e74b223c207896ae
5
5
  SHA512:
6
- metadata.gz: 9b2bdcaf44ec0c4a366585373dceaf0db310626feae71a7e51fd9d36c8f1e1c04049e842ee9de508267ad047e701bc83819437d54c1c41b3b829d9fd19ce097f
7
- data.tar.gz: c76978dd97bfd6c28e845937c3a6079be1e0eb3717a491020971ecd458d5b59ab0b9e5a504ca019178cb6363768b1d569b196a6a8cb6657650f6041519e5a36a
6
+ metadata.gz: f49cd17392e55b29924cd0a9ab9b11b41a0e1799d6d5659399674529123b1928b5b2608191a9db4cf355377316fc22ba9f7e000eda8a21446a774e127de5ace8
7
+ data.tar.gz: 8c50541e8de8aed4ec810459bb0aaa67b4a4c4c80bdfdb106a1653868039036c9314cc7b07986a7551a2c8448b5761fc0d16c53d70817d5c58615085bb4ed31b
data/bin/maze-runner CHANGED
@@ -10,6 +10,7 @@ require_relative '../lib/maze'
10
10
  require_relative '../lib/maze/appium_server'
11
11
  require_relative '../lib/maze/api/appium/file_manager'
12
12
  require_relative '../lib/maze/api/cucumber/scenario'
13
+ require_relative '../lib/maze/api/exit_code'
13
14
  require_relative '../lib/maze/bugsnag_config'
14
15
  require_relative '../lib/maze/client/bb_api_client'
15
16
  require_relative '../lib/maze/client/bb_client_utils'
@@ -0,0 +1,16 @@
1
+ module Maze
2
+ module Api
3
+ class ExitCode
4
+ # Cucumber itself can use codes 0 to 2
5
+
6
+ AUTOMATION_GENERIC_ERROR = 10
7
+ AUTOMATION_ELEMENT_NOT_FOUND = 11
8
+ AUTOMATION_TIMEOUT = 12
9
+ AUTOMATION_STALE_ELEMENT = 13
10
+
11
+ APP_UPLOAD_FAILURE = 100
12
+ TUNNEL_FAILURE = 101
13
+ SESSION_CREATION_FAILURE = 102
14
+ end
15
+ end
16
+ end
@@ -41,11 +41,18 @@ module Maze
41
41
  raise 'Method not implemented by this class'
42
42
  end
43
43
 
44
+ def retry_start_driver?
45
+ raise 'Method not implemented by this class'
46
+ end
47
+
44
48
  def start_driver(config)
45
- retry_failure = config.device_list.nil? || config.device_list.empty?
49
+ retry_failure = retry_start_driver?
46
50
  driver = nil
47
51
  until Maze.driver
48
52
  begin
53
+
54
+
55
+ # Proc to start the driver
49
56
  start_driver_closure = Proc.new do
50
57
  begin
51
58
  config.capabilities = device_capabilities
@@ -64,21 +71,23 @@ module Maze
64
71
  result
65
72
  rescue => start_error
66
73
  $logger.error "Session creation failed: #{start_error}"
67
- raise start_error unless retry_failure
68
74
  false
69
75
  end
70
76
  end
71
77
 
78
+
79
+ # Invoke the proc, with or without retries
72
80
  if retry_failure
73
81
  wait = Maze::Wait.new(interval: 10, timeout: 60)
74
82
  success = wait.until(&start_driver_closure)
75
-
76
- unless success
77
- $logger.error 'Appium driver failed to start after 6 attempts in 60 seconds'
78
- raise RuntimeError.new('Appium driver failed to start in 60 seconds')
79
- end
80
83
  else
81
- start_driver_closure.call
84
+ success = start_driver_closure.call
85
+ end
86
+
87
+ unless success
88
+ # TODO Bugsnag notify
89
+ $logger.error 'Failed to create Appium driver, exiting'
90
+ exit(::Maze::Api::ExitCode::SESSION_CREATION_FAILURE)
82
91
  end
83
92
 
84
93
  # Infer OS version if necessary when running locally
@@ -13,6 +13,10 @@ module Maze
13
13
  end
14
14
  end
15
15
 
16
+ def retry_start_driver?
17
+ false
18
+ end
19
+
16
20
  def start_scenario
17
21
  unless Maze.config.legacy_driver?
18
22
  # Write Maze's address to file and push to the device
@@ -50,7 +50,7 @@ module Maze
50
50
  else
51
51
  'UiAutomator2'
52
52
  end
53
- make_android_hash(device_name, automation_name)
53
+ make_android_hash(device_name, automation_name, prefix)
54
54
  when 'ios'
55
55
  make_ios_hash(device_name, prefix)
56
56
  else
@@ -98,20 +98,20 @@ module Maze
98
98
  end
99
99
  end
100
100
 
101
- def make_android_hash(device, automation_name)
101
+ def make_android_hash(device, automation_name, prefix='appium:')
102
102
  hash = {
103
103
  'automationName' => automation_name,
104
104
  'platformName' => 'Android',
105
105
  'deviceName' => 'Android Phone',
106
106
  'bitbar:options' => {
107
- 'autoGrantPermissions' => true,
107
+ "#{prefix}autoGrantPermissions" => true,
108
108
  'device' => device,
109
109
  }
110
110
  }
111
111
  hash.freeze
112
112
  end
113
113
 
114
- def make_ios_hash(device, prefix='')
114
+ def make_ios_hash(device, prefix='appium:')
115
115
  {
116
116
  'automationName' => 'XCUITest',
117
117
  'deviceName' => 'iPhone device',
@@ -124,7 +124,7 @@ module Maze
124
124
  end
125
125
 
126
126
  def caps_prefix(appium_version)
127
- appium_version.nil? || (appium_version.to_i < 2) ? '' : 'appium:'
127
+ appium_version.nil? || (appium_version.to_i >= 2) ? 'appium:' : ''
128
128
  end
129
129
  end
130
130
  end
@@ -15,6 +15,10 @@ module Maze
15
15
  end
16
16
  end
17
17
 
18
+ def retry_start_driver?
19
+ Maze.config.device_list.nil? || Maze.config.device_list.empty?
20
+ end
21
+
18
22
  def start_scenario
19
23
  unless Maze.config.legacy_driver?
20
24
  # Write Maze's address to file and push to the device
data/lib/maze/errors.rb CHANGED
@@ -24,29 +24,29 @@ module Maze
24
24
  ERROR_CODES = {
25
25
  ::Selenium::WebDriver::Error::UnknownError => {
26
26
  retry: true,
27
- error_code: 10
27
+ error_code: Maze::Api::ExitCode::AUTOMATION_GENERIC_ERROR
28
28
  },
29
29
  ::Selenium::WebDriver::Error::WebDriverError => {
30
30
  retry: true,
31
- error_code: 10
31
+ error_code: Maze::Api::ExitCode::AUTOMATION_GENERIC_ERROR
32
32
  },
33
33
  Maze::Error::AppiumElementNotFoundError => {
34
34
  retry: true,
35
- error_code: 11
35
+ error_code: Maze::Api::ExitCode::AUTOMATION_ELEMENT_NOT_FOUND
36
36
  },
37
37
  ::Selenium::WebDriver::Error::NoSuchElementError => {
38
38
  retry: true,
39
- error_code: 12
39
+ error_code: Maze::Api::ExitCode::AUTOMATION_ELEMENT_NOT_FOUND
40
40
  },
41
41
  ::Selenium::WebDriver::Error::TimeoutError => {
42
42
  retry: true,
43
- error_code: 13
43
+ error_code: Maze::Api::ExitCode::AUTOMATION_TIMEOUT
44
44
  },
45
45
  ::Selenium::WebDriver::Error::StaleElementReferenceError => {
46
46
  retry: true,
47
- error_code: 14
47
+ error_code: Maze::Api::ExitCode::AUTOMATION_STALE_ELEMENT
48
48
  },
49
49
  }.freeze
50
50
 
51
51
  end
52
- end
52
+ end
@@ -26,8 +26,15 @@ module Maze
26
26
 
27
27
  Bugsnag.notify(event.result.exception) do |bsg_event|
28
28
  unless @last_test_step.nil?
29
- bsg_event.context = @last_test_step.location
30
- bsg_event.grouping_hash = test_case.name + @last_test_step.location
29
+
30
+ repo = ENV['BUILDKITE_PIPELINE_SLUG']
31
+ bsg_event.context = if repo.nil?
32
+ @last_test_step.location
33
+ else
34
+ "#{repo}/#{@last_test_step.location}"
35
+ end
36
+ bsg_event.grouping_hash = @last_test_step.location
37
+
31
38
  bsg_event.add_metadata(:'scenario', {
32
39
  'failing step': @last_test_step.to_s,
33
40
  'failing step location': @last_test_step.location
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.4.1'
10
+ VERSION = '8.6.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.4.1
4
+ version: 8.6.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-08-29 00:00:00.000000000 Z
11
+ date: 2023-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -369,6 +369,7 @@ files:
369
369
  - lib/maze.rb
370
370
  - lib/maze/api/appium/file_manager.rb
371
371
  - lib/maze/api/cucumber/scenario.rb
372
+ - lib/maze/api/exit_code.rb
372
373
  - lib/maze/appium_server.rb
373
374
  - lib/maze/assertions/request_set_assertions.rb
374
375
  - lib/maze/aws/sam.rb