Class: Applitools::Selenium::Configuration
- Inherits:
-
EyesBaseConfiguration
- Object
- EyesBaseConfiguration
- Applitools::Selenium::Configuration
- Defined in:
- lib/applitools/selenium/configuration.rb
Constant Summary collapse
- DEFAULT_CONFIG =
proc do { force_full_page_screenshot: false, wait_before_screenshots: 0.1, stitch_mode: Applitools::Selenium::StitchModes::CSS, hide_scrollbars: false, hide_caret: false, browsers_info: Applitools::Selenium::BrowsersInfo.new } end
Class Method Summary collapse
Instance Method Summary collapse
- #add_browser(*args) {|Applitools::Selenium::RenderBrowserInfoFluent.new(browser)| ... } ⇒ Object
- #add_device_emulation(device_name, orientation = Orientations::PORTRAIT) ⇒ Object
- #deep_clone ⇒ Object
- #viewport_size ⇒ Object
Class Method Details
.default_config ⇒ Object
19 20 21 |
# File 'lib/applitools/selenium/configuration.rb', line 19 def default_config super.merge DEFAULT_CONFIG.call end |
Instance Method Details
#add_browser(*args) {|Applitools::Selenium::RenderBrowserInfoFluent.new(browser)| ... } ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/applitools/selenium/configuration.rb', line 34 def add_browser(*args) case args.size when 0, 1 b = args[0] browser = b || Applitools::Selenium::RenderBrowserInfo.new when 3 browser = Applitools::Selenium::RenderBrowserInfo.new.tap do |bi| bi. = 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_device_emulation(device_name, orientation = Orientations::PORTRAIT) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/applitools/selenium/configuration.rb', line 51 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 { |b| b.emulation_info(emu) } end |
#deep_clone ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/applitools/selenium/configuration.rb', line 58 def deep_clone new_config = self.class.new config_keys.each do |k| new_config.send( "#{k}=", case value = self.send(k) when Symbol, FalseClass, TrueClass, Integer, Float value else value.clone end ) end new_config end |
#viewport_size ⇒ Object
73 74 75 76 77 78 79 80 |
# File 'lib/applitools/selenium/configuration.rb', line 73 def 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..square > 0 }.first return from_browsers_info. if from_browsers_info nil end |