Sha256: 4324ddaeffd319362586c409edb7111aa39d9b54985a643af792c132889e6676

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

require "selenium/client"
include Rake::DSL
 
selenium_jar_file_path  = "#{File.dirname(__FILE__)}/selenium-2.5.0.jar"
 
	# This rake task starts the server, runs the tests and stops the server 
 	desc "Start server, run tests then stop server"
 		task :"rc" do
 			Rake::Task["rc:start"].execute
 			Rake::Task["rc:tests"].execute
 			Rake::Task["rc:stop"].execute
 	end 	
 	
 	# This rake task starts the selenium server
	desc "Start the selenium-rc server"
		Selenium::Rake::RemoteControlStartTask.new("rc:start") do |rc|
			rc.port = 4444
			rc.timeout_in_seconds = 2 * 60
			rc.background = true
			rc.wait_until_up_and_running = true
			rc.jar_file = selenium_jar_file_path
		end
	
	# This rake task stops the selenium server
	desc "Stop the selenium-rc server" 
		Selenium::Rake::RemoteControlStopTask.new("rc:stop") do |rc|
			rc.host = "localhost"
			rc.port = 4444
			rc.timeout_in_seconds = 3 * 60
		end
	
	# This just calls the run_scripts method below
	desc "Run all selenium tests"
		task :"rc:tests" do
		Dir['test/functional/*_selenium.*'].each do |script|
			# This line allows you to ingnore test files if required
			next if script.include? 'selenium_config.rb'
				print "Running #{script}"
				puts %x[ruby #{script}]
			end			
		end 

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
selenium-rake-0.0.3 lib/selenium/rake/tasks/selenium.rake