Skip to content

Instantly share code, notes, and snippets.

@shapovalovei
Created July 5, 2017 11:49
Show Gist options
  • Save shapovalovei/45863d5f8585340439f74f3e085518c6 to your computer and use it in GitHub Desktop.
Save shapovalovei/45863d5f8585340439f74f3e085518c6 to your computer and use it in GitHub Desktop.
Capybara.default_driver = :selenium
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
end
Capybara.save_path = 'reports/screenshots'
After do |scenario|
# Do something after each scenario.
# The +scenario+ argument is optional, but
# if you use it, you can inspect status with
# the #failed?, #passed? and #exception methods.
if scenario.failed?
path = page.save_screenshot
puts "path to attach #{path}"
AllureCucumber::DSL.attach_file("#{scenario.name}.png Screenshot", path)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment