selenium-rake 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in selenium-rake.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/lib/Rakefile ADDED
@@ -0,0 +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
Binary file
@@ -0,0 +1,11 @@
1
+ require "selenium-rake/version"
2
+
3
+ module Selenium
4
+ module Rake
5
+
6
+ def test_method
7
+ puts "This is a test"
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ module Selenium
2
+ module Rake
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -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
@@ -0,0 +1,38 @@
1
+ require "test/unit"
2
+ require "rubygems"
3
+ require "selenium/client"
4
+ require "#{File.dirname(__FILE__)}/selenium_config"
5
+
6
+ class Example < Test::Unit::TestCase
7
+
8
+ # include SeleniumConfig
9
+
10
+ def setup
11
+ @verification_errors = []
12
+ @selenium = Selenium::Client::Driver.new \
13
+ :host => "localhost",
14
+ :port => 4444,
15
+ :browser => "*chrome",
16
+ :url => "http://www.google.co.nz/",
17
+ :timeout_in_second => 60
18
+ @selenium.start_new_browser_session
19
+ # Uncomment the line below and delete the 7 lines above to use global selenium config
20
+ # global_config
21
+ end
22
+
23
+ def teardown
24
+ @selenium.close_current_browser_session
25
+ assert_equal [], @verification_errors
26
+ end
27
+
28
+ def test_eg
29
+ @selenium.open "/"
30
+ @selenium.click "id=lst-ib"
31
+ @selenium.type "id=lst-ib", "selenium"
32
+ begin
33
+ assert @selenium.is_text_present("Selenium - Web Browser Automation")
34
+ rescue Test::Unit::AssertionFailedError
35
+ @verification_errors << $!
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "selenium-rake/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "selenium-rake"
7
+ s.version = Selenium::Rake::VERSION
8
+ s.authors = ["Chris Holmes"]
9
+ s.email = ["tochrisholmes@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{"a few rake tasks to run selenium rc server and ui tests"}
12
+ s.description = %q{"dump test files into tests folder and run rake tasks to test using selenium"}
13
+
14
+ s.rubyforge_project = "selenium-rake"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ # s.add_runtime_dependency "rest-client"
24
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: selenium-rake
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Chris Holmes
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-09-06 00:00:00.000000000 +12:00
13
+ default_executable:
14
+ dependencies: []
15
+ description: ! '"dump test files into tests folder and run rake tasks to test using
16
+ selenium"'
17
+ email:
18
+ - tochrisholmes@gmail.com
19
+ executables: []
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - .gitignore
24
+ - Gemfile
25
+ - Rakefile
26
+ - lib/Rakefile
27
+ - lib/selenium-2.5.0.jar
28
+ - lib/selenium-rake.rb
29
+ - lib/selenium-rake/version.rb
30
+ - lib/selenium_config.rb
31
+ - lib/tests/example.rb
32
+ - selenium-rake.gemspec
33
+ has_rdoc: true
34
+ homepage: ''
35
+ licenses: []
36
+ post_install_message:
37
+ rdoc_options: []
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubyforge_project: selenium-rake
54
+ rubygems_version: 1.6.2
55
+ signing_key:
56
+ specification_version: 3
57
+ summary: ! '"a few rake tasks to run selenium rc server and ui tests"'
58
+ test_files: []