Sha256: 15571d7676d4011f91026b27dab42d6b2aca2a1e5177bed45c40cfb6fc74254c
Contents?: true
Size: 1010 Bytes
Versions: 13
Compression:
Stored size: 1010 Bytes
Contents
# This is an example of how you can set up screenshots for your # browser testing. Just run cucumber with --format html --out report.html # # This examples currently only works on OS X, but adding support for other # platform should be easy - as long as there is a command line tool to take # a picture of the desktop. module Screenshots def add_screenshot id = "screenshot-#{Time.new.to_i}" take_screenshot(id) embed("#{id}.png", "image/png") end if Cucumber::OS_X def take_screenshot(id) `screencapture -t png #{id}.png` end else # Other platforms... def take_screenshot(id) STDERR.puts "Sorry - no screenshots on your platform yet." end end end After do add_screenshot end # Other variants # # Only take screenshot on failures # # After do |scenario| # add_screenshot if scenario.failed? # end # # Only take screenshot for scenarios or features tagged @screenshot # # After(@screenshot) do # add_screenshot # end World(Screenshots)
Version data entries
13 entries across 13 versions & 4 rubygems