selenium-server 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +3 -4
- data/lib/selenium-server/configuration.rb +1 -1
- data/lib/selenium-server/rake.task +7 -5
- data/lib/selenium-server/runner.rb +17 -9
- data/lib/selenium-server/selenium-server.rb +6 -3
- data/lib/selenium-server/server.rb +25 -5
- data/selenium-server.gemspec +2 -2
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,6 @@
|
|
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
|
-
|
7
6
|
## Getting Started
|
8
7
|
```ruby
|
9
8
|
require 'selenium-server'
|
@@ -24,17 +23,17 @@ SeleniumServer.finish
|
|
24
23
|
|
25
24
|
## Helpful bits
|
26
25
|
|
27
|
-
### Selenium Actions
|
26
|
+
### Selenium Actions
|
28
27
|
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
28
|
|
30
29
|
### 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).
|
30
|
+
If host is set to "localhost", it will download the latest selenium-standalone-server.jar (unless it already has) and run it. Or, you can specify your own jar (if you have one you prefer to use). 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
31
|
|
33
32
|
### Finish
|
34
33
|
Issues a quit command to the driver (and stops the local server if your host is set to "localhost").
|
35
34
|
|
36
35
|
### Support
|
37
|
-
Currently, Firefox
|
36
|
+
Currently, Firefox with a custom profile is all that is supported. More coming soon!
|
38
37
|
|
39
38
|
### Versioning
|
40
39
|
This project loosely follows [Semantic Versioning](http://semver.org/).
|
@@ -1,7 +1,9 @@
|
|
1
1
|
require 'selenium/rake/server_task'
|
2
2
|
|
3
|
-
Selenium::Rake::ServerTask.new(:server) do |t|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
Selenium::Rake::ServerTask.new(:server) do |t|
|
4
|
+
t.version = :latest
|
5
|
+
|
6
|
+
t.background
|
7
|
+
t.log = false
|
8
|
+
t.port = 4444
|
9
|
+
end
|
@@ -4,28 +4,36 @@
|
|
4
4
|
|
5
5
|
module SeleniumServer
|
6
6
|
class Runner
|
7
|
-
attr_reader :driver
|
7
|
+
attr_reader :driver, :configuration
|
8
8
|
|
9
9
|
def initialize(configuration)
|
10
|
-
@
|
10
|
+
@configuration = configuration
|
11
|
+
set_sensible_defaults
|
12
|
+
@driver = initialize_selenium
|
11
13
|
end
|
12
14
|
|
13
15
|
private
|
14
16
|
|
15
|
-
def
|
16
|
-
|
17
|
+
def set_sensible_defaults
|
18
|
+
configuration.host = "localhost" unless configuration.host
|
19
|
+
configuration.port = "4444" unless configuration.port
|
20
|
+
configuration.browser = "firefox" unless configuration.browser
|
21
|
+
end
|
22
|
+
|
23
|
+
def set_profile
|
24
|
+
profile = Selenium::WebDriver::Firefox::Profile.new(configuration.profile_path)
|
17
25
|
profile.assume_untrusted_certificate_issuer = false
|
18
26
|
Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile)
|
19
27
|
end
|
20
28
|
|
21
|
-
def set_server_url
|
22
|
-
"http://#{host}:#{port}/wd/hub"
|
29
|
+
def set_server_url
|
30
|
+
"http://#{configuration.host}:#{configuration.port}/wd/hub"
|
23
31
|
end
|
24
32
|
|
25
|
-
def
|
33
|
+
def initialize_selenium
|
26
34
|
Selenium::WebDriver::Remote::Bridge.new(
|
27
|
-
:url => set_server_url
|
28
|
-
:desired_capabilities => set_profile
|
35
|
+
:url => set_server_url,
|
36
|
+
:desired_capabilities => set_profile)
|
29
37
|
end
|
30
38
|
end
|
31
39
|
end
|
@@ -9,7 +9,7 @@ module SeleniumServer
|
|
9
9
|
@configuration = Configuration.new
|
10
10
|
end
|
11
11
|
|
12
|
-
attr_reader :driver
|
12
|
+
attr_reader :driver, :server
|
13
13
|
|
14
14
|
def localhost?
|
15
15
|
case @configuration.host
|
@@ -19,14 +19,17 @@ module SeleniumServer
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def run
|
22
|
-
if localhost?
|
22
|
+
if localhost?
|
23
|
+
@server = Server.new(@configuration)
|
24
|
+
server.start
|
25
|
+
end
|
23
26
|
@driver = Runner.new(@configuration).driver
|
24
27
|
return driver
|
25
28
|
end
|
26
29
|
|
27
30
|
def finish
|
28
31
|
driver.quit
|
29
|
-
if localhost? then
|
32
|
+
if localhost? then server.stop end
|
30
33
|
end
|
31
34
|
|
32
35
|
alias :start :run
|
@@ -1,6 +1,10 @@
|
|
1
1
|
module SeleniumServer
|
2
|
-
|
3
|
-
|
2
|
+
class Server
|
3
|
+
attr_reader :configuration
|
4
|
+
|
5
|
+
def initialize(configuration)
|
6
|
+
@configuration = configuration
|
7
|
+
end
|
4
8
|
|
5
9
|
def start
|
6
10
|
rake "start"
|
@@ -16,12 +20,28 @@ module SeleniumServer
|
|
16
20
|
|
17
21
|
private
|
18
22
|
|
19
|
-
def
|
20
|
-
"
|
23
|
+
def generate_rake_task
|
24
|
+
"require 'selenium/rake/server_task'
|
25
|
+
|
26
|
+
Selenium::Rake::ServerTask.new(:server) do |t|
|
27
|
+
#{"t.version = :latest" unless configuration.jar}
|
28
|
+
#{if configuration.jar then "t.jar = #{configuration.jar}" end}
|
29
|
+
t.background
|
30
|
+
t.log = #{configuration.log ? configuration.log : "false"}
|
31
|
+
t.port = #{configuration.port ? configuration.port : "4444"}
|
32
|
+
end"
|
33
|
+
end
|
34
|
+
|
35
|
+
def get_rake_file
|
36
|
+
rake_file = File.join(File.dirname(File.expand_path(__FILE__)))
|
37
|
+
file = File.open(rake_file<<"/rake.task", "w")
|
38
|
+
file << generate_rake_task
|
39
|
+
file.close
|
40
|
+
return rake_file
|
21
41
|
end
|
22
42
|
|
23
43
|
def rake(task)
|
24
|
-
system "rake -f #{
|
44
|
+
system "rake -f #{get_rake_file} server:#{task}"
|
25
45
|
end
|
26
46
|
end
|
27
47
|
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 = '1.
|
3
|
+
s.version = '1.1.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 configurator and runner for
|
8
|
+
s.summary = 'A configurator and runner for your 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: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -87,5 +87,5 @@ rubyforge_project:
|
|
87
87
|
rubygems_version: 1.8.24
|
88
88
|
signing_key:
|
89
89
|
specification_version: 3
|
90
|
-
summary: A configurator and runner for
|
90
|
+
summary: A configurator and runner for your Selenium tests against a Selenium Server.
|
91
91
|
test_files: []
|