eyes_core 3.18.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/applitools/appium/eyes.rb +2 -1
- data/lib/applitools/appium/target.rb +218 -193
- data/lib/applitools/connectivity/proxy.rb +11 -3
- data/lib/applitools/connectivity/server_connector.rb +4 -2
- data/lib/applitools/core/accessibility_level.rb +11 -0
- data/lib/applitools/core/batch_info.rb +24 -2
- data/lib/applitools/core/classic_runner.rb +8 -1
- data/lib/applitools/core/eyes_base.rb +82 -29
- data/lib/applitools/core/eyes_base_configuration.rb +34 -2
- data/lib/applitools/core/eyes_runner.rb +12 -0
- data/lib/applitools/core/floating_region.rb +17 -8
- data/lib/applitools/core/image_match_settings.rb +54 -0
- data/lib/applitools/core/match_level.rb +3 -1
- data/lib/applitools/core/match_window_data.rb +4 -0
- data/lib/applitools/core/session_start_info.rb +2 -1
- data/lib/applitools/core/test_results.rb +2 -2
- data/lib/applitools/core/universal_eyes_checks.rb +66 -0
- data/lib/applitools/core/universal_eyes_open.rb +100 -0
- data/lib/applitools/core/universal_new_api.rb +43 -0
- data/lib/applitools/universal_sdk/universal_check_settings.rb +184 -0
- data/lib/applitools/universal_sdk/universal_client.rb +142 -0
- data/lib/applitools/universal_sdk/universal_client_socket.rb +110 -0
- data/lib/applitools/universal_sdk/universal_eyes.rb +45 -0
- data/lib/applitools/universal_sdk/universal_eyes_config.rb +203 -0
- data/lib/applitools/universal_sdk/universal_eyes_manager.rb +40 -0
- data/lib/applitools/universal_sdk/universal_eyes_manager_config.rb +62 -0
- data/lib/applitools/universal_sdk/universal_server.rb +81 -0
- data/lib/applitools/utils/utils.rb +13 -0
- data/lib/applitools/version.rb +2 -1
- data/lib/eyes_core.rb +3 -0
- metadata +69 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 553af98234bc29c8a32a13494a2ba1d1ce80291e
         | 
| 4 | 
            +
              data.tar.gz: 05a2259732bf2f3f5f616e654b28544e03905219
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 7d4d74589c4a9feb2c0ff3d55cc3ed103a9f20424adb93e043e07fb1dc3411b06727ae89f8b729cc4bb8468e49268ee257705f441691a03a965b69ffeb237fd9
         | 
| 7 | 
            +
              data.tar.gz: 1127c29cc28a924ef3c22cfb297b91c251663e29fcf6b0b4a5975ff18bcb427c51d6ea083bb0d3c18f48fa2d84203189d6b19dcb4df89dfd8db0aae18773ca95
         | 
| @@ -11,7 +11,7 @@ class Applitools::Appium::Eyes < Applitools::Selenium::SeleniumEyes | |
| 11 11 | 
             
              def initialize(*args)
         | 
| 12 12 | 
             
                super
         | 
| 13 13 | 
             
                self.dont_get_title = true
         | 
| 14 | 
            -
                self.runner = Applitools::ClassicRunner.new
         | 
| 14 | 
            +
                self.runner = Applitools::ClassicRunner.new unless runner
         | 
| 15 15 | 
             
                self.base_agent_id = "eyes.appium.ruby/#{Applitools::VERSION}".freeze
         | 
| 16 16 | 
             
                self.status_bar_height = 0
         | 
| 17 17 | 
             
                self.utils = Applitools::Appium::Utils
         | 
| @@ -36,6 +36,7 @@ class Applitools::Appium::Eyes < Applitools::Selenium::SeleniumEyes | |
| 36 36 | 
             
                self.tag_for_debug = name
         | 
| 37 37 | 
             
                Applitools::ArgumentGuard.one_of? target, 'target', [Applitools::Selenium::Target, Applitools::Appium::Target]
         | 
| 38 38 |  | 
| 39 | 
            +
                return universal_check(name, target)
         | 
| 39 40 | 
             
                return check_native(name, target) if native_app?
         | 
| 40 41 | 
             
                super
         | 
| 41 42 | 
             
              end
         | 
| @@ -2,207 +2,232 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            module Applitools
         | 
| 4 4 | 
             
              module Appium
         | 
| 5 | 
            -
                class Target
         | 
| 6 | 
            -
                  include Applitools::FluentInterface
         | 
| 7 | 
            -
                  attr_accessor :region_to_check, :options, :ignored_regions, :floating_regions, :layout_regions, :content_regions, :strict_regions, :accessibility_regions
         | 
| 8 | 
            -
             | 
| 9 | 
            -
                  class << self
         | 
| 10 | 
            -
                    def window
         | 
| 11 | 
            -
                      new
         | 
| 12 | 
            -
                    end
         | 
