class Applitools::Selenium::Configuration

Constants

DEFAULT_CONFIG

Public Class Methods

default_config() click to toggle source
Calls superclass method
# File lib/applitools/selenium/configuration.rb, line 22
def default_config
  super.merge DEFAULT_CONFIG.call
end

Public Instance Methods

add_browser(*args) { |render_browser_info_fluent| ... } click to toggle source
# File lib/applitools/selenium/configuration.rb, line 44
def add_browser(*args)
  case args.size
  when 0
    browser = Applitools::Selenium::DesktopBrowserInfo.new
  when 1
    b = args[0]
    raise(
      Applitools::EyesIllegalArgument,
      'Expected :browser to be an IRenderBrowserInfo instance!'
    ) unless b.is_a? IRenderBrowserInfo
    browser = b
  when 3
    browser = Applitools::Selenium::DesktopBrowserInfo.new.tap do |bi|
      bi.viewport_size = Applitools::RectangleSize.new(args[0], args[1])
      bi.browser_type = args[2]
    end
  end
  yield(Applitools::Selenium::RenderBrowserInfoFluent.new(browser)) if block_given?
  browsers_info.add browser
  # self.viewport_size = browser.viewport_size unless viewport_size
  self
end
add_browsers(*browsers) click to toggle source
# File lib/applitools/selenium/configuration.rb, line 67
def add_browsers(*browsers)
  browsers = case browsers.first
               when Applitools::Selenium::IRenderBrowserInfo
                 browsers
               when Array
                 browsers.first
             end
  browsers.each do |browser|
    add_browser(browser)
  end
  self
end
add_device_emulation(device_name, orientation = Orientations::PORTRAIT) click to toggle source
# File lib/applitools/selenium/configuration.rb, line 80
def add_device_emulation(device_name, orientation = Orientations::PORTRAIT)
  Applitools::ArgumentGuard.not_nil device_name, 'device_name'
  raise Applitools::EyesIllegalArgument, 'Wrong device name!' unless Devices.enum_values.include? device_name
  emu = Applitools::Selenium::ChromeEmulationInfo.new(device_name, orientation)
  add_browser emu
end
custom_setter_for_visual_grid_options(value) click to toggle source
# File lib/applitools/selenium/configuration.rb, line 39
def custom_setter_for_visual_grid_options(value)
  return {} if value.nil?
  value
end
viewport_size() click to toggle source
Calls superclass method
# File lib/applitools/selenium/configuration.rb, line 87
def viewport_size
  user_defined_vp = super
  user_defined_vp = nil if user_defined_vp.respond_to?(:square) && user_defined_vp.square == 0
  return user_defined_vp if user_defined_vp
  from_browsers_info = browsers_info.select { |bi| bi.viewport_size.square > 0 }.first
  return from_browsers_info.viewport_size if from_browsers_info
  nil
end