Class: Applitools::Selenium::DesktopBrowserInfo

Inherits:
IRenderBrowserInfo
  • Object
show all
Defined in:
lib/applitools/selenium/visual_grid/desktop_browser_info.rb

Constant Summary collapse

DEFAULT_CONFIG =
proc do
  {
      platform: 'linux',
      browser_type: BrowserType::CHROME,
      # size_mode: 'full-page',
      viewport_size: Applitools::RectangleSize.from_any_argument(width: 0, height: 0)
  }
end

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from IRenderBrowserInfo

#to_s

Constructor Details

#initialize(options = {}) ⇒ DesktopBrowserInfo

Returns a new instance of DesktopBrowserInfo.



22
23
24
25
26
27
28
# File 'lib/applitools/selenium/visual_grid/desktop_browser_info.rb', line 22

def initialize(options = {})
  super
  if options[:width] && options[:height]
    self.viewport_size = Applitools::RectangleSize.from_any_argument(width: options[:width], height: options[:height])
  end
  self.browser_type = options[:browser_type] if options[:browser_type]
end

Class Method Details

.default_configObject



17
18
19
# File 'lib/applitools/selenium/visual_grid/desktop_browser_info.rb', line 17

def default_config
  DEFAULT_CONFIG.call
end

Instance Method Details

#device_nameObject



39
40
41
# File 'lib/applitools/selenium/visual_grid/desktop_browser_info.rb', line 39

def device_name
  'desktop'
end

#platformObject



30
31
32
33
34
35
36
37
# File 'lib/applitools/selenium/visual_grid/desktop_browser_info.rb', line 30

def platform
  case browser_type
  when BrowserType::EDGE_LEGACY, BrowserType::EDGE_CHROMIUM, BrowserType::EDGE_CHROMIUM_ONE_VERSION_BACK
    'windows'
  else
    'linux'
  end
end

#to_hashObject



43
44
45
46
47
# File 'lib/applitools/selenium/visual_grid/desktop_browser_info.rb', line 43

def to_hash
  result = viewport_size.to_h
  result[:name] = browser_type unless browser_type.nil?
  result
end