| 13 | 
            -
             | 
| 14 | 
            -
                    def region(*args)
         | 
| 15 | 
            -
                      new.region(*args)
         | 
| 16 | 
            -
                    end
         | 
| 17 | 
            -
                  end
         | 
| 18 | 
            -
             | 
| 19 | 
            -
                  def initialize
         | 
| 20 | 
            -
                    self.region_to_check = proc { Applitools::Region::EMPTY }
         | 
| 21 | 
            -
                    self.ignored_regions = []
         | 
| 22 | 
            -
                    self.floating_regions = []
         | 
| 23 | 
            -
                    self.layout_regions = []
         | 
| 24 | 
            -
                    self.content_regions = []
         | 
| 25 | 
            -
                    self.strict_regions = []
         | 
| 26 | 
            -
                    self.accessibility_regions = []
         | 
| 27 | 
            -
                    self.options = {}
         | 
| 28 | 
            -
                  end
         | 
| 29 | 
            -
             | 
| 30 | 
            -
                  def region(*args)
         | 
| 31 | 
            -
                    self.region_to_check = case args.first
         | 
| 32 | 
            -
                                           when ::Selenium::WebDriver::Element
         | 
| 33 | 
            -
                                             proc { args.first }
         | 
| 34 | 
            -
                                           else
         | 
| 35 | 
            -
                                             proc do |driver|
         | 
| 36 | 
            -
                                               driver.find_element(*args)
         | 
| 37 | 
            -
                                             end
         | 
| 38 | 
            -
                                           end
         | 
| 39 | 
            -
                    self
         | 
| 40 | 
            -
                  end
         | 
| 5 | 
            +
                class Target < Applitools::Selenium::Target
         | 
| 41 6 |  | 
| 42 7 | 
             
                  def ignore(*args)
         | 
| 43 | 
            -
                     | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
                                          proc do
         | 
| 51 | 
            -
                                            Applitools::Region
         | 
| 52 | 
            -
                                              .from_location_size(first_argument.location, first_argument.size)
         | 
| 53 | 
            -
                                              .padding(requested_padding)
         | 
| 54 | 
            -
                                          end
         | 
| 55 | 
            -
                                        when Applitools::Region
         | 
| 56 | 
            -
                                          result = first_argument.padding(requested_padding)
         | 
| 57 | 
            -
                                          if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
         | 
| 58 | 
            -
                                            def result.converted?
         | 
| 59 | 
            -
                                              true
         | 
| 60 | 
            -
                                            end
         | 
| 61 | 
            -
                                          end
         | 
| 62 | 
            -
                                          result
         | 
| 63 | 
            -
                                        else
         | 
| 64 | 
            -
                                          proc do |driver|
         | 
| 65 | 
            -
                                            element = driver.find_element(*args)
         | 
| 66 | 
            -
                                            Applitools::Region
         | 
| 67 | 
            -
                                              .from_location_size(element.location, element.size)
         | 
| 68 | 
            -
                                              .padding(requested_padding)
         | 
| 69 | 
            -
                                          end
         | 
| 70 | 
            -
                                        end
         | 
| 71 | 
            -
                    self
         | 
| 72 | 
            -
                  end
         | 
| 73 | 
            -
             | 
| 74 | 
            -
                  def floating(*args)
         | 
| 75 | 
            -
                    value = case args.first
         | 
| 76 | 
            -
                            when Applitools::FloatingRegion
         | 
| 77 | 
            -
                              args.first
         | 
| 78 | 
            -
                            when Applitools::Region
         | 
| 79 | 
            -
                              result = Applitools::FloatingRegion.any(*args)
         | 
| 80 | 
            -
                              if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
         | 
| 81 | 
            -
                                def result.converted?
         | 
| 82 | 
            -
                                  true
         | 
| 83 | 
            -
                                end
         | 
| 84 | 
            -
                              end
         | 
| 85 | 
            -
                              result
         | 
| 86 | 
            -
                            when ::Selenium::WebDriver::Element
         | 
| 87 | 
            -
                              args_dup = args.dup
         | 
| 88 | 
            -
                              Applitools::FloatingRegion.any(*args_dup)
         | 
| 89 | 
            -
                            else
         | 
| 90 | 
            -
                              proc do |driver|
         | 
| 91 | 
            -
                                args_dup = args.dup
         | 
| 92 | 
            -
                                region = driver.find_element(args_dup.shift, args_dup.shift)
         | 
| 93 | 
            -
                                Applitools::FloatingRegion.any(
         | 
| 94 | 
            -
                                    region, *args_dup
         | 
| 95 | 
            -
                                )
         | 
| 96 | 
            -
                              end
         | 
| 97 | 
            -
                            end
         | 
| 98 | 
            -
                    floating_regions << value
         | 
| 99 | 
            -
                    self
         | 
| 100 | 
            -
                  end
         | 
| 101 | 
            -
             | 
