Class: Minitest::Reporters::ScreenshotReporter

Inherits:
BaseReporter
  • Object
show all
Includes:
Capybara::DSL
Defined in:
lib/minitest/reporters/screenshot_reporter.rb

Overview

Use with capybara integration tests

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.countObject

Returns the value of attribute count.



12
13
14
# File 'lib/minitest/reporters/screenshot_reporter.rb', line 12

def count
  @count
end

Instance Method Details

#record(test) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/minitest/reporters/screenshot_reporter.rb', line 15

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