Sha256: 7762d171cf4281c899efa5b0245dee063683f0e2a7ff91dfc55cc42eeaf99ba5

Contents?: true

Size: 780 Bytes

Versions: 5

Compression:

Stored size: 780 Bytes

Contents

# coding: UTF-8

module Daddy
  module Cucumber
    module Capture
      SCREENSHOT_DIR = 'features/reports/screenshots'
      FileUtils.mkdir_p(SCREENSHOT_DIR)
    
      @@_screen_count = 0
    
      def capture(url = nil)
    
        url ||= remove_domain(current_url)
    
        @@_screen_count += 1
    
        image = "#{@@_screen_count}.png"
    
        if Capybara.current_driver == :webkit
          page.driver.render("#{SCREENSHOT_DIR}/#{image}")
        else
          page.driver.browser.save_screenshot("#{SCREENSHOT_DIR}/#{image}")
        end

        puts %{
          <div style="margin: 5px 0;">#{url}</div>
          <div style="padding-right: 20px;"><img src="screenshots/#{image}" width="60%" height="60%"/></div>
        }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
daddy-0.0.8 lib/daddy/cucumber/capture.rb
daddy-0.0.7 lib/daddy/cucumber/capture.rb
daddy-0.0.6 lib/daddy/cucumber/capture.rb
daddy-0.0.5 lib/daddy/cucumber/capture.rb
daddy-0.0.4 lib/daddy/cucumber/capture.rb