bugsnag-maze-runner 9.21.0 → 9.22.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: 0b00232685620344397218ed5ccf143f583dea9cb7a94c454dcbc7f8d5ea00c3
4
- data.tar.gz: 44d839ae61d043e63c01b4462359d6b8ccef54a73eac1cc679c1813099aeafab
3
+ metadata.gz: 5b4f925503cc54630e686c2e040e7400f317f0cf53ec5e0355452493ae7f3fe0
4
+ data.tar.gz: 1ba0c44262e72fe909d9ebdea4f8386cb7463a50ed9e868ecdc4d1bfcb83fddc
5
5
  SHA512:
6
- metadata.gz: 0a8ac5cdcb8da3b8cfc80b54f8318989eef4df1f8b92dcff63884544bb25f6dde895aeeac0aa4c9091f385d029e7fd6a00ff6b04772bbdb71699686c6620eeda
7
- data.tar.gz: 8e88e848cf6599fb944ce054a0fda6e65bc873fc3b6bf7b91c62f5a55f06332d00096c9ef060f69dccabe670475371d3d59e8d88036a870dd41fe157ee2621b0
6
+ metadata.gz: 29948d516684ee1448456110c5427b4db74bba4849b7e2aad4d3601bd5f5b332036d9fa0b64b84eda2d71c209ac4cad4aca04ee346856c58fcbde45605e217cb
7
+ data.tar.gz: 30869b1f195fd936f8f795721844a28ede9fa620581284408c391b848ca96e399628a08eb6dea3a5a2a062f99cddeb7062d9decef1b701170dd02aed8b76ee73
@@ -103,7 +103,12 @@ end
103
103
  Before do |scenario|
104
104
  Maze.scenario = Maze::Api::Cucumber::Scenario.new(scenario)
105
105
 
106
- # Default to no dynamic try
106
+ # Skip scenario if the driver it needs has failed
107
+ if (Maze.mode == :appium || Maze.mode == :browser) && Maze.driver.failed?
108
+ skip_this_scenario
109
+ end
110
+
111
+ # Default to no dynamic retry
107
112
  Maze.dynamic_retry = false
108
113
 
109
114
  if ENV['BUILDKITE']
@@ -134,7 +134,7 @@ module Maze
134
134
  end
135
135
 
136
136
  def stop_session
137
- Maze.driver&.driver_quit
137
+ Maze.driver.driver_quit unless Maze.driver.failed?
138
138
  Maze::AppiumServer.stop if Maze::AppiumServer.running
139
139
  end
140
140
  end
@@ -67,7 +67,7 @@ module Maze
67
67
 
68
68
  def log_run_intro
69
69
  # Log a link to the BrowserStack session search dashboard
70
- url = "https://app-automate.browserstack.com/dashboard/v2/search?query=#{Maze.run_uuid}&type=builds"
70
+ url = "https://app-automate.browserstack.com/projects/#{project_name_capabilities[:project]}/builds/#{Maze.run_uuid}/1?tab=tests"
71
71
  $logger.info Maze::Loggers::LogUtil.linkify(url, 'BrowserStack session(s)')
72
72
  end
73
73
 
@@ -11,7 +11,7 @@ module Maze
11
11
  end
12
12
 
13
13
  def stop_session
14
- Maze.driver&.driver_quit
14
+ Maze.driver.driver_quit unless Maze.driver.failed?
15
15
  end
16
16
  end
17
17
  end
@@ -86,7 +86,7 @@ module Maze
86
86
 
87
87
  def log_session_info
88
88
  # Log a link to the BrowserStack session search dashboard
89
- url = "https://automate.browserstack.com/dashboard/v2/search?query=#{Maze.run_uuid}&type=builds"
89
+ url = "https://automate.browserstack.com/projects/#{project_name_capabilities[:project]}/builds/#{Maze.run_uuid}/1?tab=tests"
90
90
  $logger.info Maze::Loggers::LogUtil.linkify url, 'BrowserStack session(s)'
91
91
  end
92
92
  end
@@ -20,7 +20,7 @@ module Maze
20
20
  attr_reader :device_type
21
21
 
22
22
  # @!attribute [r] capabilities
23
- # @return [Hash] The capabilities used to launch the BrowserStack instance
23
+ # @return [Hash] The capabilities used to launch the Appium session
24
24
  attr_reader :capabilities
25
25
 
26
26
  # Creates the Appium driver
@@ -32,6 +32,7 @@ module Maze
32
32
  # Sets up identifiers for ease of connecting jobs
33
33
  capabilities ||= {}
34
34
 
35
+ @failed = false
35
36
  @element_locator = locator
36
37
  @capabilities = capabilities
37
38
 
@@ -64,6 +65,17 @@ module Maze
64
65
  end
65
66
  end
66
67
 
68
+ # Whether the driver has known to have failed (it may still have failed and us not know yet)
69
+ def failed?
70
+ @failed
71
+ end
72
+
73
+ # Marks the driver as failed
74
+ def fail_driver
75
+ $logger.error 'Appium driver failed, remaining scenarios will be skipped'
76
+ @failed = true
77
+ end
78
+
67
79
  # Checks for an element, waiting until it is present or the method times out
68
80
  #
69
81
  # @param element_id [String] the element to search for
@@ -83,7 +95,7 @@ module Maze
83
95
  end
84
96
  rescue Selenium::WebDriver::Error::ServerError => e
85
97
  # Assume the remote appium session has stopped, so crash out of the session
