class Selenium::RSpec::Reporting::FilePathStrategy

Constants

REPORT_DEFAULT_FILE_PATH

Attributes

final_report_file_path[R]

Public Class Methods

new(final_report_file_path) click to toggle source
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 10
def initialize(final_report_file_path)
  @final_report_file_path = final_report_file_path || REPORT_DEFAULT_FILE_PATH
  @relative_dir = nil
end

Public Instance Methods

base_report_dir() click to toggle source
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 15
def base_report_dir
  @base_report_dir ||= File.dirname(File.expand_path(@final_report_file_path))
end
file_path(relative_file_path) click to toggle source
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 66
def file_path(relative_file_path)
  the_file_path = base_report_dir + "/" + relative_file_path
  parent_dir = File.dirname(the_file_path)
  FileUtils.mkdir_p(parent_dir) unless File.directory?(parent_dir)
  the_file_path
end
file_path_for_browser_network_traffic(example) click to toggle source
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 62
def file_path_for_browser_network_traffic(example)
  file_path relative_file_path_for_browser_network_traffic(example)
end
file_path_for_html_capture(example) click to toggle source
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 46
def file_path_for_html_capture(example)
  file_path relative_file_path_for_html_capture(example)
end
file_path_for_page_screenshot(example) click to toggle source
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 54
def file_path_for_page_screenshot(example)
  file_path relative_file_path_for_page_screenshot(example)
end
file_path_for_remote_control_logs(example) click to toggle source
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 58
def file_path_for_remote_control_logs(example)
  file_path relative_file_path_for_remote_control_logs(example)
end
file_path_for_system_screenshot(example) click to toggle source
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 50
def file_path_for_system_screenshot(example)
  file_path relative_file_path_for_system_screenshot(example)
end
relative_dir() click to toggle source
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 19
def relative_dir
  return @relative_dir if @relative_dir
  
  file_name_without_extension = File.basename(@final_report_file_path).sub(/\.[^\.]*$/, "")
  @relative_dir ||=  "resources/" + file_name_without_extension
end
relative_file_path_for_browser_network_traffic(example) click to toggle source
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 42
def relative_file_path_for_browser_network_traffic(example)
  "#{relative_dir}/example_#{example.reporting_uid}_browser_network_traffic.log"
end
relative_file_path_for_html_capture(example) click to toggle source
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 26
def relative_file_path_for_html_capture(example)
  "#{relative_dir}/example_#{example.reporting_uid}.html"
end
relative_file_path_for_page_screenshot(example) click to toggle source
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 34
def relative_file_path_for_page_screenshot(example)
  "#{relative_dir}/example_#{example.reporting_uid}_page_screenshot.png"
end
relative_file_path_for_remote_control_logs(example) click to toggle source
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 38
def relative_file_path_for_remote_control_logs(example)
  "#{relative_dir}/example_#{example.reporting_uid}_remote_control.log"
end
relative_file_path_for_system_screenshot(example) click to toggle source
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 30
def relative_file_path_for_system_screenshot(example)
  "#{relative_dir}/example_#{example.reporting_uid}_system_screenshot.png"
end