| Class | Selenium::RSpec::Reporting::FilePathStrategy |
| In: |
lib/selenium/rspec/reporting/file_path_strategy.rb
|
| Parent: | Object |
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 7
7: def initialize(final_report_file_path)
8: @final_report_file_path = final_report_file_path
9: @relative_dir = nil
10: end
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 12
12: def base_report_dir
13: @base_report_dir ||= File.dirname(File.expand_path(@final_report_file_path))
14: end
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 62
62: def example_hash(example)
63: Digest::MD5.hexdigest example.implementation_backtrace.first
64: end
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 55
55: def file_path(relative_file_path)
56: the_file_path = base_report_dir + "/" + relative_file_path
57: parent_dir = File.dirname(the_file_path)
58: FileUtils.mkdir_p(parent_dir) unless File.directory?(parent_dir)
59: the_file_path
60: end
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 39
39: def file_path_for_html_capture(example)
40: file_path relative_file_path_for_html_capture(example)
41: end
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 47
47: def file_path_for_page_screenshot(example)
48: file_path relative_file_path_for_page_screenshot(example)
49: end
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 51
51: def file_path_for_remote_control_logs(example)
52: file_path relative_file_path_for_remote_control_logs(example)
53: end
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 43
43: def file_path_for_system_screenshot(example)
44: file_path relative_file_path_for_system_screenshot(example)
45: end
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 16
16: def relative_dir
17: return @relative_dir if @relative_dir
18:
19: file_name_without_extension = File.basename(@final_report_file_path).sub(/\.[^\.]*$/, "")
20: @relative_dir ||= "resources/" + file_name_without_extension
21: end
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 23
23: def relative_file_path_for_html_capture(example)
24: "#{relative_dir}/example_#{example_hash(example)}.html"
25: end
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 31
31: def relative_file_path_for_page_screenshot(example)
32: "#{relative_dir}/example_#{example_hash(example)}_page_screenshot.png"
33: end
# File lib/selenium/rspec/reporting/file_path_strategy.rb, line 35
35: def relative_file_path_for_remote_control_logs(example)
36: "#{relative_dir}/example_#{example_hash(example)}_remote_control.log"
37: end