Sha256: f9658a9857077ce58e88e9acb134a4137642d2374321351909eed0b26ca9e190

Contents?: true

Size: 827 Bytes

Versions: 12

Compression:

Stored size: 827 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)
        pause
    
        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

World(Daddy::Cucumber::Capture)

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
daddy-0.0.20 lib/daddy/cucumber/capture.rb
daddy-0.0.19 lib/daddy/cucumber/capture.rb
daddy-0.0.18 lib/daddy/cucumber/capture.rb
daddy-0.0.17 lib/daddy/cucumber/capture.rb
daddy-0.0.16 lib/daddy/cucumber/capture.rb
daddy-0.0.15 lib/daddy/cucumber/capture.rb
daddy-0.0.14 lib/daddy/cucumber/capture.rb
daddy-0.0.13 lib/daddy/cucumber/capture.rb
daddy-0.0.12 lib/daddy/cucumber/capture.rb
daddy-0.0.11 lib/daddy/cucumber/capture.rb
daddy-0.0.10 lib/daddy/cucumber/capture.rb
daddy-0.0.9 lib/daddy/cucumber/capture.rb