Class: Selenium::RSpec::SeleniumTestReportFormatter
- Inherits:
-
Spec::Runner::Formatter::HtmlFormatter
- Object
- Spec::Runner::Formatter::HtmlFormatter
- Selenium::RSpec::SeleniumTestReportFormatter
- Defined in:
- lib/selenium/rspec/reporting/selenium_test_report_formatter.rb
Class Method Summary collapse
-
.capture_system_state(selenium_driver, example) ⇒ Object
Should be called from config.after(:each) in spec helper.
- .file_path_strategy ⇒ Object
Instance Method Summary collapse
- #example_failed(example, counter, failure) ⇒ Object
- #example_passed(example) ⇒ Object
- #example_pending(example, message, pending_caller) ⇒ Object
- #extra_failure_content(failure) ⇒ Object
- #global_scripts ⇒ Object
- #global_styles ⇒ Object
- #move_progress ⇒ Object
- #start(example_count) ⇒ Object
Class Method Details
.capture_system_state(selenium_driver, example) ⇒ Object
Should be called from config.after(:each) in spec helper
66 67 68 69 |
# File 'lib/selenium/rspec/reporting/selenium_test_report_formatter.rb', line 66 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 ⇒ Object
79 80 81 82 83 84 85 |
# File 'lib/selenium/rspec/reporting/selenium_test_report_formatter.rb', line 79 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 |
Instance Method Details
#example_failed(example, counter, failure) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/selenium/rspec/reporting/selenium_test_report_formatter.rb', line 49 def example_failed(example, counter, failure) include_example_group_description example 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_passed(example) ⇒ Object
39 40 41 42 |
# File 'lib/selenium/rspec/reporting/selenium_test_report_formatter.rb', line 39 def example_passed(example) include_example_group_description example super end |
#example_pending(example, message, pending_caller) ⇒ Object
44 45 46 47 |
# File 'lib/selenium/rspec/reporting/selenium_test_report_formatter.rb', line 44 def example_pending(example, , pending_caller) include_example_group_description example super end |
#extra_failure_content(failure) ⇒ Object
35 36 37 |
# File 'lib/selenium/rspec/reporting/selenium_test_report_formatter.rb', line 35 def extra_failure_content(failure) Selenium::RSpec::Reporting::HtmlReport.inject_placeholder(super) end |
#global_scripts ⇒ Object
71 72 73 |
# File 'lib/selenium/rspec/reporting/selenium_test_report_formatter.rb', line 71 def global_scripts Selenium::RSpec::Reporting::HtmlReport.append_javascript(super) end |
#global_styles ⇒ Object
75 76 77 |
# File 'lib/selenium/rspec/reporting/selenium_test_report_formatter.rb', line 75 def global_styles Selenium::RSpec::Reporting::HtmlReport.append_css(super) end |
#move_progress ⇒ Object
31 32 33 |
# File 'lib/selenium/rspec/reporting/selenium_test_report_formatter.rb', line 31 def move_progress # we don't have current_example_number, and we don't really care about the progress bar end |
#start(example_count) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/selenium/rspec/reporting/selenium_test_report_formatter.rb', line 21 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 add_example_group(example_group) @@file_path_strategy = Selenium::RSpec::Reporting::FilePathStrategy.new(@where) end |