Module: CapybaraScreenshotDiff::Minitest::Assertions

Includes:
DSL
Defined in:
lib/capybara_screenshot_diff/minitest.rb

Instance Attribute Summary

Attributes included from Capybara::Screenshot::Diff::TestMethods

#test_screenshots

Instance Method Summary collapse

Methods included from DSL

#_screenshot

Methods included from Capybara::Screenshot::Diff::TestMethods

#build_full_name, #group_parts, #initialize, #schedule_match_job, #screenshot_dir, #screenshot_group, #screenshot_section

Instance Method Details

#before_teardownObject



37
38
39
40
41
42
43
44
45
46
# File 'lib/capybara_screenshot_diff/minitest.rb', line 37

def before_teardown
  super
  CapybaraScreenshotDiff.verify
rescue CapybaraScreenshotDiff::ExpectationNotMet => e
  assertion = ::Minitest::Assertion.new(e)
  assertion.set_backtrace []
  failures << assertion
ensure
  CapybaraScreenshotDiff.reset
end

#screenshot(*args, skip_stack_frames: 0, **opts) ⇒ Object Also known as: assert_matches_screenshot



22
23
24
25
26
27
28
# File 'lib/capybara_screenshot_diff/minitest.rb', line 22

def screenshot(*args, skip_stack_frames: 0, **opts)
  self.assertions += 1

  super(*args, skip_stack_frames: skip_stack_frames + 3, **opts)
rescue ::CapybaraScreenshotDiff::ExpectationNotMet => e
  raise ::Minitest::Assertion, e.message
end

#setupObject



32
33
34
35
# File 'lib/capybara_screenshot_diff/minitest.rb', line 32

def setup
  super
  ::Capybara::Screenshot::BrowserHelpers.resize_window_if_needed
end