lib/testingbot.rb in testingbot-0.0.2 vs lib/testingbot.rb in testingbot-0.0.4
- old
+ new
@@ -41,17 +41,57 @@
end
module Selenium
module Client
module Base
+ DEFAULT_OPTIONS = {
+ :screenshot => true,
+ :screenrecorder => true
+ }
+
alias :close_current_browser_session_old :close_current_browser_session
+ alias :start_new_browser_session_old :start_new_browser_session
+ alias :initialize_old :initialize
+
+ attr_accessor :options
attr_accessor :session_id_backup
+ attr_accessor :extra
+ attr_accessor :platform
+ attr_accessor :version
+ def initialize(*args)
+ if args[0].kind_of?(Hash)
+ options = args[0]
+ @platform = options[:platform] || "WINDOWS"
+ @version = options[:version] if options[:version]
+ end
+
+ @options = DEFAULT_OPTIONS
+ initialize_old(*args)
+ @host = "hub.testingbot.com" if @host.nil?
+ @port = 4444 if @port.nil?
+ end
+
def close_current_browser_session
@session_id_backup = @session_id
close_current_browser_session_old
end
+
+ def start_new_browser_session(options={})
+ options = @options.merge options
+ options[:platform] = @platform
+ options[:version] = @version unless @version.nil?
+ start_new_browser_session_old(options)
+ end
+
+ def extra=(str)
+ @extra = str
+ end
+
+ def options=(opts = {})
+ @options = @options.merge opts
+ end
end
end
end
if defined?(Spec)
@@ -66,14 +106,15 @@
"client_key" => client_key,
"client_secret" => client_secret,
"status_message" => @execution_error,
"success" => !actual_failure?,
"name" => description.to_s,
- "kind" => 2
+ "kind" => 2,
+ "extra" => @selenium_driver.extra
}
- url = URI.parse('http://localhost:3000/hq')
+ url = URI.parse('http://api.testingbot.com/hq')
http = Net::HTTP.new(url.host, url.port)
response = http.post(url.path, params.map { |k, v| "#{k.to_s}=#{v}" }.join("&"))
end
end
end
@@ -94,17 +135,18 @@
"client_key" => client_key,
"client_secret" => client_secret,
"status_message" => @exception,
"success" => passed?,
"name" => self.to_s,
- "kind" => 2
+ "kind" => 2,
+ "extra" => browser.extra
}
- url = URI.parse('http://localhost:3000/hq')
+ url = URI.parse('http://api.testingbot.com/hq')
http = Net::HTTP.new(url.host, url.port)
response = http.post(url.path, params.map { |k, v| "#{k.to_s}=#{v}" }.join("&"))
run_teardown_old
- end #def run_teardown
+ end
def handle_exception(e)
@exception = e.to_s
handle_exception_old(e)
end
\ No newline at end of file