Skip to content

Instantly share code, notes, and snippets.

@ratbeard
Last active December 14, 2015 23:08
Show Gist options
  • Save ratbeard/5163180 to your computer and use it in GitHub Desktop.
Save ratbeard/5163180 to your computer and use it in GitHub Desktop.
screenshot tag for cucumber
After('@screenshot') do |scenario|
filename = scenario.name.parameterize + ".png"
filename = "FAILED-#{filename}" if scenario.failed?
path = File.join("doc", "screenshots", filename)
page.driver.save_screenshot(path)
end
Add that in features/support/screenshot.rb
parameterize is a rails addition, prob have to drop that part outside rails.
https://github.com/cucumber/cucumber/blob/master/examples/watir/features/support/screenshots.rb
Seems to be an old similar example, before selenium-webdriver had this method built in?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment