small doc fixup to explain how to use different application frameworks with selenium
This commit is contained in:
parent
ec06c76b91
commit
120a53dced
@ -32,8 +32,12 @@ module Webrat
|
|||||||
prepare_pid_file("#{RAILS_ROOT}/tmp/pids", "mongrel_selenium.pid")
|
prepare_pid_file("#{RAILS_ROOT}/tmp/pids", "mongrel_selenium.pid")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# Start the appserver for the underlying framework to test
|
||||||
def self.start_app_server #:nodoc:
|
#
|
||||||
|
# Sinatra: requires a config.ru in the root of your sinatra app to use this
|
||||||
|
# Merb: Attempts to use bin/merb and falls back to the system merb
|
||||||
|
# Rails: Calls mongrel_rails to startup the appserver
|
||||||
|
def self.start_app_server
|
||||||
case Webrat.configuration.application_framework
|
case Webrat.configuration.application_framework
|
||||||
when :sinatra
|
when :sinatra
|
||||||
fork do
|
fork do
|
||||||
@ -52,7 +56,12 @@ module Webrat
|
|||||||
TCPSocket.wait_for_service :host => Webrat.configuration.application_address, :port => Webrat.configuration.application_port.to_i
|
TCPSocket.wait_for_service :host => Webrat.configuration.application_address, :port => Webrat.configuration.application_port.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.stop_app_server #:nodoc:
|
# Stop the appserver for the underlying framework under test
|
||||||
|
#
|
||||||
|
# Sinatra: Reads and kills the pid from the pid file created on startup
|
||||||
|
# Merb: Reads and kills the pid from the pid file created on startup
|
||||||
|
# Rails: Calls mongrel_rails stop to kill the appserver
|
||||||
|
def self.stop_app_server
|
||||||
case Webrat.configuration.application_framework
|
case Webrat.configuration.application_framework
|
||||||
when :sinatra
|
when :sinatra
|
||||||
pid = File.read('rack.pid')
|
pid = File.read('rack.pid')
|
||||||
@ -91,11 +100,25 @@ module Webrat
|
|||||||
# selenium.dragdrop("id=photo_123", "+350, 0")
|
# selenium.dragdrop("id=photo_123", "+350, 0")
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# == Auto-starting of the mongrel and java server
|
# == Choosing the underlying framework to test
|
||||||
|
#
|
||||||
|
# Webrat assumes you're using rails by default but it can also work with sinatra
|
||||||
|
# and merb. To take advantage of this you can use the configuration block to
|
||||||
|
# set the application_framework variable.
|
||||||
|
# require "webrat"
|
||||||
|
#
|
||||||
|
# Webrat.configure do |config|
|
||||||
|
# config.mode = :selenium
|
||||||
|
# config.application_port = 4567
|
||||||
|
# config.application_framework = :sinatra # could also be :merb
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# == Auto-starting of the appserver and java server
|
||||||
#
|
#
|
||||||
# Webrat will automatically start the Selenium Java server process and an instance
|
# Webrat will automatically start the Selenium Java server process and an instance
|
||||||
# of Mongrel when a test is run. The Mongrel will run in the "selenium" environment
|
# of Mongrel when a test is run. The Mongrel will run in the "selenium" environment
|
||||||
# instead of "test", so ensure you've got that defined, and will run on port 3001.
|
# instead of "test", so ensure you've got that defined, and will run on port
|
||||||
|
# Webrat.configuration.application_port.
|
||||||
#
|
#
|
||||||
# == Waiting
|
# == Waiting
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user