selenium-rake 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.DS_Store ADDED
Binary file
data/README ADDED
@@ -0,0 +1,36 @@
1
+ Add this to your gemfile.
2
+
3
+ gem 'selenium-rake'
4
+
5
+ Run bundle and you will get the following...
6
+
7
+ RAKE TASKS
8
+
9
+ To start the selenium rc server.
10
+
11
+ rake rc
12
+
13
+ To stop the selenium server.
14
+
15
+ rake rc:stop
16
+
17
+ To run all tests in the test/functional folder with _selenium in the filename.
18
+
19
+ rake rc:tests
20
+
21
+ GENERATORS
22
+
23
+ To override the selenium global selenium config settings, this will make the method global_config available in your individual test cases.
24
+
25
+ rails generate config
26
+
27
+ To generate an example test that can be found in test/functional
28
+
29
+ rails generate example
30
+
31
+ Pull requests, features, improvements, comments and issues are all welcomed...
32
+
33
+
34
+
35
+
36
+
data/lib/.DS_Store ADDED
Binary file
data/lib/Rakefile CHANGED
@@ -1,38 +1,38 @@
1
- require "bundler/gem_tasks"
2
- require "selenium/client"
3
-
4
- selenium_jar_file_path = './selenium/selenium-2.5.0.jar'
5
-
6
- # This rake task starts the selenium server
7
- desc "Start the selenium-rc server"
8
- Selenium::Rake::RemoteControlStartTask.new("rc") do |rc|
9
- rc.port = 4444
10
- rc.timeout_in_seconds = 2 * 60
11
- rc.background = true
12
- rc.wait_until_up_and_running = true
13
- rc.jar_file = selenium_jar_file_path
14
- end
15
-
16
- # This rake task stops the selenium server
17
- desc "Stop the selenium-rc server"
18
- Selenium::Rake::RemoteControlStopTask.new("rc:stop") do |rc|
19
- rc.host = "localhost"
20
- rc.port = 4444
21
- rc.timeout_in_seconds = 3 * 60
22
- end
23
-
24
- # This just calls the run_scripts method below
25
- desc "Run all selenium tests"
26
- task :"rc:tests" do
27
- run_scripts
28
- end
29
-
30
- # This method loads all scripts in the directory
31
- def run_scripts
32
- Dir['lib/selenium-rc-rake/tests/*.rb'].each do |script|
33
- # This line allows you to ingnore test files if required
34
- next if script.include? 'setup.rb'
35
- print "Running #{script}"
36
- puts %x[ruby #{script}]
37
- end
38
- end
1
+ # require "bundler/gem_tasks"
2
+ # require "selenium/client"
3
+ #
4
+ # selenium_jar_file_path = './selenium/selenium-2.5.0.jar'
5
+ #
6
+ # # This rake task starts the selenium server
7
+ # desc "Start the selenium-rc server"
8
+ # Selenium::Rake::RemoteControlStartTask.new("rc") do |rc|
9
+ # rc.port = 4444
10
+ # rc.timeout_in_seconds = 2 * 60
11
+ # rc.background = true
12
+ # rc.wait_until_up_and_running = true
13
+ # rc.jar_file = selenium_jar_file_path
14
+ # end
15
+ #
16
+ # # This rake task stops the selenium server
17
+ # desc "Stop the selenium-rc server"
18
+ # Selenium::Rake::RemoteControlStopTask.new("rc:stop") do |rc|
19
+ # rc.host = "localhost"
20
+ # rc.port = 4444
21
+ # rc.timeout_in_seconds = 3 * 60
22
+ # end
23
+ #
24
+ # # This just calls the run_scripts method below
25
+ # desc "Run all selenium tests"
26
+ # task :"rc:tests" do
27
+ # run_scripts
28
+ # end
29
+ #
30
+ # # This method loads all scripts in the directory
31
+ # def run_scripts
32
+ # Dir['lib/selenium-rc-rake/tests/*.rb'].each do |script|
33
+ # # This line allows you to ingnore test files if required
34
+ # next if script.include? 'setup.rb'
35
+ # print "Running #{script}"
36
+ # puts %x[ruby #{script}]
37
+ # end
38
+ # end
@@ -0,0 +1,10 @@
1
+ class ConfigGenerator < Rails::Generators::Base
2
+ source_root File.expand_path('../',__FILE__)
3
+
4
+ def generate_config
5
+ copy_file "selenium_config.rb", "lib/selenium_config.rb"
6
+ end
7
+
8
+ end
9
+
10
+
@@ -0,0 +1,8 @@
1
+ class ExampleGenerator < Rails::Generators::Base
2
+ source_root File.expand_path('../',__FILE__)
3
+
4
+ def generate_example
5
+ copy_file "example_selenium.rb", "test/functional/example_selenium.rb"
6
+ end
7
+
8
+ end
@@ -0,0 +1,40 @@
1
+ require "test/unit"
2
+ require "rubygems"
3
+ require "selenium/client"
4
+ #require "#{File.dirname(__FILE__)}/selenium_config"
5
+ #require "lib/selenium_config"
6
+
7
+ class Example < Test::Unit::TestCase
8
+
9
+ # include SeleniumConfig
10
+
11
+ def setup
12
+ @verification_errors = []
13
+ @selenium = Selenium::Client::Driver.new \
14
+ :host => "localhost",
15
+ :port => 4444,
16
+ :browser => "*chrome",
17
+ :url => "http://www.google.co.nz/",
18
+ :timeout_in_second => 60
19
+ @selenium.start_new_browser_session
20
+ # rails generate config
21
+ # Then you can uncomment the line below and delete the 7 lines above to use global selenium config found in lib folder
22
+ # global_config
23
+ end
24
+
25
+ def teardown
26
+ @selenium.close_current_browser_session
27
+ assert_equal [], @verification_errors
28
+ end
29
+
30
+ def test_eg
31
+ @selenium.open "/"
32
+ @selenium.click "id=lst-ib"
33
+ @selenium.type "id=lst-ib", "selenium"
34
+ begin
35
+ assert @selenium.is_text_present("Selenium - Web Browser Automation")
36
+ rescue Test::Unit::AssertionFailedError
37
+ @verification_errors << $!
38
+ end
39
+ end
40
+ end
Binary file
@@ -0,0 +1,12 @@
1
+ require 'rails'
2
+ module Selenium
3
+ module Rake
4
+ class Railtie < Rails::Railtie
5
+ railtie_name :selenium_rake
6
+
7
+ rake_tasks do
8
+ load "#{File.dirname(__FILE__)}/tasks/selenium.rake"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,43 @@
1
+ #require "bundler/gem_tasks"
2
+ require "selenium/client"
3
+
4
+ selenium_jar_file_path = "#{File.dirname(__FILE__)}/selenium-2.5.0.jar"
5
+
6
+ # This rake task starts the selenium server
7
+ desc "Start the selenium-rc server"
8
+ Selenium::Rake::RemoteControlStartTask.new("rc") do |rc|
9
+ rc.port = 4444
10
+ rc.timeout_in_seconds = 2 * 60
11
+ rc.background = true
12
+ rc.wait_until_up_and_running = true
13
+ rc.jar_file = selenium_jar_file_path
14
+ end
15
+
16
+ # This rake task stops the selenium server
17
+ desc "Stop the selenium-rc server"
18
+ Selenium::Rake::RemoteControlStopTask.new("rc:stop") do |rc|
19
+ rc.host = "localhost"
20
+ rc.port = 4444
21
+ rc.timeout_in_seconds = 3 * 60
22
+ end
23
+
24
+ # This just calls the run_scripts method below
25
+ desc "Run all selenium tests"
26
+ task :"rc:tests" do
27
+ Dir['test/functional/*_selenium.*'].each do |script|
28
+ # This line allows you to ingnore test files if required
29
+ next if script.include? 'setup.rb'
30
+ print "Running #{script}"
31
+ puts %x[ruby #{script}]
32
+ end
33
+ end
34
+
35
+ # This method loads all scripts in the directory
36
+ # def run_scripts
37
+ # Dir['lib/selenium/tests/*.rb'].each do |script|
38
+ # This line allows you to ingnore test files if required
39
+ #next if script.include? 'setup.rb'
40
+ #print "Running #{script}"
41
+ #puts %x[ruby #{script}]
42
+ # end
43
+ #end
@@ -1,5 +1,5 @@
1
1
  module Selenium
2
2
  module Rake
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
File without changes
@@ -0,0 +1,15 @@
1
+ module SeleniumConfig
2
+
3
+ def global_setup
4
+ @verification_errors = []
5
+ @selenium = Selenium::Client::Driver.new \
6
+ :host => "localhost",
7
+ :port => 4444,
8
+ :browser => "*chrome",
9
+ :url => "http://localhost:3000/",
10
+ :timeout_in_second => 60
11
+
12
+ @selenium.start_new_browser_session
13
+ end
14
+
15
+ end
data/lib/selenium-rake.rb CHANGED
@@ -1,11 +1,7 @@
1
- require "selenium-rake/version"
1
+ require "selenium/rake/version"
2
2
 
3
3
  module Selenium
4
4
  module Rake
5
-
6
- def test_method
7
- puts "This is a test"
8
- end
9
-
5
+ require 'selenium/rake/railtie' if defined?(Rails)
10
6
  end
11
7
  end
@@ -1,11 +1,11 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
- require "selenium-rake/version"
3
+ require "selenium/rake/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "selenium-rake"
7
7
  s.version = Selenium::Rake::VERSION
8
- s.authors = ["Chris Holmes"]
8
+ s.authors = ["Chris Holmes", "Michael Parreno-Villa"]
9
9
  s.email = ["tochrisholmes@gmail.com"]
10
10
  s.homepage = ""
11
11
  s.summary = %q{"a few rake tasks to run selenium rc server and ui tests"}
@@ -19,6 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  # specify any dependencies here; for example:
22
- # s.add_development_dependency "rspec"
23
- # s.add_runtime_dependency "rest-client"
22
+ #s.add_development_dependency "selenium/client"
23
+ s.add_runtime_dependency "selenium-client"
24
24
  end
metadata CHANGED
@@ -1,17 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium-rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Chris Holmes
9
+ - Michael Parreno-Villa
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2011-09-06 00:00:00.000000000 +12:00
13
+ date: 2011-09-14 00:00:00.000000000 +12:00
13
14
  default_executable:
14
- dependencies: []
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: selenium-client
18
+ requirement: &79675000 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
23
+ version: '0'
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: *79675000
15
27
  description: ! '"dump test files into tests folder and run rake tasks to test using
16
28
  selenium"'
17
29
  email:
@@ -20,15 +32,25 @@ executables: []
20
32
  extensions: []
21
33
  extra_rdoc_files: []
22
34
  files:
35
+ - .DS_Store
23
36
  - .gitignore
24
37
  - Gemfile
38
+ - README
25
39
  - Rakefile
40
+ - lib/.DS_Store
26
41
  - lib/Rakefile
27
- - lib/selenium-2.5.0.jar
42
+ - lib/generators/config_generator.rb
43
+ - lib/generators/example_generator.rb
44
+ - lib/generators/example_selenium.rb
45
+ - lib/generators/selenium_config.rb
28
46
  - lib/selenium-rake.rb
29
- - lib/selenium-rake/version.rb
30
- - lib/selenium_config.rb
31
- - lib/tests/example.rb
47
+ - lib/selenium/rake/.DS_Store
48
+ - lib/selenium/rake/railtie.rb
49
+ - lib/selenium/rake/tasks/selenium-2.5.0.jar
50
+ - lib/selenium/rake/tasks/selenium.rake
51
+ - lib/selenium/rake/version.rb
52
+ - lib/selenium/tests/example.rb
53
+ - lib/selenium/tests/selenium_config.rb
32
54
  - selenium-rake.gemspec
33
55
  has_rdoc: true
34
56
  homepage: ''