updates for chrome and ff win

This commit is contained in:
John Bintz 2012-02-28 11:31:05 -05:00
parent 823d7b8ab4
commit 4d048cb148
3 changed files with 34 additions and 2 deletions

View File

@ -20,6 +20,8 @@ Currently have three browsers available:
* `ie7` * `ie7`
* `ie8` * `ie8`
* `ie9` * `ie9`
* `chromewin`
* `ffwin10`
Make more on the `Hollandaise::Browsers` module! All sorts of flavors! Make more on the `Hollandaise::Browsers` module! All sorts of flavors!

View File

@ -6,6 +6,14 @@ require 'thread'
require 'builder' require 'builder'
module Hollandaise module Hollandaise
class << self
attr_accessor :url
def configure
yield self
end
end
module Browsers module Browsers
class << self class << self
def for(browsers) def for(browsers)
@ -23,13 +31,32 @@ module Hollandaise
def ie9 def ie9
[ 'iexplore', '9', 'Windows 2008' ] [ 'iexplore', '9', 'Windows 2008' ]
end end
def ffwin10
[ 'firefox', '10', 'Windows 2008' ]
end
def chromewin
[ 'chrome', '', 'Windows 2008' ]
end
end end
end end
end end
begin
load 'hollandaise.rb'
rescue LoadError => e
end
class Hollandaise::CLI < Thor class Hollandaise::CLI < Thor
desc "sauce URL BROWSER BROWSER...", "Take screenshots of a URL on Sauce Labs" desc "sauce URL BROWSER BROWSER...", "Take screenshots of a URL on Sauce Labs"
method_options :delay => 0
def sauce(url, *browsers) def sauce(url, *browsers)
if Hollandaise.url
browsers.unshift(url)
url = Hollandaise.url
end
threads = [] threads = []
FileUtils.rm_rf(dir) if File.directory?(dir) FileUtils.rm_rf(dir) if File.directory?(dir)
@ -52,8 +79,11 @@ class Hollandaise::CLI < Thor
mutex.synchronize { puts "#{target}..." } mutex.synchronize { puts "#{target}..." }
require 'sauce/selenium'
selenium = Sauce::Selenium2.new(Thread.current[:info]) selenium = Sauce::Selenium2.new(Thread.current[:info])
selenium.navigate.to url selenium.navigate.to url
sleep options[:delay].to_i
selenium.execute_script %{window.resizeTo(1280, 1024)} selenium.execute_script %{window.resizeTo(1280, 1024)}
selenium.save_screenshot(target) selenium.save_screenshot(target)

View File

@ -4,8 +4,8 @@ require File.expand_path('../lib/hollandaise/version', __FILE__)
Gem::Specification.new do |gem| Gem::Specification.new do |gem|
gem.authors = ["John Bintz"] gem.authors = ["John Bintz"]
gem.email = ["john@coswellproductions.com"] gem.email = ["john@coswellproductions.com"]
gem.description = %q{TODO: Write a gem description} gem.description = %q{Get delicious screenshots from Sauce Labs, easily}
gem.summary = %q{TODO: Write a gem summary} gem.summary = %q{Get delicious screenshots from Sauce Labs, easily}
gem.homepage = "" gem.homepage = ""
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }