Sha256: e06dd6a5b225dc509bce0239519d0764498ad1b5407ee6812a070cd61f4d5746
Contents?: true
Size: 1.07 KB
Versions: 5
Compression:
Stored size: 1.07 KB
Contents
# coding: UTF-8 module Daddy module Cucumber module Capture REPORT_DIR = 'features/reports' IMAGE_DIR = 'images' FileUtils.mkdir_p("#{REPORT_DIR}/#{IMAGE_DIR}") @@_screen_count = 0 @@_browser_resized = false def capture pause url = Rack::Utils.unescape(current_url) @@_screen_count += 1 image = "#{IMAGE_DIR}/#{@@_screen_count}.png" page.driver.save_screenshot("#{REPORT_DIR}/#{image}") puts %{ <div>#{url}</div> <img class="screenshot" src="#{image}"/> } end def resize_window(width, height) unless @@_browser_resized case Capybara.current_driver when :poltergeist Capybara.current_session.driver.resize(width, height) when :selenium Capybara.current_session.driver.browser.manage.window.resize_to(width, height) when :webkit # TODO end @@_browser_resized = true end end end end end World(Daddy::Cucumber::Capture)
Version data entries
5 entries across 5 versions & 1 rubygems