Sha256: 79ec6a4a4fb3958fdbb44bdf3ffcc7d1ba77dec9d06c8e4a5c1083562569b8b7
Contents?: true
Size: 994 Bytes
Versions: 3
Compression:
Stored size: 994 Bytes
Contents
module CucumberCinema class Camera def take_screenshot(body) create_directory($cucumber_cinema_dir_name) filename="#{$cucumber_cinema_dir_name}/#{$cucumber_cinema_prefix}-#{rand(10**10)}" Capybara.save_page(body.to_str, "#{filename}.html") `wkhtmltoimage #{Capybara.save_and_open_page_path}/#{filename}.html #{$cucumber_cinema_location}/#{filename}.png` end protected def create_directory(screenshot_dir_name) Dir.mkdir(Capybara.save_and_open_page_path) if !Dir.exist?(Capybara.save_and_open_page_path) if !Dir.exist?("#{Capybara.save_and_open_page_path}/#{screenshot_dir_name}") Dir.mkdir("#{Capybara.save_and_open_page_path}/#{screenshot_dir_name}") end Dir.mkdir("#{$cucumber_cinema_location}") if !Dir.exist?($cucumber_cinema_location) if !Dir.exist?("#{$cucumber_cinema_location}/#{screenshot_dir_name}") Dir.mkdir("#{$cucumber_cinema_location}/#{screenshot_dir_name}") end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cucumber-cinema-0.6.2 | lib/cucumber_cinema/camera.rb |
cucumber-cinema-0.6.1 | lib/cucumber_cinema/camera.rb |
cucumber-cinema-0.6.0 | lib/cucumber_cinema/camera.rb |