Class: Watir::RSpec::HtmlFormatter
- Inherits:
-
RSpec::Core::Formatters::HtmlFormatter
- Object
- RSpec::Core::Formatters::HtmlFormatter
- Watir::RSpec::HtmlFormatter
- Defined in:
- lib/watir/rspec/html_formatter.rb
Overview
Custom RSpec formatter
-
saves screenshot of the browser upon test failure
-
saves html of the browser upon test failure
-
saves all files generated/downloaded during the test and shows them in the report
Instance Method Summary collapse
-
#file_path(file_name, description = nil) ⇒ String
Generate unique file path for the current spec.
Instance Method Details
#file_path(file_name, description = nil) ⇒ String
Generate unique file path for the current spec. If the file will be created during that spec and spec fails then it will be shown automatically in the html report.
61 62 63 64 65 66 67 |
# File 'lib/watir/rspec/html_formatter.rb', line 61 def file_path(file_name, description=nil) extension = File.extname(file_name) basename = File.basename(file_name, extension) file_path = File.join(@files_dir, "#{basename}_#{::Time.now.strftime("%H%M%S")}_#{example_group_number}_#{example_number}#{extension}") @files_saved_during_example.unshift(:desc => description, :path => file_path) file_path end |