Created
December 13, 2010 20:50
-
-
Save pmoran/739583 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ripped from cucumber-0.8.3/examples/watir/features/support/screenshots.rb | |
module Screenshots | |
if Cucumber::OS_X | |
def embed_screenshot(id) | |
`screencapture -t png reports/#{id}.png` | |
embed("#{id}.png", "image/png") | |
end | |
else | |
def embed_screenshot(id) | |
`import -window root reports/#{id}.png` | |
embed("#{id}.png", "image/png") | |
end | |
end | |
end | |
World(Screenshots) | |
After do |scenario| | |
if scenario.failed? && defined?(Capybara) && Capybara.current_session | |
embed_screenshot("screenshot-#{Time.new.to_i}") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment