Class: CapybaraScreenshotDiff::AttemptsReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/capybara_screenshot_diff/attempts_reporter.rb

Instance Method Summary collapse

Constructor Details

#initialize(snapshot, comparison_options, stability_options = {}) ⇒ AttemptsReporter

Returns a new instance of AttemptsReporter.



7
8
9
10
11
# File 'lib/capybara_screenshot_diff/attempts_reporter.rb', line 7

def initialize(snapshot, comparison_options, stability_options = {})
  @snapshot = snapshot
  @comparison_options = comparison_options
  @wait = stability_options[:wait]
end

Instance Method Details

#build_comparison_for(attempt_path, previous_attempt_path) ⇒ Object



21
22
23
# File 'lib/capybara_screenshot_diff/attempts_reporter.rb', line 21

def build_comparison_for(attempt_path, previous_attempt_path)
  Capybara::Screenshot::Diff::ImageCompare.new(attempt_path, previous_attempt_path, @comparison_options)
end

#generateObject



13
14
15
16
17
18
19
# File 'lib/capybara_screenshot_diff/attempts_reporter.rb', line 13

def generate
  attempts_screenshot_paths = @snapshot.find_attempts_paths

  annotate_attempts(attempts_screenshot_paths)

  "Could not get stable screenshot within #{@wait}s:\n#{attempts_screenshot_paths.join("\n")}"
end