lib/scoutui/commands/strategy.rb in scoutui-2.0.5.4 vs lib/scoutui/commands/strategy.rb in scoutui-2.0.5.5
- old
+ new
@@ -241,10 +241,15 @@
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Capabilities => #{caps.to_s}"
sauce_endpoint = "http://#{ENV['SAUCE_USERNAME']}:#{ENV['SAUCE_ACCESS_KEY']}@ondemand.saucelabs.com:80/wd/hub"
+ if Scoutui::Utils::TestUtils.instance.getSauceTunnel()
+ caps[:tunnelIdentifier]=Scoutui::Utils::TestUtils.instance.getSauceTunnel()
+ puts __FILE__ + (__LINE__).to_s + " TunnelID: #{caps[:tunnelIdentifier]}"
+ end
+
begin
if client.nil?
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " caps => #{caps}"
@drv=Selenium::WebDriver.for :remote, :url => sauce_endpoint, :desired_capabilities => caps # setup(caps)
else
@@ -268,22 +273,29 @@
_cap=Selenium::WebDriver::Remote::Capabilities.phantomjs('phantomjs.page.settings.userAgent' => USER_AGENTS['YOSE_CHROME_BETA'])
selenium_server=Scoutui::Utils::TestUtils.instance.getSeleniumServer()
- selenium_server='http://localhost:8001' if selenium_server.nil?
+# selenium_server='http://localhost:8001' if selenium_server.nil?
+
if isHeadlessCap?(caps) && caps.has_key?(:useragent)
_cap=Selenium::WebDriver::Remote::Capabilities.phantomjs('phantomjs.page.settings.userAgent' => caps[:useragent])
end
Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Headless capabilities : #{_cap}"
_connected=false
_tm={:start => Time.now, :end => nil }
begin
- @drv=Selenium::WebDriver.for :remote, :url => selenium_server, :desired_capabilities => _cap
+ if !selenium_server.nil?
+ @drv=Selenium::WebDriver.for :remote, :url => selenium_server, :desired_capabilities => _cap
+ else
+ @drv=Selenium::WebDriver.for :phantomjs
+ #@drv=Selenium::WebDriver.for :remote, :desired_capabilities => _cap
+ end
+
_tm[:end]=Time.now
_connected=true
setViewport()
rescue Errno::ECONNREFUSED => ex
@@ -314,10 +326,10 @@
setViewport()
end
- if opts.is_a?(Hash) && opts.has_key?(:loadModel).nil?
+ if opts.is_a?(Hash) && !opts.has_key?(:loadModel).nil?
loadModel(opts[:loadModel])
end
end