selenium-rake 0.0.1 → 0.0.2
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/.DS_Store +0 -0
- data/README +36 -0
- data/lib/.DS_Store +0 -0
- data/lib/Rakefile +38 -38
- data/lib/generators/config_generator.rb +10 -0
- data/lib/generators/example_generator.rb +8 -0
- data/lib/generators/example_selenium.rb +40 -0
- data/lib/{selenium_config.rb → generators/selenium_config.rb} +0 -0
- data/lib/selenium/rake/.DS_Store +0 -0
- data/lib/selenium/rake/railtie.rb +12 -0
- data/lib/{selenium-2.5.0.jar → selenium/rake/tasks/selenium-2.5.0.jar} +0 -0
- data/lib/selenium/rake/tasks/selenium.rake +43 -0
- data/lib/{selenium-rake → selenium/rake}/version.rb +1 -1
- data/lib/{tests → selenium/tests}/example.rb +0 -0
- data/lib/selenium/tests/selenium_config.rb +15 -0
- data/lib/selenium-rake.rb +2 -6
- data/selenium-rake.gemspec +4 -4
- metadata +29 -7
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
|
@@ -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
|
|
File without changes
|
|
Binary file
|
|
File without changes
|
|
@@ -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
|
|
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
data/selenium-rake.gemspec
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
-
require "selenium
|
|
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
|
-
|
|
23
|
-
|
|
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.
|
|
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-
|
|
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/
|
|
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
|
|
30
|
-
- lib/
|
|
31
|
-
- lib/
|
|
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: ''
|