Module: Capybara::Screenshot::Spinach

Defined in:
lib/capybara-screenshot/spinach.rb

Class Method Summary collapse

Class Method Details

.fail_with_screenshot(step_data, exception, location, step_definitions) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/capybara-screenshot/spinach.rb', line 8

def self.fail_with_screenshot(step_data, exception, location, step_definitions)
  if Capybara::Screenshot.autosave_on_failure
    Capybara.using_session(Capybara::Screenshot.final_session_name) do
      filename_prefix = Capybara::Screenshot.filename_prefix_for(:spinach, step_data)
      saver = Capybara::Screenshot.new_saver(Capybara, Capybara.page, true, filename_prefix)
      saver.save
      saver.output_screenshot_path
    end
  end
end