selenium-server 0.2.1 → 1.0.0
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/.gitignore +2 -0
- data/Gemfile.lock +28 -0
- data/README.md +30 -5
- data/example.rb +13 -0
- data/lib/selenium-server.rb +5 -1
- data/lib/selenium-server/configuration.rb +5 -0
- data/lib/selenium-server/runner.rb +31 -0
- data/lib/selenium-server/selenium-server.rb +34 -0
- data/lib/selenium-server/server.rb +27 -0
- data/selenium-server.gemspec +2 -2
- metadata +9 -4
- data/lib/selenium-server/wrapper.rb +0 -23
data/Gemfile.lock
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
selenium-server (0.3.0)
|
5
|
+
rake
|
6
|
+
selenium-webdriver
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
childprocess (0.3.9)
|
12
|
+
ffi (~> 1.0, >= 1.0.11)
|
13
|
+
ffi (1.6.0)
|
14
|
+
multi_json (1.7.2)
|
15
|
+
rake (10.0.4)
|
16
|
+
rubyzip (0.9.9)
|
17
|
+
selenium-webdriver (2.31.0)
|
18
|
+
childprocess (>= 0.2.5)
|
19
|
+
multi_json (~> 1.0)
|
20
|
+
rubyzip
|
21
|
+
websocket (~> 1.0.4)
|
22
|
+
websocket (1.0.7)
|
23
|
+
|
24
|
+
PLATFORMS
|
25
|
+
ruby
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
selenium-server!
|
data/README.md
CHANGED
@@ -1,15 +1,40 @@
|
|
1
1
|
#selenium-server
|
2
2
|
===============
|
3
3
|
|
4
|
-
|
4
|
+
This library aims to make configuring and running your Selenium tests against a Selenium Server simple for both local and remote execution.
|
5
|
+
|
5
6
|
|
6
7
|
## Getting Started
|
7
8
|
```ruby
|
8
9
|
require 'selenium-server'
|
9
|
-
|
10
|
-
SeleniumServer.
|
11
|
-
|
10
|
+
|
11
|
+
SeleniumServer.configure do |c|
|
12
|
+
c.host = "localhost"
|
13
|
+
c.port = "4444"
|
14
|
+
c.browser = "firefox"
|
15
|
+
c.profile_path = "#{Dir.pwd}/profiles/your_custom_firefox_profile"
|
16
|
+
end
|
17
|
+
|
18
|
+
@driver = SeleniumServer.start
|
19
|
+
|
20
|
+
@driver.get "http://www.google.com"
|
21
|
+
|
22
|
+
SeleniumServer.finish
|
12
23
|
```
|
13
24
|
|
14
25
|
## Helpful bits
|
15
|
-
|
26
|
+
|
27
|
+
### Selenium Actions Reference
|
28
|
+
This library uses the Selenium WebDriver Remote Bridge actions. You can find them [here](http://www.ruby-doc.org/gems/docs/b/bbc-selenium-webdriver-1.17.0/Selenium/WebDriver/Remote/Bridge.html).
|
29
|
+
|
30
|
+
### Start
|
31
|
+
If host is set to "localhost", it will download the latest selenium-standalone-server.jar (unless it already has) and run it. If no additional parameters are set, it will be exected in the background, with logging disabled. This functionality is driven using the [Selenium Rake Server Task](http://selenium.googlecode.com/svn/trunk/docs/api/rb/Selenium/Rake/ServerTask.html).
|
32
|
+
|
33
|
+
### Finish
|
34
|
+
Issues a quit command to the driver (and stops the local server if your host is set to "localhost").
|
35
|
+
|
36
|
+
### Support
|
37
|
+
Currently, Firefox is is all that is supported. More coming soon!
|
38
|
+
|
39
|
+
### Versioning
|
40
|
+
This project loosely follows [Semantic Versioning](http://semver.org/).
|
data/example.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'selenium-server'
|
2
|
+
|
3
|
+
SeleniumServer.configure do |c|
|
4
|
+
c.host = "localhost"
|
5
|
+
c.port = "4444"
|
6
|
+
c.profile_path = "#{Dir.pwd}/profiles/alfresco"
|
7
|
+
end
|
8
|
+
|
9
|
+
@driver = SeleniumServer.start
|
10
|
+
|
11
|
+
@driver.get "http://www.google.com"
|
12
|
+
|
13
|
+
SeleniumServer.finish
|
data/lib/selenium-server.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
#browser type determines server type
|
2
|
+
#browser type determines config params
|
3
|
+
#initializer *should* be the same
|
4
|
+
|
5
|
+
module SeleniumServer
|
6
|
+
class Runner
|
7
|
+
attr_reader :driver
|
8
|
+
|
9
|
+
def initialize(configuration)
|
10
|
+
@driver = initialize_server(configuration)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def set_profile(profile_path)
|
16
|
+
profile = Selenium::WebDriver::Firefox::Profile.new(profile_path)
|
17
|
+
profile.assume_untrusted_certificate_issuer = false
|
18
|
+
Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile)
|
19
|
+
end
|
20
|
+
|
21
|
+
def set_server_url(host, port)
|
22
|
+
"http://#{host}:#{port}/wd/hub"
|
23
|
+
end
|
24
|
+
|
25
|
+
def initialize_server(configuration)
|
26
|
+
Selenium::WebDriver::Remote::Bridge.new(
|
27
|
+
:url => set_server_url(configuration.host, configuration.port),
|
28
|
+
:desired_capabilities => set_profile(configuration.profile_path))
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module SeleniumServer
|
2
|
+
extend self
|
3
|
+
|
4
|
+
def configure
|
5
|
+
yield configuration
|
6
|
+
end
|
7
|
+
|
8
|
+
def configuration
|
9
|
+
@configuration = Configuration.new
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_reader :driver
|
13
|
+
|
14
|
+
def localhost?
|
15
|
+
case @configuration.host
|
16
|
+
when "localhost" then true
|
17
|
+
else false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def run
|
22
|
+
if localhost? then Server.start end
|
23
|
+
@driver = Runner.new(@configuration).driver
|
24
|
+
return driver
|
25
|
+
end
|
26
|
+
|
27
|
+
def finish
|
28
|
+
driver.quit
|
29
|
+
if localhost? then Server.stop end
|
30
|
+
end
|
31
|
+
|
32
|
+
alias :start :run
|
33
|
+
alias :stop :finish
|
34
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module SeleniumServer
|
2
|
+
module Server
|
3
|
+
extend self
|
4
|
+
|
5
|
+
def start
|
6
|
+
rake "start"
|
7
|
+
end
|
8
|
+
|
9
|
+
def stop
|
10
|
+
rake "stop"
|
11
|
+
end
|
12
|
+
|
13
|
+
def restart
|
14
|
+
rake "restart"
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def rake_file
|
20
|
+
"#{File.join(File.dirname(File.expand_path(__FILE__)), 'rake.task')}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def rake(task)
|
24
|
+
system "rake -f #{rake_file} server:#{task}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/selenium-server.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'selenium-server'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '1.0.0'
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
5
|
s.authors = ['Dave Haeffner']
|
6
6
|
s.email = ['dave@arrgyle.com']
|
7
7
|
s.homepage = 'https://github.com/arrgyle/selenium-server'
|
8
|
-
s.summary = 'A
|
8
|
+
s.summary = 'A configurator and runner for you Selenium tests against a Selenium Server.'
|
9
9
|
s.license = 'MIT'
|
10
10
|
|
11
11
|
s.files = `git ls-files`.split($/)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selenium-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: selenium-webdriver
|
@@ -53,10 +53,15 @@ files:
|
|
53
53
|
- .gitignore
|
54
54
|
- .rvmrc
|
55
55
|
- Gemfile
|
56
|
+
- Gemfile.lock
|
56
57
|
- README.md
|
58
|
+
- example.rb
|
57
59
|
- lib/selenium-server.rb
|
60
|
+
- lib/selenium-server/configuration.rb
|
58
61
|
- lib/selenium-server/rake.task
|
59
|
-
- lib/selenium-server/
|
62
|
+
- lib/selenium-server/runner.rb
|
63
|
+
- lib/selenium-server/selenium-server.rb
|
64
|
+
- lib/selenium-server/server.rb
|
60
65
|
- selenium-server.gemspec
|
61
66
|
homepage: https://github.com/arrgyle/selenium-server
|
62
67
|
licenses:
|
@@ -82,5 +87,5 @@ rubyforge_project:
|
|
82
87
|
rubygems_version: 1.8.24
|
83
88
|
signing_key:
|
84
89
|
specification_version: 3
|
85
|
-
summary: A
|
90
|
+
summary: A configurator and runner for you Selenium tests against a Selenium Server.
|
86
91
|
test_files: []
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module SeleniumServer
|
2
|
-
def self.start
|
3
|
-
rake "start"
|
4
|
-
end
|
5
|
-
|
6
|
-
def self.stop
|
7
|
-
rake "stop"
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.restart
|
11
|
-
rake "restart"
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def self.rake_file
|
17
|
-
"#{File.join(File.dirname(File.expand_path(__FILE__)), 'rake.task')}"
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.rake(task)
|
21
|
-
system "rake -f #{rake_file} server:#{task}"
|
22
|
-
end
|
23
|
-
end
|