7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/maze/client/selenium/bs_client.rb', line 7
def start_session
browsers = YAML.safe_load(File.read("#{__dir__}/bs_browsers.yml"))
config = Maze.config
browser = browsers[config.browser]
if config.legacy_driver?
capabilities = ::Selenium::WebDriver::Remote::Capabilities.new
capabilities['browserstack.local'] = 'true'
capabilities['browserstack.localIdentifier'] = Maze.run_uuid
capabilities['browserstack.console'] = 'errors'
capabilities['browser'] = browser['browserName']
capabilities['browser_version'] = browser['browserVersion']
capabilities['device'] = browser['device']
capabilities['os'] = browser['os']
capabilities['os_version'] = browser['osVersion']
capabilities.merge! JSON.parse(config.capabilities_option)
capabilities.merge! project_name_capabilities
config.capabilities = capabilities
else
capabilities = {
'bstack:options' => {
'local' => 'true',
'localIdentifier' => Maze.run_uuid
}
}
capabilities.deep_merge! browser
capabilities.deep_merge! JSON.parse(config.capabilities_option)
capabilities.merge! project_name_capabilities
config.capabilities = ::Selenium::WebDriver::Remote::Capabilities.new capabilities
end
Maze::Client::BrowserStackClientUtils.start_local_tunnel config.bs_local,
Maze.run_uuid,
config.access_key
selenium_url = "https://#{config.username}:#{config.access_key}@hub.browserstack.com/wd/hub"
Maze.driver = Maze::Driver::Browser.new :remote, selenium_url, config.capabilities
Maze.driver.start_driver
log_session_info
end
|