Sha256: b3e9a910dfa90de5977160f0fe8759a1f92c6d137ad95ced160a4ee31634d288
Contents?: true
Size: 921 Bytes
Versions: 1
Compression:
Stored size: 921 Bytes
Contents
module Capybara module FullScreenshot module RSpecHelpers def save_and_open_full_screenshot width = Capybara.page.execute_script("return Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth);") height = Capybara.page.execute_script("return Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);") Capybara.current_session.current_window.resize_to(width+100, height+100) img = Capybara.page.driver.browser.screenshot_as(:png) path = FullScreenshot.screenshot_path File.open(path, 'wb+') { |f| f.write(img) } Launchy.open("file:///#{ URI.parse(CGI.escape(path.to_s)) }") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
capybara-full_screenshot-0.1.0 | lib/capybara/full_screenshot/rspec_helpers.rb |