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 +4 -4
- data/bin/maze-runner +1 -0
- data/lib/maze/api/exit_code.rb +16 -0
- data/lib/maze/client/appium/base_client.rb +17 -8
- data/lib/maze/client/appium/bb_client.rb +4 -0
- data/lib/maze/client/appium/bb_devices.rb +5 -5
- data/lib/maze/client/appium/bs_client.rb +4 -0
- data/lib/maze/errors.rb +7 -7
- data/lib/maze/plugins/bugsnag_reporting_plugin.rb +9 -2
- data/lib/maze.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96a68ab4f0db7889bf4889f9d3af3acaff592f9e24477df3e80c6d72ca32da0f
|
4
|
+
data.tar.gz: 949f8c4cc9d658f7535b9ec7adb06a087ff5d649f68c08d9e74b223c207896ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
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
|
@@ -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
|
-
|
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
|
127
|
+
appium_version.nil? || (appium_version.to_i >= 2) ? 'appium:' : ''
|
128
128
|
end
|
129
129
|
end
|
130
130
|
end
|
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:
|
27
|
+
error_code: Maze::Api::ExitCode::AUTOMATION_GENERIC_ERROR
|
28
28
|
},
|
29
29
|
::Selenium::WebDriver::Error::WebDriverError => {
|
30
30
|
retry: true,
|
31
|
-
error_code:
|
31
|
+
error_code: Maze::Api::ExitCode::AUTOMATION_GENERIC_ERROR
|
32
32
|
},
|
33
33
|
Maze::Error::AppiumElementNotFoundError => {
|
34
34
|
retry: true,
|
35
|
-
error_code:
|
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:
|
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:
|
43
|
+
error_code: Maze::Api::ExitCode::AUTOMATION_TIMEOUT
|
44
44
|
},
|
45
45
|
::Selenium::WebDriver::Error::StaleElementReferenceError => {
|
46
46
|
retry: true,
|
47
|
-
error_code:
|
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
|
-
|
30
|
-
|
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.
|
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
|
+
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-
|
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
|