eyes_core 3.15.20 → 3.15.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8467f8105f31c3f211c69d80cbf435f8c0429db952c2333a7e4cfb42228a30dc
4
- data.tar.gz: fc2d214ad9aec9b7f0dfd49773cef6b8df1cd76fce5af71932b48ba14252b4f7
3
+ metadata.gz: b616da7b7712b298cff5e468a996761d87d7ef259911b9eddd87f0731fc6d276
4
+ data.tar.gz: c6e7ffe23b03814f8dbeca27beba13745c5d31511fefc752ee0d315bbd77d2d9
5
5
  SHA512:
6
- metadata.gz: e45b9e404641071062fd782bb99bf1cda0dbdaad9282c5b4fa92b60d331a81cb7868450055da5a0527ddda0b11357e4be0df39a54a8b9b90c22fb865b0f5ff84
7
- data.tar.gz: e91ae965b9dbf8ed1ffd4a4a30aec841e63b43b974467cf0ca715fa71c5e19d264bcf84f7e71d68523d113aa26c4487d2dd5ee4e63a53613464b19c55e20cc7f
6
+ metadata.gz: 6050f4c3e053eec882346316d7b641c6c557f0628769e0c0ce5d19fa24694e1ab8d4c7274a1e3c4e32b141f6bba9c93350566f2400c5d08f80aa433176017a07
7
+ data.tar.gz: c26f96db43adcc93511e4910b03cb0c5eb9e6e8b2d44168ed8d64417d6bd80c560bff281794cad8de560256fa091c40fe90798c01523387f2a53bff6a9bed8a4
@@ -3,20 +3,12 @@
3
3
  require 'applitools/core/helpers'
4
4
  require 'applitools/core/eyes_screenshot'
5
5
  require 'applitools/core/eyes_base_configuration'
6
+ require 'applitools/core/match_level'
6
7
  require 'zlib'
7
8
 
8
9
  require_relative 'match_level_setter'
9
10
 
10
11
  module Applitools
