Skip to content

Instantly share code, notes, and snippets.

@piotrze
Last active February 24, 2016 08:09

Revisions

  1. piotrze revised this gist Feb 24, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions test_helper.rb
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@ def after_teardown
    if !passed?
    timestamp = "#{Time.zone.now.strftime('%Y-%m-%d-%H:%M:%S')}"
    screenshot_name = "screenshot-#{timestamp}.png"
    # Handle CircleCi too
    screenshot_path = "#{ENV.fetch('CIRCLE_ARTIFACTS', Rails.root.join('tmp/capybara'))}/#{screenshot_name}"
    page.save_screenshot(screenshot_path)
    end
  2. piotrze created this gist Feb 24, 2016.
    13 changes: 13 additions & 0 deletions test_helper.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    # test/test_helper.rb

    class ActionDispatch::IntegrationTest
    def after_teardown
    if !passed?
    timestamp = "#{Time.zone.now.strftime('%Y-%m-%d-%H:%M:%S')}"
    screenshot_name = "screenshot-#{timestamp}.png"
    screenshot_path = "#{ENV.fetch('CIRCLE_ARTIFACTS', Rails.root.join('tmp/capybara'))}/#{screenshot_name}"
    page.save_screenshot(screenshot_path)
    end
    super
    end
    end