| 102 | 
            -
                  def layout
         | 
| 103 | 
            -
                    return match_level(Applitools::MatchLevel::LAYOUT) if args.empty?
         | 
| 104 | 
            -
                    region = process_region(*args)
         | 
| 105 | 
            -
                    layout_regions << region
         | 
| 106 | 
            -
                  self
         | 
| 107 | 
            -
             | 
| 108 | 
            -
                  end
         | 
| 109 | 
            -
             | 
| 110 | 
            -
                  def content(*args)
         | 
| 111 | 
            -
                    return match_level(Applitools::MatchLevel::CONTENT) if args.empty?
         | 
| 112 | 
            -
                    region = process_region(*args)
         | 
| 113 | 
            -
                    content_regions << region
         | 
| 114 | 
            -
                    self
         | 
| 115 | 
            -
                  end
         | 
| 116 | 
            -
             | 
| 117 | 
            -
                  def strict(*args)
         | 
| 118 | 
            -
                    return match_level(Applitools::MatchLevel::STRICT) if args.empty?
         | 
| 119 | 
            -
                    region = process_region(*args)
         | 
| 120 | 
            -
                    strict_regions << region
         | 
| 121 | 
            -
                    self
         | 
| 122 | 
            -
                  end
         | 
| 123 | 
            -
             | 
| 124 | 
            -
                  def exact(*args)
         | 
| 125 | 
            -
                    match_level(Applitools::MatchLevel::EXACT, *args)
         | 
| 126 | 
            -
                  end
         | 
| 127 | 
            -
             | 
| 128 | 
            -
                  def accessibility(*args)
         | 
| 129 | 
            -
                    options = Applitools::Utils.extract_options! args
         | 
| 130 | 
            -
                    unless options[:type]
         | 
| 131 | 
            -
                      raise Applitools::EyesError,
         | 
| 132 | 
            -
                            'You should call Target.accessibility(region, type: type). The region_type option is required'
         | 
| 133 | 
            -
                    end
         | 
| 134 | 
            -
                    unless Applitools::AccessibilityRegionType.enum_values.include?(options[:type])
         | 
| 135 | 
            -
                      raise Applitools::EyesIllegalArgument,
         | 
| 136 | 
            -
                            "The region type should be one of [#{Applitools::AccessibilityRegionType.enum_values.join(', ')}]"
         | 
| 8 | 
            +
                    if args.empty?
         | 
| 9 | 
            +
                      reset_ignore
         | 
| 10 | 
            +
                    else
         | 
| 11 | 
            +
                      value = convert_to_universal(args)
         | 
| 12 | 
            +
                      value = { type: args[0], selector: args[1] } if value.nil?
         | 
| 13 | 
            +
                      # value = value[:selector] if value.is_a?(Hash) && (value[:type].to_s === 'id') && !is_a?(Applitools::Appium::Target)
         | 
| 14 | 
            +
                      ignored_regions << value
         | 
| 137 15 | 
             
                    end
         | 
| 138 | 
            -
             | 
| 139 | 
            -
                    accessibility_regions << case args.first
         | 
| 140 | 
            -
                                             when ::Selenium::WebDriver::Element
         | 
| 141 | 
            -
                                               element = args.first
         | 
| 142 | 
            -
                                               Applitools::AccessibilityRegion.new(
         | 
| 143 | 
            -
                                                 element,
         | 
| 144 | 
            -
                                                 options[:type]
         | 
| 145 | 
            -
                                               )
         | 
| 146 | 
            -
                                             when Applitools::Region
         | 
| 147 | 
            -
                                               result = Applitools::AccessibilityRegion.new(
         | 
| 148 | 
            -
                                                   args.first, options[:type]
         | 
| 149 | 
            -
                                               )
         | 
| 150 | 
            -
                                               if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
         | 
| 151 | 
            -
                                                 def result.converted?
         | 
| 152 | 
            -
                                                   true
         | 
| 153 | 
            -
                                                 end
         | 
| 154 | 
            -
                                               end
         | 
| 155 | 
            -
                                               result
         | 
| 156 | 
            -
                                             when String
         | 
| 157 | 
            -
                                               proc do |driver|
         | 
| 158 | 
            -
                                                 element = driver.find_element(name_or_id: args.first)
         | 
| 159 | 
            -
                                                 Applitools::AccessibilityRegion.new(
         | 
| 160 | 
            -
                                                   element,
         | 
| 161 | 
            -
                                                   options[:type]
         | 
| 162 | 
            -
                                                 )
         | 
| 163 | 
            -
                                               end
         | 
| 164 | 
            -
                                             else
         | 
| 165 | 
            -
                                               proc do |driver|
         | 
| 166 | 
            -
                                                 elements = driver.find_elements(*args)
         | 
| 167 | 
            -
                                                 elements.map do |e|
         | 
