Created
September 21, 2010 09:53
-
-
Save suhrawardi/589483 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
# This is an example of how you can set up screenshots for your | |
# browser testing. Just run cucumber with --format html --out report.html | |
# | |
module Screenshots | |
def embed_screenshot(id) | |
%x(scrot #{$ROOT_PATH}/images/#{id}.png) | |
end | |
end | |
World(Screenshots) | |
# Only take screenshot for scenarios or features tagged @screenshot | |
# | |
# After(@screenshots) do | |
# embed_screenshot("screenshot-#{Time.new.to_i}") | |
# end | |
# | |
# Only take screenshot on failures | |
After do |scenario| | |
embed_screenshot("screenshot-#{Time.new.to_i}") if scenario.failed? | |
end | |
# Other variants: | |
# | |
# After do | |
# $stderr.puts "Attempting to make a screenshot" if $DEBUG | |
# embed_screenshot("screenshot-#{Time.new.to_i}") | |
# $stderr.puts "Ok !" if $DEBUG | |
# end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment