Class: CloudTest::Saucelabs

Inherits:
Core
  • Object
show all
Defined in:
lib/cloud_test/saucelabs.rb

Constant Summary collapse

SERVER =
'ondemand.saucelabs.com:443/wd/hub'
"https://app.saucelabs.com/dashboard/builds"

Constants inherited from Core

Core::CONFIG_NAME

Class Method Summary collapse

Methods inherited from Core

check_if_input_is_valid?, copy_keys, get_default_caps, get_provider_class, list_dashboard_link, list_these_caps, load_config, merge_caps, register_driver, upload_status

Class Method Details

.get_all_capsObject



50
51
52
53
54
# File 'lib/cloud_test/saucelabs.rb', line 50

def self.get_all_caps
  @caps.kind_of?(Hash) || init()
  puts "Capabilities: "
  list_these_caps @caps
end

.init(config = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/cloud_test/saucelabs.rb', line 6

def self.init(config=nil)
  @config = config || load_config('SL_USERNAME', 'SL_ACCESS_KEY')

  @caps = Core.get_default_caps
  @caps['record_video'] = true
  @caps['record_network'] = true
  @caps['javascriptEnabled'] = true
  @caps['acceptSslCerts'] = true
  @caps['webStorageEnabled'] = true
  @caps['cssSelectorsEnabled'] = true
  @caps['takesScreenshot'] = true


  @caps['platform']    = 'WINDOWS 10'
  @caps['browserName'] = 'CHROME'

  Capybara.app_host = "http://0.0.0.0:4594"
  Capybara.server_port = 4594

  @caps = merge_caps(@caps, @config, 'saucelabs')
  if !config.nil?
    start()
  end
end

.list_capsObject



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/cloud_test/saucelabs.rb', line 37

def self.list_caps
  Core.list_caps
  puts "Saucelabs specific defaults:"
  puts "\trecord_video: true"
  puts "\trecord_network: true"
  puts "\tjavascriptEnabled: true"
  puts "\tacceptSslCerts: true"
  puts "\twebStorageEnabled: true"
  puts "\tcssSelectorsEnabled: true"
  puts "\ttakesScreenshot: true"
  puts 'You can find a caps generator here: https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/'
end

.startObject



30
31
32
33
34
35
# File 'lib/cloud_test/saucelabs.rb', line 30

def self.start
  puts '> Running features on saucelabs.com'
  #puts 'starting saucelabs tunnel..'
  # inpsire solution by browserstack for starting the tunnel `bin/saucelabs_tunnel -u 7kQU -k 9eee597f-4615-4d10-b9a8-706fb7e75974`
  register_driver(@caps, @config['user'], @config['key'], SERVER)
end