class CloudTest::Browserstack
Constants
- DASHBOARD_LINK
- ENV_PWD
- ENV_USER
- REST_STATUS_SERVER
- SERVER
do anything browserstack specific
Public Class Methods
check_session_id(session_id)
click to toggle source
# File lib/cloud_test/browserstack.rb, line 70 def self.check_session_id(session_id) unless session_id =~ Regexp.new('^[0-9a-z]{40}$') puts session_id << "length: " << session_id.length raise "session_id is invalid!" end end
get_all_caps()
click to toggle source
# File lib/cloud_test/browserstack.rb, line 57 def self.get_all_caps # dry run @caps.kind_of?(Hash) || init() puts "Capabilities: " Core.list_these_caps(@caps) end
get_status_msg(failed, reason)
click to toggle source
# File lib/cloud_test/browserstack.rb, line 63 def self.get_status_msg(failed, reason) { "status" => failed ? "passed" : "failed", "reason" => reason } end
init(config=nil)
click to toggle source
# File lib/cloud_test/browserstack.rb, line 12 def self.init(config=nil) @config = config || Core.load_config(ENV_USER, ENV_PWD) @caps = Core.get_default_caps @caps["browserstack.local"] = true @caps["browserstack.debug"] = true # Visual log @caps['os_version'] = '10' @caps['os'] = 'WINDOWS' @caps['browser'] = 'CHROME' @caps = Core.merge_caps(@caps, @config, 'browserstack') Capybara.app_host = "http://127.0.0.1:38946" Capybara.server_port = 38946 if !config.nil? start() end end
list_caps()
click to toggle source
# File lib/cloud_test/browserstack.rb, line 49 def self.list_caps # defaults Core.list_caps puts "Browserstack specific defaults:" puts "\tbrowserstack.local: true" puts "\tbrowserstack.debug: true " puts 'you can generate capabilities here https://www.browserstack.com/automate/capabilities?tag=selenium-2-3' end
start()
click to toggle source
# File lib/cloud_test/browserstack.rb, line 30 def self.start puts '> Running features on browserstack.com' begin require 'browserstack/local' rescue LoadError puts 'Please add gem "browserstack-local" to your gemfile!' raise LoadError end # Code to start browserstack local (tunnel) before start of test @bs_local = BrowserStack::Local.new bs_local_args = {"key" => "#{@config['key']}", "logfile" => "log/browserstack-local-logs.log"} @bs_local.start(bs_local_args) register_driver(@caps, @config['user'], @config['key'], SERVER) # Code to stop browserstack local after end of test at_exit do @bs_local.stop unless @bs_local.nil? end end