bugsnag-maze-runner 10.0.0 → 10.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49987743ddaa8d0fbddf850756f7ec663cc635a8187343a144dd024d667cda71
4
- data.tar.gz: 75a9f5f0bb5c5cee0356107a73ef62558bef6dd9eced8d6038e62b7cbf282275
3
+ metadata.gz: d59bb98b603f22702c5da83fc40f70e12dcba5553b1177075dea770c97a154a3
4
+ data.tar.gz: d0e404e19355099925754b022ac30f00d56050beb8d1740e8c1ced2b32705d4f
5
5
  SHA512:
6
- metadata.gz: 52b1fbeb47067155bf4608c7189361f745961b58e1b8186d337b99d82eaa65fbf74a8aaafa1dc05fd273bbcaf3185d973caf75fae8a5cf554e4bc0a49d2ca0cf
7
- data.tar.gz: b360e8a7182e2b9c3d15c201dde259d31169bd8b80c620b8adfb081e19b283b323597ee885a1c8a1e522f796bfc51b01b7fc4dbfb9272adb1a17f8dcb13be2eb
6
+ metadata.gz: 11e455f30a38488c0169b7f21536c295ab007ed8dfae1afcce8fe34fb3461ee2e7d93b6db35fb746989ca28bd7ece7fa97ead621b0eb421764a4e03e6c9e2772
7
+ data.tar.gz: 970798d5594c687c269f9d3043fc70e86808d63098fdc9017a226bb71c08422dc6cf55634c025f877c52cd750c39ad80d5b625d8f5184e304f94883d034b75cf
@@ -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
- # - Browser (Selenium with local or remote browsers)
15
+ # - Selenium (Selenium with local or remote browsers)
16
16
  # - Command (the software under test is invoked with a system call)
17
- # TODO Consider making this a specific command line option defaulting to Appium
18
- is_appium = [:bs, :bb, :local].include?(Maze.config.farm) && !Maze.config.app.nil?
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 = :browser
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 == :browser) && Maze.driver.failed?
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 == :browser) && Maze.driver.failed? && !scenario.failed?
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
@@ -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.driver.app_id = case Maze::Helper.get_current_platform
33
- when 'android'
34
- Maze.driver.session_capabilities['appPackage']
35
- when 'ios'
36
- unless app_id = Maze.driver.session_capabilities['CFBundleIdentifier']
37
- app_id = Maze.driver.session_capabilities['bundleId']
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
- # Write Maze's address to file and push to the device
55
- maze_address = Maze.public_address || "local:#{Maze.config.port}"
56
- Maze::Api::Appium::FileManager.new.write_app_file(JSON.generate({ maze_address: maze_address }),
57
- FIXTURE_CONFIG)
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
@@ -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
@@ -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.farm
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.0.0'
11
+ VERSION = '10.1.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.0.0
4
+ version: 10.1.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-08-26 00:00:00.000000000 Z
12
+ date: 2025-09-02 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.7.0
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.7.0
83
+ version: 1.9.0
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: appium_lib
86
86
  requirement: !ruby/object:Gem::Requirement