| 168 | 
            -
                                                   Applitools::AccessibilityRegion.new(
         | 
| 169 | 
            -
                                                     e,
         | 
| 170 | 
            -
                                                     options[:type]
         | 
| 171 | 
            -
                                                   )
         | 
| 172 | 
            -
                                                 end
         | 
| 173 | 
            -
                                               end
         | 
| 174 | 
            -
                                             end
         | 
| 175 16 | 
             
                    self
         | 
| 176 17 | 
             
                  end
         | 
| 177 18 |  | 
| 178 | 
            -
                  def  | 
| 19 | 
            +
                  def region(*args)
         | 
| 20 | 
            +
                    value = convert_to_universal(args)
         | 
| 21 | 
            +
                    value = { type: args[0], selector: args[1] } if value.nil?
         | 
| 22 | 
            +
                    # value = value[:selector] if value.is_a?(Hash) && (value[:type].to_s === 'id') && !is_a?(Applitools::Appium::Target)
         | 
| 23 | 
            +
                    self.region_to_check = value
         | 
| 24 | 
            +
                    self.coordinate_type = Applitools::EyesScreenshot::COORDINATE_TYPES[:context_relative]
         | 
| 25 | 
            +
                    options[:timeout] = nil
         | 
| 26 | 
            +
                    reset_ignore
         | 
| 27 | 
            +
                    reset_floating
         | 
| 179 28 | 
             
                    self
         | 
| 180 29 | 
             
                  end
         | 
| 181 | 
            -
             | 
| 182 | 
            -
             | 
| 183 | 
            -
             | 
| 184 | 
            -
             | 
| 185 | 
            -
             | 
| 186 | 
            -
             | 
| 187 | 
            -
             | 
| 188 | 
            -
             | 
| 189 | 
            -
             | 
| 190 | 
            -
             | 
| 191 | 
            -
             | 
| 192 | 
            -
             | 
| 193 | 
            -
             | 
| 194 | 
            -
             | 
| 195 | 
            -
             | 
| 196 | 
            -
             | 
| 197 | 
            -
             | 
| 198 | 
            -
             | 
| 199 | 
            -
             | 
| 200 | 
            -
             | 
| 201 | 
            -
             | 
| 202 | 
            -
             | 
| 203 | 
            -
             | 
| 204 | 
            -
             | 
| 205 | 
            -
             | 
| 30 | 
            +
                # class Target
         | 
| 31 | 
            +
                #   include Applitools::FluentInterface
         | 
| 32 | 
            +
                #   attr_accessor :region_to_check, :options, :ignored_regions, :floating_regions, :layout_regions, :content_regions, :strict_regions, :accessibility_regions
         | 
| 33 | 
            +
                #
         | 
| 34 | 
            +
                #   class << self
         | 
| 35 | 
            +
                #     def window
         | 
| 36 | 
            +
                #       new
         | 
| 37 | 
            +
                #     end
         | 
| 38 | 
            +
                #
         | 
| 39 | 
            +
                #     def region(*args)
         | 
| 40 | 
            +
                #       new.region(*args)
         | 
| 41 | 
            +
                #     end
         | 
| 42 | 
            +
                #   end
         | 
| 43 | 
            +
                #
         | 
| 44 | 
            +
                #   def initialize
         | 
| 45 | 
            +
                #     self.region_to_check = proc { Applitools::Region::EMPTY }
         | 
| 46 | 
            +
                #     self.ignored_regions = []
         | 
| 47 | 
            +
                #     self.floating_regions = []
         | 
| 48 | 
            +
                #     self.layout_regions = []
         | 
| 49 | 
            +
                #     self.content_regions = []
         | 
| 50 | 
            +
                #     self.strict_regions = []
         | 
| 51 | 
            +
                #     self.accessibility_regions = []
         | 
| 52 | 
            +
                #     self.options = {}
         | 
| 53 | 
            +
                #   end
         | 
| 54 | 
            +
                #
         | 
| 55 | 
            +
                #   def region(*args)
         | 
| 56 | 
            +
                #     self.region_to_check = case args.first
         | 
| 57 | 
            +
                #                            when ::Selenium::WebDriver::Element
         | 
| 58 | 
            +
                #                              proc { args.first }
         | 
| 59 | 
            +
                #                            else
         | 
| 60 | 
            +
                #                              proc do |driver|
         | 
| 61 | 
            +
                #                                driver.find_element(*args)
         | 
| 62 | 
            +
                #                              end
         | 
| 63 | 
            +
                #                            end
         | 
| 64 | 
            +
                #     self
         | 
| 65 | 
            +
                #   end
         | 
| 66 | 
            +
                #
         | 
| 67 | 
            +
                #   def ignore(*args)
         | 
| 68 | 
            +
                #     requested_padding = if args.last.is_a? Applitools::PaddingBounds
         | 
| 69 | 
            +
                #                           args.pop
         | 
| 70 | 
            +
                #                         else
         | 
| 71 | 
            +
                #                           Applitools::PaddingBounds::ZERO_PADDING
         | 
