Sha256: 6e26ad22b215cf173b94fff07a6f31bfbd6b29ae1914d0177cf70e66c1c85001

Contents?: true

Size: 1014 Bytes

Versions: 11

Compression:

Stored size: 1014 Bytes

Contents

require 'spec_helper'

describe "bin/selenium-rc" do
  let(:root_dir) { File.expand_path("#{File.dirname(__FILE__)}/..") }
  before do
    unless File.exists?("#{root_dir}/vendor/selenium-server.jar")
      raise "vendor/selenium-server.jar does not exist. Try running `thor joe:download` to install the jar file."
    end
  end

  it "starts the SeleniumRC server from the downloaded jar file and terminates it when finished" do
    thread = nil
    Dir.chdir(root_dir) do
      thread = Thread.start do
        system("bin/selenium-rc") || raise("bin/selenium-server failed")
      end
    end

    server = SeleniumRC::Server.new("0.0.0.0")

    timeout { server.ready? }
    thread.kill
    Lsof.kill(4444)
    timeout { !server.ready? }
  end

  def timeout
    start_time = Time.now
    timeout = 15
    until yield
      if Time.now > (start_time + timeout)
        raise SeleniumRC::ServerNotStarted.new("Selenium Server was not ready for connections after #{timeout} seconds")
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
selenium-rc-latest-2.53.0 spec/bin_selenium_rc_spec.rb
selenium-rc-latest-2.47.1.2 spec/bin_selenium_rc_spec.rb
selenium-rc-latest-2.47.1.1 spec/bin_selenium_rc_spec.rb
selenium-rc-latest-2.47.1 spec/bin_selenium_rc_spec.rb
selenium-rc-latest-2.39.0 spec/bin_selenium_rc_spec.rb
selenium-rc-2.16.1.2 spec/bin_selenium_rc_spec.rb
selenium-rc-2.20.0 spec/bin_selenium_rc_spec.rb
selenium-rc-2.4.0 spec/bin_selenium_rc_spec.rb
selenium-rc-2.3.2 spec/bin_selenium_rc_spec.rb
selenium-rc-2.3.1 spec/bin_selenium_rc_spec.rb
selenium-rc-2.3.0 spec/bin_selenium_rc_spec.rb