Class Selenium::RSpec::Reporting::HtmlReport
In: lib/selenium/rspec/reporting/html_report.rb
Parent: Object

Methods

Constants

PLACEHOLDER = "<<placeholder>>"

Public Class methods

[Source]

    # File lib/selenium/rspec/reporting/html_report.rb, line 66
66:         def self.append_css(global_styles)
67:             global_styles + "\ndiv.rspec-report textarea {\nwidth: 100%;\n}\n\ndiv.rspec-report .dyn-source {\nbackground: #FFFFEE none repeat scroll 0%;\nborder:1px dotted black;\ncolor: #000000;\ndisplay: none;\nmargin: 0.5em 2em;\npadding: 0.5em;\n}\n\n"
68:         end

[Source]

    # File lib/selenium/rspec/reporting/html_report.rb, line 45
45:         def self.append_javascript(global_scripts)
46:           global_scripts + "function toggleVisilibility(id, description) {\nvar section;\nvar link;\n\nsection = document.getElementById(id);\nlink = document.getElementById(id + \"_link\");\n\nif (section.style.display == \"block\") {\nsection.style.display = \"none\"\nlink.innerHTML = \"Show \" + description\n} else {\nsection.style.display = \"block\"\nlink.innerHTML = \"Hide \" + description\n}\n}\n"
47:         end

[Source]

    # File lib/selenium/rspec/reporting/html_report.rb, line 13
13:         def self.inject_placeholder(content)
14:           content + Selenium::RSpec::Reporting::HtmlReport::PLACEHOLDER
15:         end

[Source]

    # File lib/selenium/rspec/reporting/html_report.rb, line 9
 9:         def initialize(file_path_strategy)
10:           @file_path_strategy = file_path_strategy
11:         end

Public Instance methods

[Source]

    # File lib/selenium/rspec/reporting/html_report.rb, line 21
21:         def logs_and_screenshot_sections(example)
22:           dom_id = "example_" + example.reporting_uid
23:           system_screenshot_url = @file_path_strategy.relative_file_path_for_system_screenshot(example)
24:           page_screenshot_url = @file_path_strategy.relative_file_path_for_page_screenshot(example)
25:           snapshot_url = @file_path_strategy.relative_file_path_for_html_capture(example)
26:           remote_control_logs_url = @file_path_strategy.relative_file_path_for_remote_control_logs(example)
27:           
28:           html = ""
29:           if File.exists? @file_path_strategy.file_path_for_html_capture(example)
30:             html << toggable_section(dom_id, :id => "snapshot", :url=> snapshot_url, :name => "Dynamic HTML Snapshot")
31:           end
32:           if File.exists? @file_path_strategy.file_path_for_remote_control_logs(example)          
33:             html << toggable_section(dom_id, :id => "rc_logs", :url=> remote_control_logs_url, :name => "Remote Control Logs")
34:           end
35:           if File.exists? @file_path_strategy.file_path_for_page_screenshot(example)
36:             html << toggable_image_section(dom_id, :id => "page_screenshot", :name => "Page Screenshot", :url => page_screenshot_url)
37:           end
38:           if File.exists? @file_path_strategy.file_path_for_system_screenshot(example)
39:             html << toggable_image_section(dom_id, :id => "system_screenshot", :name => "System Screenshot", :url => system_screenshot_url)
40:           end
41:           
42:           return html
43:         end

[Source]

    # File lib/selenium/rspec/reporting/html_report.rb, line 17
17:         def replace_placeholder_with_system_state_content(result, example)
18:           result.gsub! PLACEHOLDER, logs_and_screenshot_sections(example)
19:         end

[Source]

     # File lib/selenium/rspec/reporting/html_report.rb, line 119
119:         def report_header
120:           super + "\n<script type=\"text/javascript\">moveProgressBar('100.0');</script>"
121:         end

[Source]

     # File lib/selenium/rspec/reporting/html_report.rb, line 103
103:         def toggable_image_section(dom_id, options)
104:           "\n<div>[<a id=\"\#{dom_id}_\#{options[:id]}_link\" href=\"javascript:toggleVisilibility('\#{dom_id}_\#{options[:id]}', '\#{options[:name]}');\">Show \#{options[:name]}</a>]</div>\n<br/>\n<div id=\"\#{dom_id}_\#{options[:id]}\" style=\"display: none\">\n<a href=\"\#{options[:url]}\">\n<img width=\"80%\" src=\"\#{options[:url]}\" />\n</a>\n</div>\n<br/>\n\n"
105:         end

[Source]

    # File lib/selenium/rspec/reporting/html_report.rb, line 86
86:         def toggable_section(dom_id, options)
87:           "\n<div>[\n<a id=\"\#{dom_id}_\#{options[:id]}_link\"\nhref=\\\"javascript:toggleVisilibility('\#{dom_id}_\#{options[:id]}', '\#{options[:name]}')\\\">Show \#{options[:name]}</a>\n]</div>\n<br/><br/>\n<div id=\"\#{dom_id}_\#{options[:id]}\" class=\"dyn-source\">\n<a href=\"\#{options[:url]}\">Full screen</a><br/><br/>\n<iframe src=\"\#{options[:url]}\" width=\"100%\" height=\"600px\" ></iframe>\n</div>\n\n"
88:         end

[Validate]