Skip to content

Instantly share code, notes, and snippets.

@noahd1
Created January 5, 2011 22:46
Show Gist options
  • Save noahd1/767171 to your computer and use it in GitHub Desktop.
Save noahd1/767171 to your computer and use it in GitHub Desktop.
After do |scenario|
if scenario.failed? && $browser
file_base = "#{scenario.file_colon_line.parameterize.to_s.underscore}_#{Time.now.to_i}"
file_path = Rails.root.join("tmp", "build_assets", file_base)
puts "Writing log of failure to #{file_base}.log..."
`tail -n1000 #{Rails.root.join('log', 'selenium.log')} > #{file_path}.log`
puts "Writing screengrab of failure to #{file_base}.png..."
$browser.capture_screenshot("#{file_path}.png")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment