class Selenium::RSpec::SeleniumTestReportFormatter

Public Class Methods

capture_system_state(selenium_driver, example) click to toggle source

Should be called from config.after(:each) in spec helper

# File lib/selenium/rspec/reporting/selenium_test_report_formatter.rb, line 64
def self.capture_system_state(selenium_driver, example)
  system_capture = Selenium::RSpec::Reporting::SystemCapture.new(selenium_driver, example, file_path_strategy)
  system_capture.capture_system_state                      
end
file_path_strategy() click to toggle source
# File lib/selenium/rspec/reporting/selenium_test_report_formatter.rb, line 77
def self.file_path_strategy
        ### HACK ####
        # When running with DeepTest the class instance variable could not have been set
        # For now you must set the env variable before launching the tests. We need to revisit the way DeepTest
        # and RSpec reporting work for a proper fix.
        @@file_path_strategy ||= Selenium::RSpec::Reporting::FilePathStrategy.new(ENV["SELENIUM_TEST_REPORT_FILE"])
      end
new(options, output) click to toggle source
# File lib/selenium/rspec/reporting/selenium_test_report_formatter.rb, line 22
def initialize(options, output)
  super
  raise "Unexpected output type #{output.inspect}" unless output.kind_of?(String)
  @@file_path_strategy = Selenium::RSpec::Reporting::FilePathStrategy.new(output)
end

Public Instance Methods

example_failed(example, counter, failure) click to toggle source
# File lib/selenium/rspec/reporting/selenium_test_report_formatter.rb, line 49
def example_failed(example, counter, failure)        
  old_output = @output
  @output = StringIO.new
  super
  
  result = @output.string
  report = Selenium::RSpec::Reporting::HtmlReport.new(@@file_path_strategy)
  report.replace_placeholder_with_system_state_content(result, example)
  old_output.puts result
  old_output.flush
ensure
  @output = old_output
end
example_pending(example_proxy, message, deprecated_pending_location=nil) click to toggle source
# File lib/selenium/rspec/reporting/selenium_test_report_formatter.rb, line 45
def example_pending(example_proxy, message, deprecated_pending_location=nil)
  super
end
extra_failure_content(failure) click to toggle source
# File lib/selenium/rspec/reporting/selenium_test_report_formatter.rb, line 41
def extra_failure_content(failure)
  Selenium::RSpec::Reporting::HtmlReport.inject_placeholder(super)
end
global_scripts() click to toggle source
# File lib/selenium/rspec/reporting/selenium_test_report_formatter.rb, line 69
def global_scripts
  Selenium::RSpec::Reporting::HtmlReport.append_javascript(super)
end
global_styles() click to toggle source
# File lib/selenium/rspec/reporting/selenium_test_report_formatter.rb, line 73
def global_styles
  Selenium::RSpec::Reporting::HtmlReport.append_css(super)
end
move_progress() click to toggle source
# File lib/selenium/rspec/reporting/selenium_test_report_formatter.rb, line 37
def move_progress
  # we don't have current_example_number, and we don't really care about the progress bar
end
start(example_count) click to toggle source
# File lib/selenium/rspec/reporting/selenium_test_report_formatter.rb, line 28
def start(example_count)
  super
  # ensure there's at least 1 example group header (normally 0 with deep_test)
  # prevents js and html validity errors
  example_group = Object.new
  def example_group.description; ""; end
  example_group_started example_group
end