Skip to content

Commit

Permalink
spec: catch errors in the screenshoter
Browse files Browse the repository at this point in the history
meh committed Jan 26, 2014
1 parent c2cf3b0 commit a6c6c54
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions spec/runner.rb
Original file line number Diff line number Diff line change
@@ -60,14 +60,18 @@
rescue Selenium::WebDriver::Error::TimeOutError
print "\rTimeout, have fun."
ensure
browser.save_screenshot('screenshot.png')
response = RestClient.post('https://api.imgur.com/3/upload',
{ image: File.open('screenshot.png') },
{ 'Authorization' => 'Client-ID 1979876fe2a097e' })

print " ("
print JSON.parse(response.to_str)['data']['link']
print ")"
begin
browser.save_screenshot('screenshot.png')
response = RestClient.post('https://api.imgur.com/3/upload',
{ image: File.open('screenshot.png') },
{ 'Authorization' => 'Client-ID 1979876fe2a097e' })

print " ("
print JSON.parse(response.to_str)['data']['link']
puts ")"
rescue Exception
puts
end

browser.quit
end

0 comments on commit a6c6c54

Please sign in to comment.