class Applitools::Selenium::Configuration
Constants
- DEFAULT_CONFIG
Public Class Methods
Source
# File lib/applitools/selenium/configuration.rb, line 22 def default_config super.merge DEFAULT_CONFIG.call end
Calls superclass method
Public Instance Methods
Source
# File lib/applitools/selenium/configuration.rb, line 68 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
Source
# File lib/applitools/selenium/configuration.rb, line 91 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
Source
# File lib/applitools/selenium/configuration.rb, line 104 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
Source
# File lib/applitools/selenium/configuration.rb, line 111 def add_mobile_device(mobile_device_info) add_mobile_devices(mobile_device_info) end
Source
# File lib/applitools/selenium/configuration.rb, line 115 def add_mobile_devices(mobile_device_infos) add_browsers(mobile_device_infos) end
Source
# File lib/applitools/selenium/configuration.rb, line 45 def add_multi_device_target(*args) ios_devices = [] if args.length == 1 && args[0].is_a?(Hash) # Single hash passed directly ios_devices << create_ios_device_info(args[0]) elsif args.any? { |arg| arg.is_a?(Hash) } # One of the arguments is a hash with device configuration hash_arg = args.find { |arg| arg.is_a?(Hash) } ios_devices << create_ios_device_info(hash_arg) else # Multiple device names as symbols or strings args.each do |device_name| ios_devices << create_ios_device_info(device_name: device_name) end end # Add each iOS device to the configuration add_browsers(*ios_devices) # Return the configuration object for method chaining self end
Source
# File lib/applitools/selenium/configuration.rb, line 40 def custom_setter_for_visual_grid_options(value) return {} if value.nil? value end
Source
# File lib/applitools/selenium/configuration.rb, line 120 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
Move viewport_size
above the private methods
Calls superclass method
Private Instance Methods
Source
# File lib/applitools/selenium/configuration.rb, line 131 def create_ios_device_info(options) if options.is_a?(Symbol) # If a symbol is passed, treat it as a device name Applitools::Selenium::IosDeviceInfo.new(device_name: options) else # Otherwise, pass the options hash to IosDeviceInfo Applitools::Selenium::IosDeviceInfo.new(options) end end
Source
# File lib/applitools/selenium/configuration.rb, line 141 def handle_device_target(target) if target.is_a?(Applitools::Selenium::IosDeviceTarget) ios_device_info = Applitools::Selenium::IosDeviceInfo.new( device_name: target.device_name, screen_orientation: target.screen_orientation, ios_version: target.version ) add_browser(ios_device_info) elsif target.is_a?(Applitools::Selenium::DeviceTarget) device_name = target.device_name orientation = target.screen_orientation || Orientations::PORTRAIT add_device_emulation(device_name, orientation) else raise Applitools::EyesIllegalArgument, 'Expected arguments to be device names, hashes with configuration, or DeviceTarget instances' end end