Class: JsTestCore::Client
- Inherits:
-
Object
- Object
- JsTestCore::Client
- Defined in:
- lib/js_test_core/client.rb
Defined Under Namespace
Classes: ClientException, InvalidStatusResponse, SessionNotFound
Instance Attribute Summary collapse
-
#http ⇒ Object
readonly
Returns the value of attribute http.
-
#last_poll ⇒ Object
readonly
Returns the value of attribute last_poll.
-
#last_poll_reason ⇒ Object
readonly
Returns the value of attribute last_poll_reason.
-
#last_poll_status ⇒ Object
readonly
Returns the value of attribute last_poll_status.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#query_string ⇒ Object
readonly
Returns the value of attribute query_string.
-
#session_start_response ⇒ Object
readonly
Returns the value of attribute session_start_response.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(parameters) ⇒ Client
constructor
A new instance of Client.
- #parts_from_query(query) ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(parameters) ⇒ Client
Returns a new instance of Client.
48 49 50 51 |
# File 'lib/js_test_core/client.rb', line 48 def initialize(parameters) @parameters = parameters @query_string = SeleniumServerConfiguration.query_string_from(parameters) end |
Instance Attribute Details
#http ⇒ Object (readonly)
Returns the value of attribute http.
47 48 49 |
# File 'lib/js_test_core/client.rb', line 47 def http @http end |
#last_poll ⇒ Object (readonly)
Returns the value of attribute last_poll.
47 48 49 |
# File 'lib/js_test_core/client.rb', line 47 def last_poll @last_poll end |
#last_poll_reason ⇒ Object (readonly)
Returns the value of attribute last_poll_reason.
47 48 49 |
# File 'lib/js_test_core/client.rb', line 47 def last_poll_reason @last_poll_reason end |
#last_poll_status ⇒ Object (readonly)
Returns the value of attribute last_poll_status.
47 48 49 |
# File 'lib/js_test_core/client.rb', line 47 def last_poll_status @last_poll_status end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
47 48 49 |
# File 'lib/js_test_core/client.rb', line 47 def parameters @parameters end |
#query_string ⇒ Object (readonly)
Returns the value of attribute query_string.
47 48 49 |
# File 'lib/js_test_core/client.rb', line 47 def query_string @query_string end |
#session_start_response ⇒ Object (readonly)
Returns the value of attribute session_start_response.
47 48 49 |
# File 'lib/js_test_core/client.rb', line 47 def session_start_response @session_start_response end |
Class Method Details
.run(parameters = {}) ⇒ Object
13 14 15 |
# File 'lib/js_test_core/client.rb', line 13 def run(parameters={}) new(parameters).run end |
.run_argv(argv) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/js_test_core/client.rb', line 17 def run_argv(argv) params = {} parser = OptionParser.new do |o| o. = "JsTestCore Runner" o. << "\nUsage: #{$0} [options] [-- untouched arguments]" o.on o.on('-s', '--selenium_browser_start_command=selenium_browser_start_command', "The Selenium server command to start the browser. See http://selenium-rc.openqa.org/") do |selenium_browser_start_command| params[:selenium_browser_start_command] = selenium_browser_start_command end o.on('-h', '--selenium_host=SELENIUM_HOST', "The host name of the Selenium Server relative to where this file is executed") do |host| params[:selenium_host] = host end o.on('-p', '--selenium_port=SELENIUM_PORT', "The port of the Selenium Server relative to where this file is executed") do |port| params[:selenium_port] = port end o.on('-u', '--spec_url=SPEC_URL', "The url of the js spec server, relative to the browsers running via the Selenium Server") do |spec_url| params[:spec_url] = spec_url end o.on_tail end parser.order!(argv) run params end |
Instance Method Details
#parts_from_query(query) ⇒ Object
61 62 63 64 65 66 67 |
# File 'lib/js_test_core/client.rb', line 61 def parts_from_query(query) query.split('&').inject({}) do |acc, key_value_pair| key, value = key_value_pair.split('=') acc[key] = value acc end end |
#run ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/js_test_core/client.rb', line 53 def run Net::HTTP.start(DEFAULT_HOST, DEFAULT_PORT) do |@http| start_runner wait_for_session_to_finish end report_result end |