| 72 | 
            +
                #                         end
         | 
| 73 | 
            +
                #     ignored_regions <<  case (first_argument = args.first)
         | 
| 74 | 
            +
                #                         when ::Selenium::WebDriver::Element
         | 
| 75 | 
            +
                #                           proc do
         | 
| 76 | 
            +
                #                             Applitools::Region
         | 
| 77 | 
            +
                #                               .from_location_size(first_argument.location, first_argument.size)
         | 
| 78 | 
            +
                #                               .padding(requested_padding)
         | 
| 79 | 
            +
                #                           end
         | 
| 80 | 
            +
                #                         when Applitools::Region
         | 
| 81 | 
            +
                #                           result = first_argument.padding(requested_padding)
         | 
| 82 | 
            +
                #                           if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
         | 
| 83 | 
            +
                #                             def result.converted?
         | 
| 84 | 
            +
                #                               true
         | 
| 85 | 
            +
                #                             end
         | 
| 86 | 
            +
                #                           end
         | 
| 87 | 
            +
                #                           result
         | 
| 88 | 
            +
                #                         else
         | 
| 89 | 
            +
                #                           proc do |driver|
         | 
| 90 | 
            +
                #                             element = driver.find_element(*args)
         | 
| 91 | 
            +
                #                             Applitools::Region
         | 
| 92 | 
            +
                #                               .from_location_size(element.location, element.size)
         | 
| 93 | 
            +
                #                               .padding(requested_padding)
         | 
| 94 | 
            +
                #                           end
         | 
| 95 | 
            +
                #                         end
         | 
| 96 | 
            +
                #     self
         | 
| 97 | 
            +
                #   end
         | 
| 98 | 
            +
                #
         | 
| 99 | 
            +
                #   def floating(*args)
         | 
| 100 | 
            +
                #     value = case args.first
         | 
| 101 | 
            +
                #             when Applitools::FloatingRegion
         | 
| 102 | 
            +
                #               args.first
         | 
| 103 | 
            +
                #             when Applitools::Region
         | 
| 104 | 
            +
                #               result = Applitools::FloatingRegion.any(*args)
         | 
| 105 | 
            +
                #               if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
         | 
| 106 | 
            +
                #                 def result.converted?
         | 
| 107 | 
            +
                #                   true
         | 
| 108 | 
            +
                #                 end
         | 
| 109 | 
            +
                #               end
         | 
| 110 | 
            +
                #               result
         | 
| 111 | 
            +
                #             when ::Selenium::WebDriver::Element
         | 
| 112 | 
            +
                #               args_dup = args.dup
         | 
| 113 | 
            +
                #               Applitools::FloatingRegion.any(*args_dup)
         | 
| 114 | 
            +
                #             else
         | 
| 115 | 
            +
                #               proc do |driver|
         | 
| 116 | 
            +
                #                 args_dup = args.dup
         | 
| 117 | 
            +
                #                 region = driver.find_element(args_dup.shift, args_dup.shift)
         | 
| 118 | 
            +
                #                 Applitools::FloatingRegion.any(
         | 
| 119 | 
            +
                #                     region, *args_dup
         | 
| 120 | 
            +
                #                 )
         | 
| 121 | 
            +
                #               end
         | 
| 122 | 
            +
                #             end
         | 
| 123 | 
            +
                #     floating_regions << value
         | 
| 124 | 
            +
                #     self
         | 
| 125 | 
            +
                #   end
         | 
| 126 | 
            +
                #
         | 
| 127 | 
            +
                #   def layout
         | 
| 128 | 
            +
                #     return match_level(Applitools::MatchLevel::LAYOUT) if args.empty?
         | 
| 129 | 
            +
                #     region = process_region(*args)
         | 
| 130 | 
            +
                #     layout_regions << region
         | 
| 131 | 
            +
                #   self
         | 
| 132 | 
            +
                #
         | 
| 133 | 
            +
                #   end
         | 
| 134 | 
            +
                #
         | 
| 135 | 
            +
                #   def content(*args)
         | 
| 136 | 
            +
                #     return match_level(Applitools::MatchLevel::CONTENT) if args.empty?
         | 
| 137 | 
            +
                #     region = process_region(*args)
         | 
| 138 | 
            +
                #     content_regions << region
         | 
| 139 | 
            +
                #     self
         | 
| 140 | 
            +
                #   end
         | 
| 141 | 
            +
                #
         | 
| 142 | 
            +
                #   def strict(*args)
         | 
| 143 | 
            +
                #     return match_level(Applitools::MatchLevel::STRICT) if args.empty?
         | 
| 144 | 
            +
                #     region = process_region(*args)
         | 
| 145 | 
            +
                #     strict_regions << region
         | 
| 146 | 
            +
                #     self
         | 
| 147 | 
            +
                #   end
         | 
| 148 | 
            +
                #
         | 
