selenium-rails 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +1 -1
- data/lib/selenium_rails/selenium_driver_manager.rb +17 -11
- data/lib/selenium_rails/servers_runner.rb +1 -1
- data/selenium-rails.gemspec +1 -1
- metadata +2 -2
data/README.txt
CHANGED
@@ -7,7 +7,7 @@ Selenium Rails supports the use of Selenium RC with Ruby on Rails projects.
|
|
7
7
|
|
8
8
|
= Instructions
|
9
9
|
|
10
|
-
* gem install selenium-
|
10
|
+
* gem install selenium-rails
|
11
11
|
* Copy the file /lib/tasks/selenium_tasks.rake into your app's lib/tasks directory
|
12
12
|
* Write some selenium tests under test/selenium. For an example app, see http://github.com/pivotal/minimalenium
|
13
13
|
* 'rake test:selenium' to run all selenium tests
|
@@ -1,22 +1,28 @@
|
|
1
1
|
module Selenium
|
2
2
|
class SeleniumDriverManager
|
3
|
-
|
3
|
+
# supports multiple drivers, keyed by options
|
4
|
+
@@selenium_drivers = {}
|
4
5
|
|
5
6
|
def self.driver(driver_options = {})
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
browser_start_command = ENV['BROWSER_START_COMMAND'] ? ENV['BROWSER_START_COMMAND'] : '*firefox'
|
8
|
+
opts = {:server_host => 'localhost', :server_port => '4444', :browser_start_command => browser_start_command,
|
9
|
+
:browser_url => 'http://localhost:3001', :timeout => 10000}.merge(driver_options)
|
10
|
+
key = opts.map {|key, value| key.to_s + '=>' + value.to_s}.sort.join(',')
|
11
|
+
unless @@selenium_drivers[key]
|
12
|
+
@@selenium_drivers[key] = Selenium::SeleniumDriver.new(opts[:server_host], opts[:server_port], opts[:browser_start_command],
|
11
13
|
opts[:browser_url], opts[:timeout])
|
12
|
-
@@
|
14
|
+
@@selenium_drivers[key].start
|
13
15
|
end
|
14
|
-
@@
|
16
|
+
@@selenium_drivers[key]
|
15
17
|
end
|
16
18
|
|
17
|
-
def self.
|
18
|
-
|
19
|
-
|
19
|
+
def self.stop_drivers
|
20
|
+
# Doesn't actually do anything if called from a different process than the one where the
|
21
|
+
# drivers were started, but they will die anyway when the server is killed.
|
22
|
+
@@selenium_drivers.each do |key, selenium_driver|
|
23
|
+
selenium_driver.stop
|
24
|
+
@@selenium_drivers.delete(key)
|
25
|
+
end
|
20
26
|
end
|
21
27
|
end
|
22
28
|
end
|
data/selenium-rails.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selenium-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chad Woolley, Others
|
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
74
|
requirements: []
|
75
75
|
|
76
76
|
rubyforge_project: selenium-rails
|
77
|
-
rubygems_version: 1.
|
77
|
+
rubygems_version: 1.2.0.1861
|
78
78
|
signing_key:
|
79
79
|
specification_version: 2
|
80
80
|
summary: Support for using Selenium RC with Rails.
|