module ActionDispatch::SystemTesting::TestHelpers::ScreenshotHelper
Public Instance Methods
take_screenshot()
click to toggle source
# File lib/system_test_html_screenshots.rb, line 9 def take_screenshot save_image save_page puts display_screenshot end
Private Instance Methods
absolute_page_path()
click to toggle source
# File lib/system_test_html_screenshots.rb, line 25 def absolute_page_path Rails.root.join("tmp/screenshots/#{image_name}.html") end
display_screenshot()
click to toggle source
# File lib/system_test_html_screenshots.rb, line 33 def display_screenshot message = "[Image screenshot]: file://#{image_path}\n" message += " [Page HTML]: file://#{page_path}\n" case output_type when "artifact" message << "\e]1338;url=artifact://#{absolute_image_path}\a\n" when "inline" name = inline_base64(File.basename(absolute_image_path)) image = inline_base64(File.read(absolute_image_path)) message << "\e]1337;File=name=#{name};height=400px;inline=1:#{image}\a\n" end message end
image_path()
click to toggle source
# File lib/system_test_html_screenshots.rb, line 17 def image_path @image_path ||= absolute_image_path.to_s end
page_path()
click to toggle source
# File lib/system_test_html_screenshots.rb, line 21 def page_path @page_path ||= absolute_page_path.to_s end
save_page()
click to toggle source
# File lib/system_test_html_screenshots.rb, line 29 def save_page page.save_page(absolute_page_path) end