| 149 | 
            +
                #   def exact(*args)
         | 
| 150 | 
            +
                #     match_level(Applitools::MatchLevel::EXACT, *args)
         | 
| 151 | 
            +
                #   end
         | 
| 152 | 
            +
                #
         | 
| 153 | 
            +
                #   def accessibility(*args)
         | 
| 154 | 
            +
                #     options = Applitools::Utils.extract_options! args
         | 
| 155 | 
            +
                #     unless options[:type]
         | 
| 156 | 
            +
                #       raise Applitools::EyesError,
         | 
| 157 | 
            +
                #             'You should call Target.accessibility(region, type: type). The region_type option is required'
         | 
| 158 | 
            +
                #     end
         | 
| 159 | 
            +
                #     unless Applitools::AccessibilityRegionType.enum_values.include?(options[:type])
         | 
| 160 | 
            +
                #       raise Applitools::EyesIllegalArgument,
         | 
| 161 | 
            +
                #             "The region type should be one of [#{Applitools::AccessibilityRegionType.enum_values.join(', ')}]"
         | 
| 162 | 
            +
                #     end
         | 
| 163 | 
            +
                #
         | 
| 164 | 
            +
                #     accessibility_regions << case args.first
         | 
| 165 | 
            +
                #                              when ::Selenium::WebDriver::Element
         | 
| 166 | 
            +
                #                                element = args.first
         | 
| 167 | 
            +
                #                                Applitools::AccessibilityRegion.new(
         | 
| 168 | 
            +
                #                                  element,
         | 
| 169 | 
            +
                #                                  options[:type]
         | 
| 170 | 
            +
                #                                )
         | 
| 171 | 
            +
                #                              when Applitools::Region
         | 
| 172 | 
            +
                #                                result = Applitools::AccessibilityRegion.new(
         | 
| 173 | 
            +
                #                                    args.first, options[:type]
         | 
| 174 | 
            +
                #                                )
         | 
| 175 | 
            +
                #                                if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
         | 
| 176 | 
            +
                #                                  def result.converted?
         | 
| 177 | 
            +
                #                                    true
         | 
| 178 | 
            +
                #                                  end
         | 
| 179 | 
            +
                #                                end
         | 
| 180 | 
            +
                #                                result
         | 
| 181 | 
            +
                #                              when String
         | 
| 182 | 
            +
                #                                proc do |driver|
         | 
| 183 | 
            +
                #                                  element = driver.find_element(name_or_id: args.first)
         | 
| 184 | 
            +
                #                                  Applitools::AccessibilityRegion.new(
         | 
| 185 | 
            +
                #                                    element,
         | 
| 186 | 
            +
                #                                    options[:type]
         | 
| 187 | 
            +
                #                                  )
         | 
| 188 | 
            +
                #                                end
         | 
| 189 | 
            +
                #                              else
         | 
| 190 | 
            +
                #                                proc do |driver|
         | 
| 191 | 
            +
                #                                  elements = driver.find_elements(*args)
         | 
| 192 | 
            +
                #                                  elements.map do |e|
         | 
| 193 | 
            +
                #                                    Applitools::AccessibilityRegion.new(
         | 
| 194 | 
            +
                #                                      e,
         | 
| 195 | 
            +
                #                                      options[:type]
         | 
| 196 | 
            +
                #                                    )
         | 
| 197 | 
            +
                #                                  end
         | 
| 198 | 
            +
                #                                end
         | 
| 199 | 
            +
                #                              end
         | 
| 200 | 
            +
                #     self
         | 
| 201 | 
            +
                #   end
         | 
| 202 | 
            +
                #
         | 
| 203 | 
            +
                #   def finalize
         | 
| 204 | 
            +
                #     self
         | 
| 205 | 
            +
                #   end
         | 
| 206 | 
            +
                #
         | 
| 207 | 
            +
                #   private
         | 
| 208 | 
            +
                #
         | 
| 209 | 
            +
                #   def process_region(*args)
         | 
| 210 | 
            +
                #     r = args.first
         | 
| 211 | 
            +
                #     case r
         | 
| 212 | 
            +
                #     when ::Selenium::WebDriver::Element
         | 
| 213 | 
            +
                #       proc do |driver|
         | 
| 214 | 
            +
                #         Applitools::Region.from_location_size(r.location, r.size)
         | 
| 215 | 
            +
                #       end
         | 
| 216 | 
            +
                #     when Applitools::Region
         | 
| 217 | 
            +
                #       if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
         | 
| 218 | 
            +
                #         def r.converted?
         | 
| 219 | 
            +
                #           true
         | 
| 220 | 
            +
                #         end
         | 
| 221 | 
            +
                #       end
         | 
| 222 | 
            +
                #       r
         | 
| 223 | 
            +
                #     else
         | 
| 224 | 
            +
                #       proc do |driver|
         | 
| 225 | 
            +
                #         element = driver.find_element(*args)
         | 
