class Simulacrum::Browserstack::Driver

Responsible for registering a custom Capybara driver for use with Selenium grid endpoints (Browserstack, SauceLabs, etc.). Configures selenium options via ENV vars so that they can be passed into

Private Instance Methods

browser() click to toggle source
# File lib/simulacrum/browserstack/driver.rb, line 48
def browser
  ENV['SELENIUM_BROWSER']
end
browser_name() click to toggle source
# File lib/simulacrum/browserstack/driver.rb, line 52
def browser_name
  ENV['BS_BROWSERNAME'] || ''
end
browser_version() click to toggle source
# File lib/simulacrum/browserstack/driver.rb, line 60
def browser_version
  ENV['SELENIUM_VERSION'] || ''
end
capabilities() click to toggle source
# File lib/simulacrum/browserstack/driver.rb, line 28
def capabilities
  caps = Selenium::WebDriver::Remote::Capabilities.new
  caps['project']            = Simulacrum.configuration.project_name
  caps['build']              = Simulacrum.configuration.build_name
  caps['browserstack.local'] = true
  caps['browserstack.debug'] = false
  caps['browser']            = browser
  caps['browserName']        = browser_name
  caps['browser_version']    = browser_version
  caps['os']                 = os
  caps['os_version']         = os_version
  caps['device']             = device
  caps['deviceOrientation']  = device_orientation
  caps['platform']           = platform
  caps['resolution']         = resolution
  caps['requireWindowFocus'] = require_window_focus
  caps['realMobile']         = real_mobile
  caps
end
configuration() click to toggle source
# File lib/simulacrum/browserstack/driver.rb, line 15
def configuration
  {
    browser: :remote,
    url: selenium_remote_url,
    desired_capabilities: capabilities,
    http_client: persistent_http_client
  }
end
device() click to toggle source
# File lib/simulacrum/browserstack/driver.rb, line 72
def device
  ENV['BS_AUTOMATE_DEVICE'] || ''
end
device_orientation() click to toggle source
# File lib/simulacrum/browserstack/driver.rb, line 76
def device_orientation
  ENV['BS_AUTOMATE_DEVICEORIENTATION'] || ''
end
os() click to toggle source
# File lib/simulacrum/browserstack/driver.rb, line 64
def os
  ENV['BS_AUTOMATE_OS'] || ''
end
os_version() click to toggle source
# File lib/simulacrum/browserstack/driver.rb, line 68
def os_version
  ENV['BS_AUTOMATE_OS_VERSION'] || ''
end
persistent_http_client() click to toggle source
# File lib/simulacrum/browserstack/driver.rb, line 24
def persistent_http_client
  Selenium::WebDriver::Remote::Http::Persistent.new
end
platform() click to toggle source
# File lib/simulacrum/browserstack/driver.rb, line 80
def platform
  ENV['BS_AUTOMATE_PLATFORM'] || ''
end
real_mobile() click to toggle source
# File lib/simulacrum/browserstack/driver.rb, line 56
def real_mobile
  ENV['BS_REALMOBILE'] || false
end
require_window_focus() click to toggle source
# File lib/simulacrum/browserstack/driver.rb, line 88
def require_window_focus
  ENV['BS_AUTOMATE_REQUIREWINDOWFOCUS'] || ''
end
resolution() click to toggle source
# File lib/simulacrum/browserstack/driver.rb, line 84
def resolution
  ENV['BS_AUTOMATE_RESOLUTION'] || ''
end