class CloudTest::CrossBrowserTesting

Constants

REST_STATUS_SERVER
SERVER

Public Class Methods

check_session_id(session_id) click to toggle source
# File lib/cloud_test/cross_browser_testing.rb, line 61
def self.check_session_id(session_id)
  unless session_id =~ Regexp.new('^([0-9a-z]{32})|([0-9a-z]|-){36}$')
    puts session_id, session_id.length
    raise "session_id is invalid!"
  end
end
get_all_caps() click to toggle source
# File lib/cloud_test/cross_browser_testing.rb, line 47
def self.get_all_caps # dry run
  @caps.kind_of?(Hash) || init()
  puts "Capabilities: "
  list_these_caps(@caps)
end
get_status_msg(success, reason) click to toggle source
# File lib/cloud_test/cross_browser_testing.rb, line 53
def self.get_status_msg(success, reason)
  {
      "action" => "set_score",
      "score" => success ? "pass" : "fail",
      "description" => reason
  }
end
init(config=nil) click to toggle source
# File lib/cloud_test/cross_browser_testing.rb, line 9
def self.init(config=nil)
  @config = config || load_config('CBT_USERNAME', 'CBT_ACCESS_KEY')

  puts '> Running features on crossbrowsertesting.com'
  @caps = Core.get_default_caps

  @caps['record_video'] = true
  @caps['record_network'] = true
  @caps["javascriptEnabled"] = true
  @caps["webStorageEnabled"] = true
  @caps["acceptSslCerts"] = true

  @caps = merge_caps(@caps, @config, 'crossbrowsertesting')
  if !config.nil?
    start()
  end
end
list_caps() click to toggle source

update status help.crossbrowsertesting.com/selenium-testing/tutorials/updating-selenium-tests-pass-fail/

# File lib/cloud_test/cross_browser_testing.rb, line 36
def self.list_caps # defaults
  Core.list_caps
  puts "CrossBrowserTesting specific defaults:"
  puts "\trecord_video: true"
  puts "\trecord_network: true"
  puts "\tjavascriptEnabled: true"
  puts "\twebStorageEnabled: true"
  puts "\tacceptSslCerts: true"
  puts 'You can find all available caps https://help.crossbrowsertesting.com/selenium-testing/tutorials/crossbrowsertesting-automation-capabilities/'
end
start() click to toggle source
# File lib/cloud_test/cross_browser_testing.rb, line 26
def self.start
  Capybara.app_host = "http://local:5555"
  Capybara.server_port = 5555
  register_driver(@caps, @config['user'], @config['key'], SERVER)
end