bugsnag-maze-runner 10.0.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/features/support/internal_hooks.rb +7 -7
- data/lib/maze/api/appium/device_manager.rb +15 -0
- data/lib/maze/client/appium/base_client.rb +11 -12
- data/lib/maze/client/appium/bb_client.rb +11 -5
- data/lib/maze/driver/appium.rb +27 -0
- data/lib/maze/driver/browser.rb +1 -1
- data/lib/maze/helper.rb +1 -1
- data/lib/maze/hooks/appium_hooks.rb +2 -2
- data/lib/maze/option/processor.rb +6 -1
- data/lib/maze/option/validator.rb +6 -2
- data/lib/maze.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06ad8a12d51d5fabca139326d59aba0762467da96cf3ab641705ab049066674f
|
4
|
+
data.tar.gz: 50df1898e6ce8d13addf93868725e921205c66f42da749f6935b876ddfe3dfa9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05c40f7adaf5a4152ad9bc44af88bc41daa3230de4a0c66ecd39b33f4e1189abe3067aee6f0d15dbc55eb96ce1d1e6ddff67af40f685e472a4b5a75a74d3c182
|
7
|
+
data.tar.gz: b1c7a3fb3f1ffd9cd21da54e7b795add7fb4776dd3d2fe47f13adc52cf91efa5a2b506dabad118b305cdc7927e11a9f2b7a4549052ffc7c7c770c9052c212ae4
|
@@ -12,16 +12,16 @@ BeforeAll do
|
|
12
12
|
|
13
13
|
# Infer mode of operation from config, one of:
|
14
14
|
# - Appium (using either remote or local devices)
|
15
|
-
# -
|
15
|
+
# - Selenium (Selenium with local or remote browsers)
|
16
16
|
# - Command (the software under test is invoked with a system call)
|
17
|
-
|
18
|
-
|
19
|
-
is_browser = !Maze.config.browser.nil?
|
17
|
+
is_appium = ([:bs, :bb, :local].include?(Maze.config.farm) && !Maze.config.app.nil?) ||
|
18
|
+
(Maze.config.farm == :bb && !Maze.config.device.nil? && !Maze.config.browser.nil?)
|
19
|
+
is_browser = Maze.config.device.nil? && !Maze.config.browser.nil?
|
20
20
|
if is_appium
|
21
21
|
Maze.mode = :appium
|
22
22
|
Maze.internal_hooks = Maze::Hooks::AppiumHooks.new
|
23
23
|
elsif is_browser
|
24
|
-
Maze.mode = :
|
24
|
+
Maze.mode = :selenium
|
25
25
|
Maze.internal_hooks = Maze::Hooks::BrowserHooks.new
|
26
26
|
else
|
27
27
|
Maze.mode = :command
|
@@ -93,7 +93,7 @@ Before do |scenario|
|
|
93
93
|
|
94
94
|
# Skip scenario if the driver it needs has failed
|
95
95
|
$logger.debug "Before hook - Maze.driver&.failed?: #{Maze.driver&.failed?}"
|
96
|
-
if (Maze.mode == :appium || Maze.mode == :
|
96
|
+
if (Maze.mode == :appium || Maze.mode == :selenium) && Maze.driver.failed?
|
97
97
|
$logger.debug "Failing scenario because the #{Maze.mode.to_s} driver failed: #{Maze.driver.failure_reason}"
|
98
98
|
scenario.fail('Cannot run scenario - driver failed')
|
99
99
|
end
|
@@ -241,7 +241,7 @@ After do |scenario|
|
|
241
241
|
|
242
242
|
# Fail the scenario if the driver failed, if the scenario hasn't already failed
|
243
243
|
$logger.debug "After hook 2 - Maze.driver&.failed?: #{Maze.driver&.failed?}"
|
244
|
-
if (Maze.mode == :appium || Maze.mode == :
|
244
|
+
if (Maze.mode == :appium || Maze.mode == :selenium) && Maze.driver.failed? && !scenario.failed?
|
245
245
|
$logger.debug "Marking scenario as failed because driver failed: #{Maze.driver.failure_reason}"
|
246
246
|
Maze.scenario.mark_as_failed Maze.driver.failure_reason
|
247
247
|
end
|
@@ -93,6 +93,21 @@ module Maze
|
|
93
93
|
fail_driver(e)
|
94
94
|
raise e
|
95
95
|
end
|
96
|
+
|
97
|
+
# Execute script on the device.
|
98
|
+
# @returns [string] Output of the command
|
99
|
+
def execute_script(script)
|
100
|
+
if failed_driver?
|
101
|
+
$logger.error 'Cannot execute script on the device - Appium driver failed.'
|
102
|
+
return nil
|
103
|
+
end
|
104
|
+
@driver.execute_script('mobile: shell', command: script)
|
105
|
+
rescue Selenium::WebDriver::Error::ServerError => e
|
106
|
+
$logger.error "Failed execute script on the device: #{e.message}"
|
107
|
+
# Assume the remote appium session has stopped, so crash out of the session
|
108
|
+
fail_driver(e)
|
109
|
+
raise e
|
110
|
+
end
|
96
111
|
end
|
97
112
|
end
|
98
113
|
end
|
@@ -29,21 +29,20 @@ module Maze
|
|
29
29
|
start_driver(Maze.config)
|
30
30
|
|
31
31
|
# Set bundle/app id for later use
|
32
|
-
Maze.
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
unless Maze.config.app.nil?
|
33
|
+
Maze.driver.app_id = case Maze::Helper.get_current_platform
|
34
|
+
when 'android'
|
35
|
+
Maze.driver.session_capabilities['appPackage']
|
36
|
+
when 'ios'
|
37
|
+
unless app_id = Maze.driver.session_capabilities['CFBundleIdentifier']
|
38
|
+
app_id = Maze.driver.session_capabilities['bundleId']
|
39
|
+
end
|
40
|
+
app_id
|
38
41
|
end
|
39
|
-
app_id
|
40
|
-
end
|
41
|
-
|
42
|
-
if Maze.driver.app_id.nil?
|
43
|
-
$logger.error "Failed to determine app id."
|
44
|
-
$logger.debug "session_capabilities: #{Maze.driver.session_capabilities.inspect}"
|
45
42
|
end
|
46
43
|
|
44
|
+
$logger.error "Failed to determine app id." if Maze.driver.app_id.nil?
|
45
|
+
|
47
46
|
# Log the device information after it's started
|
48
47
|
write_device_info
|
49
48
|
|
@@ -5,7 +5,7 @@ module Maze
|
|
5
5
|
def prepare_session
|
6
6
|
config = Maze.config
|
7
7
|
config.app = Maze::Client::BitBarClientUtils.upload_app config.access_key,
|
8
|
-
config.app
|
8
|
+
config.app if config.app
|
9
9
|
if Maze::Client::BitBarClientUtils.use_local_tunnel?
|
10
10
|
Maze::Client::BitBarClientUtils.start_local_tunnel config.sb_local,
|
11
11
|
config.username,
|
@@ -51,10 +51,12 @@ module Maze
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def start_scenario
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
unless Maze.config.browser
|
55
|
+
# Write Maze's address to file and push to the device
|
56
|
+
maze_address = Maze.public_address || "local:#{Maze.config.port}"
|
57
|
+
Maze::Api::Appium::FileManager.new.write_app_file(JSON.generate({ maze_address: maze_address }),
|
58
|
+
FIXTURE_CONFIG)
|
59
|
+
end
|
58
60
|
|
59
61
|
super
|
60
62
|
end
|
@@ -81,6 +83,10 @@ module Maze
|
|
81
83
|
capabilities.deep_merge! BitBarClientUtils.dashboard_capabilities
|
82
84
|
capabilities.deep_merge! BitBarDevices.get_available_device(config.device)
|
83
85
|
capabilities['bitbar:options']['appiumVersion'] = config.appium_version unless config.appium_version.nil?
|
86
|
+
unless config.browser.nil?
|
87
|
+
capabilities['bitbar:options']['acceptInsecureCerts'] = true
|
88
|
+
capabilities['browserName'] = config.browser
|
89
|
+
end
|
84
90
|
capabilities.deep_merge! JSON.parse(config.capabilities_option)
|
85
91
|
|
86
92
|
capabilities
|
data/lib/maze/driver/appium.rb
CHANGED
@@ -80,6 +80,33 @@ module Maze
|
|
80
80
|
@failure_reason = reason
|
81
81
|
end
|
82
82
|
|
83
|
+
def javascript?
|
84
|
+
return false if Maze.config.browser.nil?
|
85
|
+
@driver.execute_script('return true')
|
86
|
+
rescue Selenium::WebDriver::Error::UnsupportedOperationError
|
87
|
+
false
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
# Provided for mobile browsers - check if the browser supports local storage
|
92
|
+
def local_storage?
|
93
|
+
# Assume we can use local storage if we aren't able to verify by running JavaScript
|
94
|
+
return true unless javascript?
|
95
|
+
|
96
|
+
result = @driver.execute_script <<-JAVASCRIPT
|
97
|
+
try {
|
98
|
+
window.localStorage.setItem('__localstorage_test__', 1234)
|
99
|
+
window.localStorage.removeItem('__localstorage_test__')
|
100
|
+
return true
|
101
|
+
} catch (err) {
|
102
|
+
return err
|
103
|
+
}
|
104
|
+
JAVASCRIPT
|
105
|
+
|
106
|
+
result == true
|
107
|
+
end
|
108
|
+
|
109
|
+
|
83
110
|
# Checks for an element, waiting until it is present or the method times out
|
84
111
|
#
|
85
112
|
# @param element_id [String] the element to search for
|
data/lib/maze/driver/browser.rb
CHANGED
@@ -58,7 +58,7 @@ module Maze
|
|
58
58
|
|
59
59
|
# check if Selenium supports running javascript in the current browser
|
60
60
|
def javascript?
|
61
|
-
@driver.execute_script('return true')
|
61
|
+
!Maze.config.browser.nil? && @driver.execute_script('return true')
|
62
62
|
rescue Selenium::WebDriver::Error::UnsupportedOperationError
|
63
63
|
false
|
64
64
|
end
|
data/lib/maze/helper.rb
CHANGED
@@ -89,7 +89,7 @@ module Maze
|
|
89
89
|
# Returns the current platform all lower-case.
|
90
90
|
# @return Typically 'ios', 'android', 'mac' or 'browser'
|
91
91
|
def get_current_platform
|
92
|
-
if Maze.mode == :browser
|
92
|
+
if Maze.mode == :selenium || (Maze.mode == :appium && Maze.config.browser)
|
93
93
|
os = 'browser'
|
94
94
|
else
|
95
95
|
os = case Maze.config.farm
|
@@ -29,7 +29,7 @@ module Maze
|
|
29
29
|
if Maze.config.os == 'macos'
|
30
30
|
# Close the app - without the sleep launching the app for the next scenario intermittently fails
|
31
31
|
system("killall -KILL #{Maze.config.app} && sleep 1")
|
32
|
-
elsif [:bb, :bs, :local].include? Maze.config.
|
32
|
+
elsif [:bb, :bs, :local].include?(Maze.config.farm) && Maze.config.browser.nil?
|
33
33
|
close_fallback = Maze.config.appium_version && Maze.config.appium_version.to_f < 2.0
|
34
34
|
begin
|
35
35
|
manager.terminate(!close_fallback)
|
@@ -45,7 +45,7 @@ module Maze
|
|
45
45
|
# Reset the server before relaunching the app to ensure that test fixtures cannot fetch
|
46
46
|
# commands from the previous scenario (in idempotent mode).
|
47
47
|
Maze::Server.reset!
|
48
|
-
manager.activate
|
48
|
+
manager.activate if Maze.config.browser.nil?
|
49
49
|
end
|
50
50
|
rescue => error
|
51
51
|
# Notify and re-raise for Cucumber to handle
|
@@ -77,7 +77,12 @@ module Maze
|
|
77
77
|
device_option = options[Maze::Option::DEVICE]
|
78
78
|
browser_option = options[Maze::Option::BROWSER]
|
79
79
|
browser_version = options[Maze::Option::BROWSER_VERSION]
|
80
|
-
if !device_option.empty?
|
80
|
+
if !device_option.empty? && !browser_option.empty?
|
81
|
+
config.device = device_option.first
|
82
|
+
config.device_list = device_option.drop(1)
|
83
|
+
config.browser = browser_option.first
|
84
|
+
config.browser_list = browser_option.drop(1)
|
85
|
+
elsif !device_option.empty?
|
81
86
|
config.device = device_option.first
|
82
87
|
config.device_list = device_option.drop(1)
|
83
88
|
elsif !browser_option.empty?
|
@@ -113,7 +113,8 @@ module Maze
|
|
113
113
|
# Device
|
114
114
|
if browser.empty? && device.empty?
|
115
115
|
errors << "Either --#{Option::BROWSER} or --#{Option::DEVICE} must be specified"
|
116
|
-
elsif !browser.empty?
|
116
|
+
elsif !browser.empty? && device.empty?
|
117
|
+
# Desktop browsers (Selenium)
|
117
118
|
browsers = YAML.safe_load(File.read("#{__dir__}/../client/selenium/bb_browsers.yml"))
|
118
119
|
|
119
120
|
rejected_browsers = browser.reject { |br| browsers.include? br }
|
@@ -129,7 +130,8 @@ module Maze
|
|
129
130
|
errors << "Browser types '#{rejected_browsers.join(', ')}' unknown on BitBar. Must be one of: #{browser_list}."
|
130
131
|
end
|
131
132
|
|
132
|
-
elsif !device.empty?
|
133
|
+
elsif browser.empty? && !device.empty?
|
134
|
+
# Mobile app testing
|
133
135
|
app = Maze::Helper.read_at_arg_file options[Option::APP]
|
134
136
|
if app.nil?
|
135
137
|
errors << "--#{Option::APP} must be provided when running on a device"
|
@@ -140,6 +142,8 @@ module Maze
|
|
140
142
|
errors << "app file '#{app}' not found" unless File.exist?(app)
|
141
143
|
end
|
142
144
|
end
|
145
|
+
else
|
146
|
+
# TODO - Mobile browser testing
|
143
147
|
end
|
144
148
|
end
|
145
149
|
|
data/lib/maze.rb
CHANGED
@@ -8,7 +8,7 @@ require_relative 'maze/timers'
|
|
8
8
|
# providing an alternative to the proliferation of global variables or singletons.
|
9
9
|
module Maze
|
10
10
|
|
11
|
-
VERSION = '10.
|
11
|
+
VERSION = '10.2.0'
|
12
12
|
|
13
13
|
class << self
|
14
14
|
attr_accessor :check, :driver, :internal_hooks, :mode, :start_time, :dynamic_retry, :public_address,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bugsnag-maze-runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 10.
|
4
|
+
version: 10.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Kirkland
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-
|
12
|
+
date: 2025-09-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cucumber
|
@@ -73,14 +73,14 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: 1.
|
76
|
+
version: 1.9.0
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: 1.
|
83
|
+
version: 1.9.0
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: appium_lib
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|