rajatthareja / ReportBuilder

Ruby gem to merge Cucumber JSON reports and build mobile-friendly HTML Test Report, JSON report and retry file.
https://reportbuilder.rajatthareja.com
MIT License
81 stars 47 forks source link

Cucumber/Watir - Returning an error #99

Open Hanifk2010 opened 3 years ago

Hanifk2010 commented 3 years ago

Traceback (most recent call last): 16: from C:/xxxxxx/xxxxxxx/features/support/hooks.rb:115:in block in <top (required)>' 15: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/report_builder-1.8/lib/report_builder.rb:76:inbuild_report' 14: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/report_builder-1.8/lib/report_builder/builder.rb:41:in build_report' 13: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/report_builder-1.8/lib/report_builder/builder.rb:41:inopen' 12: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/report_builder-1.8/lib/report_builder/builder.rb:42:in block in build_report' 11: from C:/Ruby26-x64/lib/ruby/2.6.0/erb.rb:901:inresult' 10: from C:/Ruby26-x64/lib/ruby/2.6.0/erb.rb:901:in eval' 9: from (erb):12:inblock in build_report' 8: from C:/Ruby26-x64/lib/ruby/2.6.0/erb.rb:901:in result' 7: from C:/Ruby26-x64/lib/ruby/2.6.0/erb.rb:901:ineval' 6: from (erb):1:in block in build_report' 5: from (erb):1:ineach_with_index' 4: from (erb):1:in each' 3: from (erb):2:inblock (2 levels) in build_report' 2: from (erb):2:in each_with_index' 1: from (erb):2:ineach' (erb):4:in `block (3 levels) in build_report': incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)

cleberolv commented 2 years ago

I had the same issue and I solved it encoding the screenshoots in Base64:

windows.each do |window|
    within_window window do
      tmp_screenshot = page.save_screenshot(file_path)
        screenshot = Base64.encode64(File.open(tmp_screenshot, "rb").read)
        embed(screenshot, "image/png", "Screenshot")
    end
end

I hope this help