Sha256: 673e298d8b4463701bfc768b1ad41f8816beef7462227cb005caf0321785f6e0

Contents?: true

Size: 877 Bytes

Versions: 5

Compression:

Stored size: 877 Bytes

Contents

module TestExtention
  def self.require_for_platform
    @do_screenshot=true
    if RUBY_PLATFORM =~ /win/i
      require 'win32screenshot'
      base_windows_bin="..\\..\\windows_bin\\"
      ENV['PATH'] = "#{base_windows_bin}Mozilla_Firefox_309;#{base_windows_bin};#{base_windows_bin}lynx#{ENV['PATH']}"
    # image magic will not work with jruby so not going to take shots
    elsif RUBY_PLATFORM =~ /java/i
      @do_screenshot=false
    else
    end
  end

  def self.screen_shot(method_name, at=nil, size = {:width => 800, :height => 600})
    file = "#{File.expand_path(File.dirname(__FILE__))}/../tmp/images/#{$sequence}_#{Time.to_md5}_#{method_name}_#{at}.jpg"
    @images << file
    if at == 'post'
      sleep 0.2
    end
    Watir::Screen.shot.resize(size[:width], size[:height]).write(file)
    $sequence += 1
  end 

  def self.get_images
    @images
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
qa_robusta-0.1.9 qa_observer/lib/test_extention.rb
qa_robusta-0.1.8 qa_observer/lib/test_extention.rb
qa_robusta-0.1.5 qa_observer/lib/test_extention.rb
qa_robusta-0.1.4 qa_observer/lib/test_extention.rb
qa_robusta-0.1.3 qa_observer/lib/test_extention.rb