Class: CloudTest::CrossBrowserTesting
- Inherits:
-
Core
- Object
- Core
- CloudTest::CrossBrowserTesting
show all
- Defined in:
- lib/cloud_test/cross_browser_testing.rb
Constant Summary
collapse
- SERVER =
"hub.crossbrowsertesting.com/wd/hub"
- DASHBOARD_LINK =
"https://app.crossbrowsertesting.com/selenium/results"
- REST_STATUS_SERVER =
"https://crossbrowsertesting.com/api/v3/selenium/"
Constants inherited
from Core
CloudTest::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
.check_session_id(session_id) ⇒ Object
61
62
63
64
65
66
|
# 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 ⇒ Object
47
48
49
50
51
|
# File 'lib/cloud_test/cross_browser_testing.rb', line 47
def self.get_all_caps @caps.kind_of?(Hash) || init()
puts "Capabilities: "
list_these_caps(@caps)
end
|
.get_status_msg(success, reason) ⇒ Object
53
54
55
56
57
58
59
|
# 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) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# 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 ⇒ Object
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/cloud_test/cross_browser_testing.rb', line 36
def self.list_caps 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 ⇒ Object
26
27
28
29
30
|
# 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
|