11
- module MatchLevel
12
- NONE = 'None'.freeze
13
- LAYOUT = 'Layout'.freeze
14
- LAYOUT2 = 'Layout2'.freeze
15
- CONTENT = 'Content'.freeze
16
- STRICT = 'Strict'.freeze
17
- EXACT = 'Exact'.freeze
18
- end
19
-
20
12
  MATCH_LEVEL = {
21
13
  none: 'None',
22
14
  layout: 'Layout',
@@ -100,7 +92,7 @@ module Applitools
100
92
  end
101
93
  end
102
94
 
103
- self.exact = nil
95
+ # self.exact = nil
104
96
  self.match_level = Applitools::MatchLevel::STRICT
105
97
  self.server_scale = 0
106
98
  self.server_remainder = 0
@@ -134,9 +126,9 @@ module Applitools
134
126
  # @option exact_options [Integer] :match_threshold
135
127
  # @return [Target] Applitools::Selenium::Target or Applitools::Images::target
136
128
 
137
- def set_default_match_settings(value, exact_options = {})
138
- (self.match_level, self.exact) = match_level_with_exact(value, exact_options)
139
- end
129
+ # def set_default_match_settings(value, exact_options = {})
130
+ # (self.match_level, self.exact) = match_level_with_exact(value, exact_options)
131
+ # end
140
132
 
141
133
  # Sets default match settings
142
134
  # @param [Hash] value
@@ -145,30 +137,29 @@ module Applitools
145
137
  # @option value [Fixnum] scale
146
138
  # @option value [Fixnum] remainder
147
139
 
148
- def default_match_settings=(value)
149
- Applitools::ArgumentGuard.is_a? value, 'value', Hash
150
- extra_keys = value.keys - match_level_keys
151
- unless extra_keys.empty?
152
- raise Applitools::EyesIllegalArgument.new(
153
- "Pasiing extra keys is prohibited! Passed extra keys: #{extra_keys}"
154
- )
155
- end
156
- result = default_match_settings.merge!(value)
157
- self.match_level = result[:match_level]
158
- self.exact = result[:exact]
159
- self.server_scale = result[:scale]
160
- self.server_remainder = result[:remainder]
161
- result
162
- end
163
-
164
- def default_match_settings
165
- {
166
- match_level: match_level,
167
- exact: exact,
168
- scale: server_scale,
169
- remainder: server_remainder
170
- }
171
- end
140
+ # def default_match_settings=(value)
141
+ # Applitools::ArgumentGuard.is_a? value, 'value', Hash
142
+ # extra_keys = value.keys - match_level_keys
143
+ # unless extra_keys.empty?
144
+ # raise Applitools::EyesIllegalArgument.new(
145
+ # "Pasiing extra keys is prohibited! Passed extra keys: #{extra_keys}"
146
+ # )
147
+ # end
148
+ # result = default_match_settings.merge!(value)
149
+ # (self.match_level, self.exact) = match_level_with_exact(result[:match_level], result[:exact])
150
+ # self.server_scale = result[:scale]
151
+ # self.server_remainder = result[:remainder]
152
+ # result
153
+ # end
154
+ #
155
+ # def default_match_settings
156
+ # {
157
+ # match_level: match_level,
158
+ # exact: exact,
159
+ # scale: server_scale,
160
+ # remainder: server_remainder
161
+ # }
162
+ # end
172
163
 
173
164
  def full_agent_id
174
165
  if !agent_id.nil? && !agent_id.empty?
@@ -519,9 +510,9 @@ module Applitools
519
510
  {}
520
511
  end
521
512
 
522
- def match_level_keys
523
- %w(match_level exact scale remainder).map(&:to_sym)
524
- end
513
+ # def match_level_keys
514
+ # %w(match_level exact scale remainder).map(&:to_sym)
515
+ # end
525
516
 
526
517
  def update_default_settings(match_data)
527
518
  match_level_keys.each do |k|
@@ -2,16 +2,23 @@ require 'applitools/core/rectangle_size'
2
2
  require 'applitools/core/session_types'
3
3
  require 'applitools/core/batch_info'
4
4
  require 'applitools/connectivity/proxy'
5
+ require 'applitools/core/match_level'
6
+ require 'applitools/core/match_level_setter'
5
7
 
6
8
  module Applitools
7
9
  class EyesBaseConfiguration < AbstractConfiguration
10
+ include Applitools::MatchLevelSetter
11
+
8
12
  DEFAULT_CONFIG = {
9
13
  branch_name: ENV['APPLITOOLS_BRANCH'] || '',
10
14
  parent_branch_name: ENV['APPLITOOLS_PARENT_BRANCH'] || '',
11
15
  baseline_branch_name: ENV['APPLITOOLS_BASELINE_BRANCH'] || '',
12
16
  save_diffs: false,
13
17
  server_url: 'https://eyessdk.applitools.com',
14
- api_key: ENV['APPLITOOLS_API_KEY'] || ''
18
+ api_key: ENV['APPLITOOLS_API_KEY'] || '',
19
+ match_level: Applitools::MatchLevel::STRICT,
20
+ scale: 0,
21
+ remainder: 0
15
22
  }.freeze
16
23
 
17
24
  class << self
@@ -94,6 +101,10 @@ module Applitools
94
101
  string_field :host_app
95
102
  object_field :proxy, Applitools::Connectivity::Proxy
96
103
  string_field :match_level
104
+ object_field :exact, Hash
105
+ int_field :scale
106
+ int_field :remainder
107
+
97
108
 
98
109
  methods_to_delegate.delete(:batch_info)
99
110
  methods_to_delegate.delete(:batch_info=)
@@ -107,11 +118,46 @@ module Applitools
107
118
  end
108
119
 
109
120
  def match_level=(value)
110
- return config_hash[:match_level] = value if Applitools::MATCH_LEVEL.values.include?(value)
121
+ return config_hash[:match_level] = value if Applitools::MatchLevel.enum_values.include?(value)
111
122
  return config_hash[:match_level] = Applitools::MATCH_LEVEL[value.to_sym] if Applitools::MATCH_LEVEL.keys.include?(value.to_sym)
112
123
  raise Applitools::EyesError, "Unknown match level #{value}"
113
124
  end
114
125
 
126
+ def set_default_match_settings(value, exact_options = {})
127
+ (self.match_level, self.exact) = match_level_with_exact(value, exact_options)
128
+ end
129
+
130
+ def default_match_settings=(value)
131
+ Applitools::ArgumentGuard.is_a? value, 'value', Hash
132
+ extra_keys = value.keys - match_level_keys
133
+ unless extra_keys.empty?
134
+ raise Applitools::EyesIllegalArgument.new(
135
+ "Pasiing extra keys is prohibited! Passed extra keys: #{extra_keys}"
136
+ )
137
+ end
138
+ result = default_match_settings.merge!(value)
139
+ (self.match_level, self.exact) = match_level_with_exact(result[:match_level], result[:exact])
140
+ self.scale = result[:scale]
141
+ self.remainder = result[:remainder]
142
+ result
143
+ end
144
+
145
+ def default_match_settings
146
+ {
147
+ match_level: match_level,
148
+ exact: exact,
149
+ scale: scale,
150
+ remainder: remainder
151
+ }
152
+ end
153
+
154
+ def match_level_keys
155
+ %w(match_level exact scale remainder).map(&:to_sym)
156
+ end
157
+
115
158
  methods_to_delegate.push(:set_proxy)
159
+ methods_to_delegate.push(:set_default_match_settings)
160
+ methods_to_delegate.push(:default_match_settings=)
161
+ methods_to_delegate.push(:default_match_settings)
116
162
  end
117
163
  end
@@ -0,0 +1,15 @@
1
+ module Applitools
2
+ module MatchLevel
3
+ extend self
4
+ NONE = 'None'.freeze
5
+ LAYOUT = 'Layout'.freeze
6
+ LAYOUT2 = 'Layout2'.freeze
7
+ CONTENT = 'Content'.freeze
8
+ STRICT = 'Strict'.freeze
9
+ EXACT = 'Exact'.freeze
10
+
11
+ def enum_values
12
+ [NONE, LAYOUT, LAYOUT2, CONTENT, STRICT, EXACT]
13
+ end
14
+ end
15
+ end
@@ -2,13 +2,19 @@
2
2
 
3
3
  module Applitools::MatchLevelSetter
4
4
  def match_level_with_exact(value, exact_options = {})
5
- raise Applitools::EyesError unless Applitools::MATCH_LEVEL.keys.include? value
6
- if value != :exact && (exact_options && !exact_options.empty?)
5
+ raise Applitools::EyesError unless Applitools::MATCH_LEVEL.keys.include?(value) | Applitools::MatchLevel.enum_values.include?(value)
6
+
7
+ if value != :exact && value != Applitools::MatchLevel::EXACT && (exact_options && !exact_options.empty?)
7
8
  raise Applitools::EyesError.new(
8
9
  'Exact options are accepted only for EXACT match level'
9
10
  )
10
11
  end
11
- [Applitools::MATCH_LEVEL[value], value == :exact ? convert_exact_options(exact_options) : nil]
12
+ match_level_value = if (Applitools::MatchLevel.enum_values.include?(value))
13
+ value
14
+ else
15
+ Applitools::MATCH_LEVEL[value]
16
+ end
17
+ [match_level_value, value == Applitools::MatchLevel::EXACT ? convert_exact_options(exact_options) : nil]
12
18
  end
13
19
 
14
20
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Applitools
4
- VERSION = '3.15.20'.freeze
4
+ VERSION = '3.15.21'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eyes_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.15.20
4
+ version: 3.15.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Applitools Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-05 00:00:00.000000000 Z
11
+ date: 2019-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oily_png
@@ -279,6 +279,7 @@ files:
279
279
  - lib/applitools/core/helpers.rb
280
280
  - lib/applitools/core/jsonable.rb
281
281
  - lib/applitools/core/location.rb
282
+ - lib/applitools/core/match_level.rb
282
283
  - lib/applitools/core/match_level_setter.rb
283
284
  - lib/applitools/core/match_result.rb
284
285
  - lib/applitools/core/match_results.rb