sauce 0.15.1 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +25 -0
- data/lib/sauce/config.rb +45 -3
- data/lib/sauce/selenium.rb +16 -0
- data/sauce.gemspec +2 -2
- metadata +4 -4
data/README.markdown
CHANGED
@@ -164,6 +164,31 @@ Note on Patches/Pull Requests
|
|
164
164
|
* Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
165
165
|
* Send me a pull request. Bonus points for topic branches.
|
166
166
|
|
167
|
+
Testing the Gem
|
168
|
+
---------------
|
169
|
+
|
170
|
+
The tests in test/ need a bit of setup to get running:
|
171
|
+
|
172
|
+
if you're on Ubuntu:
|
173
|
+
|
174
|
+
* sudo aptitude install expect libsqlite3-dev
|
175
|
+
|
176
|
+
For all platforms:
|
177
|
+
|
178
|
+
* Install RVM: bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
|
179
|
+
* If you're in a headless environment, set SAUCE_TEST_NO_LOCAL=y in your environment
|
180
|
+
* Set SAUCE_USERNAME and SAUCE_ACCESS_KEY in your environment to valid Sauce OnDemand credentials
|
181
|
+
* bundle install
|
182
|
+
* rake test
|
183
|
+
|
184
|
+
If you want tests to go a bit faster, globally install the gems with native extensions:
|
185
|
+
|
186
|
+
* rvm use 1.8.7@global
|
187
|
+
* gem install ffi sqlite3 json
|
188
|
+
* rvm use 1.9.2@global
|
189
|
+
* gem install ffi sqlite3 json
|
190
|
+
* rvm use default
|
191
|
+
|
167
192
|
Plans
|
168
193
|
-----
|
169
194
|
|
data/lib/sauce/config.rb
CHANGED
@@ -30,6 +30,15 @@ module Sauce
|
|
30
30
|
SAUCE_ACCESS_KEY SAUCE_OS SAUCE_BROWSER SAUCE_BROWSER_VERSION SAUCE_JOB_NAME
|
31
31
|
SAUCE_FIREFOX_PROFILE_URL SAUCE_USER_EXTENSIONS_URL}
|
32
32
|
|
33
|
+
PLATFORMS = {
|
34
|
+
"Windows 2003" => "WINDOWS",
|
35
|
+
"Linux" => "LINUX"
|
36
|
+
}
|
37
|
+
|
38
|
+
BROWSERS = {
|
39
|
+
"iexplore" => "internet explorer"
|
40
|
+
}
|
41
|
+
|
33
42
|
def initialize(opts={})
|
34
43
|
@opts = {}
|
35
44
|
if opts != false
|
@@ -57,18 +66,51 @@ module Sauce
|
|
57
66
|
browser_options = {
|
58
67
|
'username' => @opts[:username],
|
59
68
|
'access-key' => @opts[:access_key],
|
60
|
-
'os' =>
|
61
|
-
'browser' =>
|
62
|
-
'browser-version' =>
|
69
|
+
'os' => os,
|
70
|
+
'browser' => browser,
|
71
|
+
'browser-version' => browser_version,
|
63
72
|
'name' => @opts[:job_name]}
|
64
73
|
return browser_options.to_json
|
65
74
|
end
|
66
75
|
|
76
|
+
def to_desired_capabilities
|
77
|
+
{
|
78
|
+
:browserName => BROWSERS[browser] || browser,
|
79
|
+
:browserVersion => browser_version,
|
80
|
+
:platform => PLATFORMS[os] || os,
|
81
|
+
:name => @opts[:job_name]
|
82
|
+
}.update(@opts.reject {|k, v| [:browser, :browser_version, :os, :job_name].include? k})
|
83
|
+
end
|
84
|
+
|
67
85
|
def browsers
|
68
86
|
return @opts[:browsers] if @opts.include? :browsers
|
69
87
|
return [[os, browser, browser_version]]
|
70
88
|
end
|
71
89
|
|
90
|
+
def browser
|
91
|
+
if @opts[:browsers]
|
92
|
+
@opts[:browsers][0][1]
|
93
|
+
else
|
94
|
+
@opts[:browser]
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def os
|
99
|
+
if @opts[:browsers]
|
100
|
+
@opts[:browsers][0][0]
|
101
|
+
else
|
102
|
+
@opts[:os]
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def browser_version
|
107
|
+
if @opts[:browsers]
|
108
|
+
@opts[:browsers][0][2]
|
109
|
+
else
|
110
|
+
@opts[:browser_version]
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
72
114
|
def domain
|
73
115
|
return @opts[:domain] if @opts.include? :domain
|
74
116
|
return URI.parse(@opts[:browser_url]).host
|
data/lib/sauce/selenium.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "selenium/client"
|
2
|
+
require "selenium/webdriver"
|
2
3
|
|
3
4
|
module Sauce
|
4
5
|
class Selenium < Selenium::Client::Driver
|
@@ -8,4 +9,19 @@ module Sauce
|
|
8
9
|
:browser => @config.to_browser_string, :url => @config.browser_url}))
|
9
10
|
end
|
10
11
|
end
|
12
|
+
|
13
|
+
class Selenium2
|
14
|
+
def initialize(opts={})
|
15
|
+
@config = Sauce::Config.new(opts)
|
16
|
+
@driver = ::Selenium::WebDriver.for(:remote, :url => "http://#{@config.username}:#{@config.access_key}@#{@config.host}:#{@config.port}/wd/hub", :desired_capabilities => @config.to_desired_capabilities)
|
17
|
+
end
|
18
|
+
|
19
|
+
def method_missing(meth, *args)
|
20
|
+
@driver.send(meth, *args)
|
21
|
+
end
|
22
|
+
|
23
|
+
def stop
|
24
|
+
@driver.quit
|
25
|
+
end
|
26
|
+
end
|
11
27
|
end
|
data/sauce.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{sauce}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.16.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Sean Grove", "Eric Allen", "Steven Hazel"]
|
9
|
-
s.date = %q{2011-
|
9
|
+
s.date = %q{2011-02-04}
|
10
10
|
s.default_executable = %q{sauce}
|
11
11
|
s.description = %q{A Ruby interface to Sauce Labs' services. Start/stop tunnels, retrieve Selenium logs, access video replays, etc.}
|
12
12
|
s.email = %q{help@saucelabs.com}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sauce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 93
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 16
|
9
9
|
- 1
|
10
|
-
version: 0.
|
10
|
+
version: 0.16.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sean Grove
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-
|
20
|
+
date: 2011-02-04 00:00:00 -08:00
|
21
21
|
default_executable: sauce
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|