| 226 | 
            +
                #         Applitools::Region.from_location_size(element.location, element.size)
         | 
| 227 | 
            +
                #       end
         | 
| 228 | 
            +
                #     end
         | 
| 229 | 
            +
                #   end
         | 
| 230 | 
            +
                #
         | 
| 206 231 | 
             
                end
         | 
| 207 232 | 
             
              end
         | 
| 208 233 | 
             
            end
         | 
| @@ -1,12 +1,19 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            module Applitools::Connectivity
         | 
| 4 | 
            -
              Proxy = Struct.new(:uri, :user, :password) do
         | 
| 4 | 
            +
              Proxy = Struct.new(:uri, :user, :password, :is_http_only) do
         | 
| 5 | 
            +
                # export type Proxy = {
         | 
| 6 | 
            +
                #   url: string
         | 
| 7 | 
            +
                #   username?: string
         | 
| 8 | 
            +
                #   password?: string
         | 
| 9 | 
            +
                #   isHttpOnly?: boolean
         | 
| 10 | 
            +
                # }
         | 
| 5 11 | 
             
                def to_hash
         | 
| 6 12 | 
             
                  result = {}
         | 
| 7 | 
            -
                  result[: | 
| 8 | 
            -
                  result[: | 
| 13 | 
            +
                  result[:url] = uri.is_a?(String) ? uri : uri.to_s
         | 
| 14 | 
            +
                  result[:username] = user unless user.nil?
         | 
| 9 15 | 
             
                  result[:password] = password unless password.nil?
         | 
| 16 | 
            +
                  result[:isHttpOnly] = !!is_http_only unless is_http_only.nil?
         | 
| 10 17 | 
             
                  result
         | 
| 11 18 | 
             
                end
         | 
| 12 19 |  | 
| @@ -19,3 +26,4 @@ module Applitools::Connectivity | |
| 19 26 | 
             
                end
         | 
| 20 27 | 
             
              end
         | 
| 21 28 | 
             
            end
         | 
| 29 | 
            +
            # U-Notes : add is_http_only/isHttpOnly flag
         | 
| @@ -167,7 +167,7 @@ module Applitools::Connectivity | |
| 167 167 | 
             
                  Oj.load(response.body)
         | 
| 168 168 | 
             
                end
         | 
| 169 169 |  | 
| 170 | 
            -
                def download_resource(url, ua_string = nil)
         | 
| 170 | 
            +
                def download_resource(url, ua_string = nil, cookies=nil)
         | 
| 171 171 | 
             
                  Applitools::EyesLogger.debug "Fetching #{url}..."
         | 
| 172 172 | 
             
                  resp_proc = proc do |u|
         | 
| 173 173 | 
             
                    faraday_connection(u, false).send(:get) do |req|
         | 
| @@ -175,6 +175,7 @@ module Applitools::Connectivity | |
| 175 175 | 
             
                      req.headers[:accept_encoding] = 'identity'
         | 
| 176 176 | 
             
                      req.headers[:accept_language] = '*'
         | 
| 177 177 | 
             
                      req.headers[:user_agent] = ua_string if ua_string
         | 
| 178 | 
            +
                      req.headers[:Cookie] = cookies.map { |h| [h[:name], h[:value]].join('=') }.join('; ') unless cookies.to_a.empty?
         | 
| 178 179 | 
             
                    end
         | 
| 179 180 | 
             
                  end
         | 
| 180 181 | 
             
                  response = resp_proc.call(url)
         | 
| @@ -309,10 +310,11 @@ module Applitools::Connectivity | |
| 309 310 | 
             
                private
         | 
| 310 311 |  | 
| 311 312 | 
             
                def faraday_connection(url, pass_user_agent_header = true)
         | 
| 313 | 
            +
                  raise Applitools::NotUniversalServerRequestError.new(url)
         | 
| 312 314 | 
             
                  Faraday.new(
         | 
| 313 315 | 
             
                    url: url,
         | 
| 314 316 | 
             
                    ssl: { ca_file: SSL_CERT },
         | 
| 315 | 
            -
                    proxy: @proxy.nil? ? nil : @proxy. | 
| 317 | 
            +
                    proxy: @proxy.nil? ? nil : {uri: @proxy.uri}
         | 
| 316 318 | 
             
                  ) do |faraday|
         | 
| 317 319 | 
             
                    if pass_user_agent_header
         | 
| 318 320 | 
             
                      faraday.use(
         | 
| @@ -42,5 +42,16 @@ module Applitools | |
| 42 42 | 
             
                def json_data
         | 
| 43 43 | 
             
                  to_h
         | 
| 44 44 | 
             
                end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                # accessibilitySettings?: {
         | 
| 47 | 
            +
                #   level?: AccessibilityLevel
         | 
| 48 | 
            +
                #   guidelinesVersion?: AccessibilityGuidelinesVersion
         | 
| 49 | 
            +
                # }
         | 
| 50 | 
            +
                def to_hash
         | 
| 51 | 
            +
                  {
         | 
| 52 | 
            +
                    level: level,
         | 
| 53 | 
            +
                    guidelinesVersion: version
         | 
| 54 | 
            +
                  }
         | 
| 55 | 
            +
                end
         | 
| 45 56 | 
             
              end
         | 
| 46 57 | 
             
            end
         | 
| @@ -4,6 +4,8 @@ require 'securerandom' | |
| 4 4 | 
             
            require 'applitools/utils/utils'
         | 
| 5 5 | 
             
            require_relative 'helpers'
         | 
| 6 6 |  | 
| 7 | 
            +
            PROCESS_DEFAULT_BATCH_ID = SecureRandom.uuid # Unique per-process
         | 
| 8 | 
            +
             | 
| 7 9 | 
             
            module Applitools
         | 
| 8 10 | 
             
              class BatchInfo
         | 
| 9 11 | 
             
                extend Helpers
         | 
| @@ -30,7 +32,7 @@ module Applitools | |
| 30 32 | 
             
                  if id
         | 
| 31 33 | 
             
                    self.id = id
         | 
| 32 34 | 
             
                  elsif self.id.nil? || self.id.empty?
         | 
| 33 | 
            -
                    self.id =  | 
| 35 | 
            +
                    self.id = PROCESS_DEFAULT_BATCH_ID
         | 
| 34 36 | 
             
                  end
         | 
| 35 37 | 
             
                  self.properties = properties if properties
         | 
| 36 38 | 
             
                  self.notify_on_completion = 'true'.casecmp(env_notify_on_completion || '') == 0 ? true : false
         | 
| @@ -47,8 +49,27 @@ module Applitools | |
| 47 49 | 
             
                  }
         | 
| 48 50 | 
             
                end
         | 
| 49 51 |  | 
| 52 | 
            +
                # export type Batch = {
         | 
| 53 | 
            +
                #   id?: string
         | 
| 54 | 
            +
                #   name?: string
         | 
| 55 | 
            +
                #   sequenceName?: string
         | 
| 56 | 
            +
                #   startedAt?: Date | string
         | 
| 57 | 
            +
                #   notifyOnCompletion?: boolean
         | 
| 58 | 
            +
                #   properties?: CustomProperty[]
         | 
| 59 | 
            +
                # }
         | 
| 60 | 
            +
                # export type CustomProperty = {
         | 
| 61 | 
            +
                #   name: string
         | 
| 62 | 
            +
                #   value: string
         | 
| 63 | 
            +
                # }
         | 
| 50 64 | 
             
                def to_hash
         | 
| 51 | 
            -
                   | 
| 65 | 
            +
                  {
         | 
| 66 | 
            +
                    id: id,
         | 
| 67 | 
            +
                    name: name, # 'Ruby Coverage Tests',
         | 
| 68 | 
            +
                    startedAt: @started_at.iso8601,
         | 
| 69 | 
            +
                    sequenceName: sequence_name,
         | 
| 70 | 
            +
                    notifyOnCompletion: notify_on_completion,
         | 
| 71 | 
            +
                    properties: properties
         | 
| 72 | 
            +
                  }.compact
         | 
| 52 73 | 
             
                end
         | 
| 53 74 |  | 
| 54 75 | 
             
                def to_s
         | 
| @@ -56,3 +77,4 @@ module Applitools | |
| 56 77 | 
             
                end
         | 
| 57 78 | 
             
              end
         | 
| 58 79 | 
             
            end
         | 
| 80 | 
            +
            # U-Notes : change 'batchSequenceName' to 'sequenceName'
         | 
| @@ -29,11 +29,18 @@ module Applitools | |
| 29 29 | 
             
                  ensure
         | 
| 30 30 | 
             
                    delete_all_batches
         | 
| 31 31 | 
             
                  end
         | 
| 32 | 
            -
                  all_test_results
         | 
| 32 | 
            +
                  return all_test_results unless all_test_results.empty?
         | 
| 33 | 
            +
                  all_universal_results = close_all_eyes
         | 
| 34 | 
            +
                  key_transformed_results = Applitools::Utils.deep_stringify_keys(all_universal_results)
         | 
| 35 | 
            +
                  key_transformed_results.map {|result| Applitools::TestResults.new(result) }
         | 
| 33 36 | 
             
                end
         | 
| 34 37 |  | 
| 35 38 | 
             
                def rendering_info(connector)
         | 
| 36 39 | 
             
                  @rendering_info ||= RenderingInfo.new(connector.rendering_info)
         | 
| 37 40 | 
             
                end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                def universal_eyes_manager_config
         | 
| 43 | 
            +
                  Applitools::UniversalEyesManagerConfig.classic
         | 
| 44 | 
            +
                end
         | 
| 38 45 | 
             
              end
         | 
| 39 46 | 
             
            end
         |