Sha256: 37af8979d194f7571042f0021c97252005a8fb70624574c5992697708b8c34ad

Contents?: true

Size: 606 Bytes

Versions: 2

Compression:

Stored size: 606 Bytes

Contents

require 'capybara/dsl'
require 'minitest/reporters/screenshot'

# Use with capybara integration tests
#
class Minitest::Reporters::ScreenshotReporter < Minitest::Reporters::BaseReporter
  include Capybara::DSL

  @count = 1

  class << self
    attr_accessor :count
  end

  def record(test)
    super
    if test.failure
      test_name = "#{test.class.name}-#{test.name}"
      screenshot_name = test.error? ? "ERROR-#{test_name}.png" : "FAILURE-#{test_name}.png"
      save_screenshot File.join('test/screenshots', "#{self.class.count}-#{screenshot_name}")
      self.class.count += 1
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
minitest-screenshot-reporter-0.0.6 lib/minitest/reporters/screenshot_reporter.rb
minitest-screenshot-reporter-0.0.2 lib/minitest/reporters/screenshot_reporter.rb