Sha256: 919c470872fdc20bd74d0b5a6d1da403f098d8d3ae4afec562b21c74244c6664

Contents?: true

Size: 1.29 KB

Versions: 12

Compression:

Stored size: 1.29 KB

Contents

module Selenium
  module Rake

    # Rake task to stop a Selenium Remote Control Server
    #
    # Selenium::Rake::RemoteControlStopTask.new do |rc|
    #   rc.host = "localhost"
    #   rc.port = 4444
    #   rc.timeout_in_seconds = 3 * 60
    # end
    #    
    class RemoteControlStopTask
      attr_accessor :host, :port, :timeout_in_seconds, :wait_until_stopped,
                    :shutdown_command

      def initialize(name = :'selenium:rc:stop')
        @host = "localhost"
        @name = name
        @port = 4444
        @timeout_in_seconds = nil
        @shutdown_command = nil
        @wait_until_stopped = true
        yield self if block_given?
        define
      end
    
      def define
        desc "Stop Selenium Remote Control running"
        task @name do
          puts "Stopping Selenium Remote Control running at #{host}:#{port}..."
          remote_control = Selenium::RemoteControl::RemoteControl.new(
              host, port, :timeout => timeout_in_seconds,
              :shutdown_command => shutdown_command)
          remote_control.stop
          if @wait_until_stopped
            TCPSocket.wait_for_service_termination :host => host, :port => port
          end
          puts "Stopped Selenium Remote Control running at #{host}:#{port}"
        end
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 4 rubygems

Version Path
selenium-selenese-1.1.13 lib/selenium/rake/remote_control_stop_task.rb
selenium-selenese-1.1.12 lib/selenium/rake/remote_control_stop_task.rb
selenium-selenese-1.1.11 lib/selenium/rake/remote_control_stop_task.rb
selenium-selenese-1.1.10 lib/selenium/rake/remote_control_stop_task.rb
selenium-selenese-1.1.6 lib/selenium/rake/remote_control_stop_task.rb
selenium-selenese-1.1.4 lib/selenium/rake/remote_control_stop_task.rb
selenium-selenese-1.1.3 lib/selenium/rake/remote_control_stop_task.rb
warnold-selenium-client-1.2.19 lib/selenium/rake/remote_control_stop_task.rb
selenium-rspec-dsl-1.0.2 vendor/selenium-client-1.2.17/lib/selenium/rake/remote_control_stop_task.rb
selenium-client-1.2.18 lib/selenium/rake/remote_control_stop_task.rb
selenium-client-1.2.17 lib/selenium/rake/remote_control_stop_task.rb
selenium-client-1.2.16 lib/selenium/rake/remote_control_stop_task.rb