lib/scoutui/commands/strategy.rb in scoutui-2.0.3.57.pre vs lib/scoutui/commands/strategy.rb in scoutui-2.0.4.0

- old
+ new

@@ -92,10 +92,11 @@ def initialize() @profile=nil browserType = Scoutui::Base::UserVars.instance.getBrowserType() + caps = Scoutui::Utils::TestUtils.instance.getCapabilities() if false if !browserType.to_s.match(/chrome/i).nil? @profile = Selenium::WebDriver::Chrome::Profile.new elsif !browserType.to_s.match(/fire/i).nil? @@ -235,9 +236,63 @@ # The following print to STDOUT is useful when running on JENKINS with SauceLabs plugin # Reference: # https://wiki.saucelabs.com/display/DOCS/Setting+Up+Reporting+between+Sauce+Labs+and+Jenkins puts "SauceOnDemandSessionID=#{@drv.session_id} job-name=#{caps[:name]}" + + elsif !caps.nil? + + _YosemiteChromeBeta='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36' + _cap=Selenium::WebDriver::Remote::Capabilities.phantomjs('phantomjs.page.settings.userAgent' => _YosemiteChromeBeta) + + if caps.has_key?(:browser) && caps[:browser].match(/(phantom|phantomjs|ghost|ghostdriver)/i) + selenium_server=Scoutui::Utils::TestUtils.instance.getSeleniumServer() + selenium_server='http://localhost:8001' if selenium_server.nil? + + if caps.has_key?(:useragent) + _cap=Selenium::WebDriver::Remote::Capabilities.phantomjs('phantomjs.page.settings.userAgent' => caps[:useragent]) + end + + @drv=Selenium::WebDriver.for :remote, :url => selenium_server, :desired_capabilities => _cap + + _viewport = Scoutui::Utils::TestUtils.instance.getViewPort() + if !_viewport.nil? + target_size = Selenium::WebDriver::Dimension.new(_viewport[:width], _viewport[:height]) + @drv.manage.window.size = target_size + end + + end + + + elsif browserType.match(/(phantom|phantomjs|ghost|ghostdriver)/i) + + selenium_server=Scoutui::Utils::TestUtils.instance.getSeleniumServer() + selenium_server='http://localhost:8001' if selenium_server.nil? + + ## + # caps + ## + _useragentChromeOnMac='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36' + _useragentWin81IE11='Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv 11.0) like Gecko' + + _Win7IE10 = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)' + + _Win10Edge13='#Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586' + + _Win10ChromeBeta='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.21 Safari/537.36' + _YosemiteChromeBeta='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36' + + _useragent = _YosemiteChromeBeta + + caps=Selenium::WebDriver::Remote::Capabilities.phantomjs('phantomjs.page.settings.userAgent' => _useragent) + # @drv=Selenium::WebDriver.for :phantomjs, :url => selenium_server, :desired_capabilities => caps + @drv=Selenium::WebDriver.for :remote, :url => selenium_server, :desired_capabilities => caps + + _viewport = Scoutui::Utils::TestUtils.instance.getViewPort() + if !_viewport.nil? + target_size = Selenium::WebDriver::Dimension.new(_viewport[:width], _viewport[:height]) + @drv.manage.window.size = target_size + end else Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Create WebDriver: #{browserType.to_s}" @drv=Selenium::WebDriver.for browserType.to_sym, :profile => @profile