Skip to content

Commit a581424

Browse files
committedJun 4, 2014
Clean up cucumber doc
1 parent 6ec7bcc commit a581424

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed
 

‎docs/docs.md

+9-23
Original file line numberDiff line numberDiff line change
@@ -226,37 +226,23 @@ Reset after each test and when done report the result to Sauce after quiting the
226226
```ruby
227227
require 'rest_client' # https://github.com/archiloque/rest-client
228228
require 'json' # for .to_json
229-
230-
$passed = true
229+
require 'sauce_whisk'
231230

232231
After do |scenario|
233232
# Reset scenario unless the feature was tagged @keep
234-
$driver.execute_script 'mobile: reset' unless scenario.feature.source_tag_names.include? '@keep'
233+
$driver.reset unless scenario.feature.source_tag_names.include? '@keep'
235234

236-
if $passed
237-
$passed = false if scenario.failed?
238-
end
235+
$passed = ! scenario.failed?
239236
end
240237

241238
at_exit do
242-
# selenium-webdriver (2.32.1) or better can use
243-
# $driver.driver.session_id
244-
ID = $driver.driver.send(:bridge).session_id
239+
# end the test session, ignoring any exceptions.
240+
ignore { $driver.driver_quit }
245241

246-
# end the test session. move on after 10 seconds.
247-
ignore { wait(10) { $driver.x } }
248-
249-
if !SAUCE_USERNAME.nil? && !SAUCE_ACCESS_KEY.nil?
250-
URL = "https://#{SAUCE_USERNAME}:#{SAUCE_ACCESS_KEY}@saucelabs.com/rest/v1/#{SAUCE_USERNAME}/jobs/#{ID}"
251-
252-
# Keep trying until passed is set correctly. Give up after 30 seconds.
253-
wait_true do
254-
response = RestClient.put URL, { 'passed' => $passed }.to_json, :content_type => :json, :accept => :json
255-
response = JSON.parse(response)
256-
257-
# Check that the server responded with the right value.
258-
response['passed'] == $passed
259-
end
242+
user = ENV['SAUCE_USERNAME']
243+
key = ENV['SAUCE_ACCESS_KEY']
244+
if user && !user.empty? && key && !key.empty?
245+
SauceWhisk::Jobs.change_status $driver.driver.session_id, $passed
260246
end
261247
end
262248
```

0 commit comments

Comments
 (0)
Please sign in to comment.