86
- Maze.driver = nil
98
+ fail_driver
87
99
  raise e
88
100
  else
89
101
  true
@@ -94,7 +106,7 @@ module Maze
94
106
  super
95
107
  rescue Selenium::WebDriver::Error::ServerError => e
96
108
  # Assume the remote appium session has stopped, so crash out of the session
97
- Maze.driver = nil
109
+ fail_driver
98
110
  raise e
99
111
  end
100
112
 
@@ -103,7 +115,7 @@ module Maze
103
115
  super
104
116
  rescue Selenium::WebDriver::Error::ServerError => e
105
117
  # Assume the remote appium session has stopped, so crash out of the session
106
- Maze.driver = nil
118
+ fail_driver
107
119
  raise e
108
120
  end
109
121
 
@@ -114,7 +126,7 @@ module Maze
114
126
  end
115
127
  rescue Selenium::WebDriver::Error::ServerError => e
116
128
  # Assume the remote appium session has stopped, so crash out of the session
117
- Maze.driver = nil
129
+ fail_driver
118
130
  raise e
119
131
  end
120
132
 
@@ -128,7 +140,7 @@ module Maze
128
140
  end
129
141
  rescue Selenium::WebDriver::Error::ServerError => e
130
142
  # Assume the remote appium session has stopped, so crash out of the session
131
- Maze.driver = nil
143
+ fail_driver
132
144
  raise e
133
145
  end
134
146
 
@@ -146,7 +158,7 @@ module Maze
146
158
  false
147
159
  rescue Selenium::WebDriver::Error::ServerError => e
148
160
  # Assume the remote appium session has stopped, so crash out of the session
149
- Maze.driver = nil
161
+ fail_driver
150
162
  raise e
151
163
  end
152
164
 
@@ -160,7 +172,7 @@ module Maze
160
172
  end
161
173
  rescue Selenium::WebDriver::Error::ServerError => e
162
174
  # Assume the remote appium session has stopped, so crash out of the session
163
- Maze.driver = nil
175
+ fail_driver
164
176
  raise e
165
177
  end
166
178
 
@@ -185,7 +197,7 @@ module Maze
185
197
  end
186
198
  rescue Selenium::WebDriver::Error::ServerError => e
187
199
  # Assume the remote appium session has stopped, so crash out of the session
188
- Maze.driver = nil
200
+ fail_driver
189
201
  raise e
190
202
  end
191
203
 
@@ -222,7 +234,7 @@ module Maze
222
234
  end
223
235
  rescue Selenium::WebDriver::Error::ServerError => e
224
236
  # Assume the remote appium session has stopped, so crash out of the session
225
- Maze.driver = nil
237
+ fail_driver
226
238
  raise e
227
239
  end
228
240
 
@@ -13,15 +13,41 @@ module Maze
13
13
 
14
14
  def initialize(driver_for, selenium_url=nil, capabilities=nil)
15
15
  capabilities ||= {}
16
+ @failed = false
16
17
  @capabilities = capabilities
17
18
  @driver_for = driver_for
18
19
  @selenium_url = selenium_url
19
20
  end
20
21
 
22
+ # Whether the driver has known to have failed (it may still have failed and us not know yet)
23
+ def failed?
24
+ @failed
25
+ end
26
+
27
+ # Marks the driver as failed
28
+ def fail_driver
29
+ $logger.error 'Selenium driver failed, remaining scenarios will be skipped'
30
+ @failed = true
31
+ end
32
+
21
33
  def find_element(*args)
22
34
  @driver.find_element(*args)
23
35
  end
24
36
 
37
+ def wait_for_element(id)
38
+ @driver.find_element(id: id)
39
+ end
40
+
41
+ def click_element(id)
42
+ element = @driver.find_element(id: id)
43
+
44
+ if $browser.mobile?
45
+ element.click
46
+ else
47
+ @driver.action.move_to(element).click.perform
48
+ end
49
+ end
50
+
25
51
  def navigate
26
52
  @driver.navigate
27
53
  end
@@ -128,6 +154,7 @@ module Maze
128
154
  end
129
155
  $logger.info "Selenium driver started in #{(Time.now - time).to_i}s"
130
156
  @driver = driver
157
+ @failed = false
131
158
  rescue => error
132
159
  Bugsnag.notify error
133
160
  $logger.warn "Selenium driver failed to start in #{(Time.now - time).to_i}s"
@@ -42,11 +42,11 @@ module Maze
42
42
  # Reset the server to ensure that test fixtures cannot fetch
43
43
  # commands from the previous scenario (in idempotent mode).
44
44
  begin
45
- Maze.driver.terminate_app Maze.driver&.app_id
45
+ Maze.driver.terminate_app Maze.driver.app_id
46
46
  rescue Selenium::WebDriver::Error::UnknownError, Selenium::WebDriver::Error::InvalidSessionIdError
47
47
  if Maze.config.appium_version && Maze.config.appium_version.to_f < 2.0
48
48
  $logger.warn 'terminate_app failed, using the slower but more forceful close_app instead'
49
- Maze.driver&.close_app
49
+ Maze.driver.close_app
50
50
  else
51
51
  $logger.warn 'terminate_app failed, future errors may occur if the application did not close remotely'
52
52
  end
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 = '9.21.0'
11
+ VERSION = '9.22.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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag-maze-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.21.0
4
+ version: 9.22.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: 2024-11-28 00:00:00.000000000 Z
11
+ date: 2025-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber