eyes_core 3.15.39 → 3.15.40

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f805a97cb7fa17114d70a7d22fd3c46f68a02ac2999e1560c04bb5703148948
4
- data.tar.gz: cf074dfcac6c34dc52078f28e8e41828c7471e64f05f598be4b420168fd940c5
3
+ metadata.gz: f287ee6b9af278790d07eee670dfe45e402603b4da97e2e28780351a1c2e1d9f
4
+ data.tar.gz: a542a05b7bf9c4d911bcac1ee9f456fdb7250b03c74b54ca1b455c6b08f61c19
5
5
  SHA512:
6
- metadata.gz: f5d9da3f46bca30047c4effee4dce295a83393f8a20847183ea19c322b9080fe442a982f0a750faf31d8e80ad1bedf925cd59e924a9afd666ed482426056c078
7
- data.tar.gz: 91a2e9768bec79c972cbf8b928534ac9cc7f670ef9d10ecd080cca86c948f1a318a9aa09b9ccd50101988d9250df6fc4314f37fa9f8e9b584883a4715bbd3925
6
+ metadata.gz: 4a0a95ca5cf486ff3b45c5e7560c23dc9c6df106a00aba4cfa0cca4bc85eb27c98f8f46b614b41fd29e434a669d7b16b115c2afae35e973cd708960d2b5ee1b8
7
+ data.tar.gz: 40a60b73a2db57f99c8eef611286b376d1410db5b9cb151915dc34705af358e393a0f0d6beaaf0f3c5086a9a330a0f82370cdb15de78e0f0e2dcec614d3c05b0
@@ -17,7 +17,7 @@ module Applitools::Connectivity
17
17
  API_SESSIONS_RUNNING = API_SESSIONS + '/running/'.freeze
18
18
  API_SINGLE_TEST = API_SESSIONS + '/'.freeze
19
19
 
20
- RENDER_INFO_PATH = API_SESSIONS + "/renderinfo".freeze
20
+ RENDER_INFO_PATH = API_SESSIONS + '/renderinfo'.freeze
21
21
  RENDER = '/render'.freeze
22
22
 
23
23
  RESOURCES_SHA_256 = '/resources/sha256/'.freeze
@@ -42,7 +42,9 @@ module Applitools::Connectivity
42
42
 
43
43
  def rendering_info
44
44
  response = get(server_url + RENDER_INFO_PATH, content_type: 'application/json')
45
- raise Applitools::EyesError, "Error getting render info (#{response.status}})" unless response.status == HTTP_STATUS_CODES[:ok]
45
+ unless response.status == HTTP_STATUS_CODES[:ok]
46
+ raise Applitools::EyesError, "Error getting render info (#{response.status}})"
47
+ end
46
48
  Oj.load response.body
47
49
  end
48
50
 
@@ -57,14 +59,16 @@ module Applitools::Connectivity
57
59
  },
58
60
  timeout: 10
59
61
  )
60
- raise Applitools::EyesError, "Error render processing (#{response.status}, #{response.body})" unless response.status == HTTP_STATUS_CODES[:ok]
62
+ unless response.status == HTTP_STATUS_CODES[:ok]
63
+ raise Applitools::EyesError, "Error render processing (#{response.status}, #{response.body})"
64
+ end
61
65
  Oj.load response.body
62
66
  end
63
67
 
64
68
  def render_put_resource(service_url, access_key, resource, render)
65
69
  uri = URI(service_url)
66
70
  uri.path = RESOURCES_SHA_256 + resource.hash
67
- Applitools::EyesLogger.debug("PUT resource: #{uri}")
71
+ Applitools::EyesLogger.debug("PUT resource: (#{resource.url}) - #{uri}")
68
72
  # Applitools::EyesLogger.debug("Resource content: #{resource.content}")
69
73
  response = dummy_put(
70
74
  uri,
@@ -73,9 +77,11 @@ module Applitools::Connectivity
73
77
  headers: {
74
78
  'X-Auth-Token' => access_key
75
79
  },
76
- query: {'render-id' => render['renderId']}
80
+ query: { 'render-id' => render['renderId'] }
77
81
  )
78
- raise Applitools::EyesError, "Error putting resource: #{response.status}, #{response.body}" unless response.status == HTTP_STATUS_CODES[:ok]
82
+ unless response.status == HTTP_STATUS_CODES[:ok]
83
+ raise Applitools::EyesError, "Error putting resource: #{response.status}, #{response.body}"
84
+ end
79
85
  resource.hash
80
86
  end
81
87
 
@@ -87,11 +93,14 @@ module Applitools::Connectivity
87
93
  body: running_renders_json,
88
94
  content_type: 'application/json',
89
95
  headers: {
90
- 'X-Auth-Token' => access_key
96
+ 'X-Auth-Token' => access_key
91
97
  },
92
98
  timeout: 2
93
99
  )
94
- raise Applitools::EyesError, "Error getting server status, #{response.status} #{response.body}" unless response.status == HTTP_STATUS_CODES[:ok]
100
+ unless response.status == HTTP_STATUS_CODES[:ok]
101
+ raise Applitools::EyesError, "Error getting server status, #{response.status} #{response.body}"
102
+ end
103
+
95
104
  Oj.load(response.body)
96
105
  end
97
106
 
@@ -109,7 +118,7 @@ module Applitools::Connectivity
109
118
  end
110
119
  response = resp_proc.call(url)
111
120
  redirect_count = 10
112
- while response.status == 301 && redirect_count > 0 do
121
+ while response.status == 301 && redirect_count > 0
113
122
  redirect_count -= 1
114
123
  response = resp_proc.call(response.headers['location'])
115
124
  end
@@ -126,7 +135,7 @@ module Applitools::Connectivity
126
135
  Applitools::ArgumentGuard.not_nil(batch_id, 'batch_id')
127
136
  Applitools::EyesLogger.info("Called with #{batch_id}")
128
137
  url = CLOSE_BATCH % batch_id
129
- response = delete(URI.join(endpoint_url,url))
138
+ response = delete(URI.join(endpoint_url, url))
130
139
  Applitools::EyesLogger.info "delete batch is done with #{response.status} status"
131
140
  end
132
141
 
@@ -296,9 +305,9 @@ module Applitools::Connectivity
296
305
 
297
306
  def dummy_request(url, method, options = {})
298
307
  Faraday::Connection.new(
299
- url,
300
- ssl: { ca_file: SSL_CERT },
301
- proxy: @proxy.nil? ? nil : @proxy.to_hash
308
+ url,
309
+ ssl: { ca_file: SSL_CERT },
310
+ proxy: @proxy.nil? ? nil : @proxy.to_hash
302
311
  ).send(method) do |req|
303
312
  req.options.timeout = options[:timeout] || DEFAULT_TIMEOUT
304
313
  req.headers = DEFAULT_HEADERS.merge(options[:headers] || {})
@@ -349,4 +358,3 @@ module Applitools::Connectivity
349
358
  end
350
359
  end
351
360
  end
352
-
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'applitools/core/eyes_configuration_dsl'
2
4
 
3
5
  module Applitools
@@ -15,4 +17,4 @@ module Applitools
15
17
  end
16
18
  end
17
19
  end
18
- end
20
+ end
@@ -11,4 +11,4 @@ module Applitools
11
11
  [NONE, AA, AAA]
12
12
  end
13
13
  end
14
- end
14
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'region'
2
4
 
3
5
  module Applitools
@@ -20,4 +22,4 @@ module Applitools
20
22
  super && region_type == other.region_type
21
23
  end
22
24
  end
23
- end
25
+ end
@@ -22,4 +22,4 @@ module Applitools
22
22
  ]
23
23
  end
24
24
  end
25
- end
25
+ end
@@ -1,10 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'eyes_runner'
2
4
  module Applitools
3
5
  class ClassicRunner < EyesRunner
4
6
  attr_accessor :all_test_results, :all_pending_exceptions
5
- def initialize()
7
+ def initialize
6
8
  super
7
9
  self.all_test_results = []
10
+ self.all_pending_exceptions = {}
8
11
  end
9
12
 
10
13
  def aggregate_result(test_result)
@@ -18,15 +21,15 @@ module Applitools
18
21
 
19
22
  def get_all_test_results(throw_exception = false)
20
23
  begin
21
- if false && throw_exception
24
+ if throw_exception
22
25
  all_pending_exceptions.each do |_result, exception|
23
26
  raise exception
24
27
  end
25
28
  end
26
29
  ensure
27
30
  delete_all_batches
28
- all_test_results
29
31
  end
32
+ all_test_results
30
33
  end
31
34
  end
32
- end
35
+ end
@@ -40,10 +40,8 @@ module Applitools
40
40
  # Default value is false.
41
41
  # @return [boolean] verbose_results flag
42
42
 
43
-
44
43
  # attr_accessor :agent_id, :session_type, :app_name, :test_name,
45
44
 
46
-
47
45
  attr_accessor :batch, :full_agent_id,
48
46
  :match_timeout, :save_new_tests, :save_failed_tests, :failure_reports, :default_match_settings, :cut_provider,
49
47
  :scale_ratio, :position_provider, :viewport_size, :verbose_results,
@@ -196,7 +194,7 @@ module Applitools
196
194
 
197
195
  logger.info "Agent = #{full_agent_id}"
198
196
  logger.info "openBase(app_name: #{app_name}, test_name: #{test_name}," \
199
- " viewport_size: #{viewport_size.to_s})"
197
+ " viewport_size: #{viewport_size})"
200
198
 
201
199
  raise Applitools::EyesError.new 'API key is missing! Please set it using api_key=' if
202
200
  api_key.nil? || (api_key && api_key.empty?)
@@ -459,8 +457,8 @@ module Applitools
459
457
  #
460
458
  private
461
459
 
462
- attr_accessor :running_session, :last_screenshot, :scale_provider, :session_start_info, :should_match_window_run_once_on_timeout, :app_output_provider,
463
- :failed
460
+ attr_accessor :running_session, :last_screenshot, :scale_provider, :session_start_info,
461
+ :should_match_window_run_once_on_timeout, :app_output_provider, :failed
464
462
 
465
463
  attr_reader :user_inputs, :properties
466
464
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'applitools/core/rectangle_size'
2
4
  require 'applitools/core/session_types'
3
5
  require 'applitools/core/batch_info'
@@ -14,11 +16,13 @@ module Applitools
14
16
  parent_branch_name: ENV['APPLITOOLS_PARENT_BRANCH'] || '',
15
17
  baseline_branch_name: ENV['APPLITOOLS_BASELINE_BRANCH'] || '',
16
18
  save_diffs: false,
17
- server_url: ENV['APPLITOOLS_SERVER_URL'] || ENV['bamboo_APPLITOOLS_SERVER_URL'] || 'https://eyessdk.applitools.com',
19
+ server_url: ENV['APPLITOOLS_SERVER_URL'] ||
20
+ ENV['bamboo_APPLITOOLS_SERVER_URL'] || 'https://eyessdk.applitools.com',
18
21
  api_key: ENV['APPLITOOLS_API_KEY'] || ENV['bamboo_APPLITOOLS_API_KEY'] || '',
19
22
  match_level: Applitools::MatchLevel::STRICT,
20
23
  scale: 0,
21
- remainder: 0
24
+ remainder: 0,
25
+ save_new_tests: false
22
26
  }.freeze
23
27
 
24
28
  class << self
@@ -33,7 +37,7 @@ module Applitools
33
37
  end
34
38
 
35
39
  def merge(other_config)
36
- return if self.object_id == other_config.object_id
40
+ return if object_id == other_config.object_id
37
41
  (config_keys + other_config. config_keys).uniq do |k|
38
42
  merge_key(other_config, k)
39
43
  end
@@ -41,8 +45,8 @@ module Applitools
41
45
 
42
46
  def merge_key(other_config, key)
43
47
  return unless other_config.send("defined_#{key}?")
44
- return unless self.respond_to? "#{key}="
45
- self.send("#{key}=", other_config.send(key))
48
+ return unless respond_to?("#{key}=")
49
+ send("#{key}=", other_config.send(key))
46
50
  end
47
51
 
48
52
  def config_keys
@@ -89,6 +93,7 @@ module Applitools
89
93
  string_field :agent_id
90
94
  string_field :environment_name
91
95
  boolean_field :save_diffs
96
+ boolean_field :save_new_tests
92
97
  enum_field :session_type, Applitools::SessionTypes.enum_values
93
98
  object_field :batch_info, Applitools::BatchInfo
94
99
  string_field :baseline_env_name
@@ -105,7 +110,6 @@ module Applitools
105
110
  int_field :scale
106
111
  int_field :remainder
107
112
 
108
-
109
113
  methods_to_delegate.delete(:batch_info)
110
114
  methods_to_delegate.delete(:batch_info=)
111
115
 
@@ -119,7 +123,8 @@ module Applitools
119
123
 
120
124
  def match_level=(value)
121
125
  return config_hash[:match_level] = value if Applitools::MatchLevel.enum_values.include?(value)
122
- return config_hash[:match_level] = Applitools::MATCH_LEVEL[value.to_sym] if Applitools::MATCH_LEVEL.keys.include?(value.to_sym)
126
+ return config_hash[:match_level] = Applitools::MATCH_LEVEL[value.to_sym] if
127
+ Applitools::MATCH_LEVEL.keys.include?(value.to_sym)
123
128
  raise Applitools::EyesError, "Unknown match level #{value}"
124
129
  end
125
130
 
@@ -132,7 +137,7 @@ module Applitools
132
137
  extra_keys = value.keys - match_level_keys
133
138
  unless extra_keys.empty?
134
139
  raise Applitools::EyesIllegalArgument.new(
135
- "Pasiing extra keys is prohibited! Passed extra keys: #{extra_keys}"
140
+ "Pasiing extra keys is prohibited! Passed extra keys: #{extra_keys}"
136
141
  )
137
142
  end
138
143
  result = default_match_settings.merge!(value)
@@ -160,4 +165,4 @@ module Applitools
160
165
  methods_to_delegate.push(:default_match_settings=)
161
166
  methods_to_delegate.push(:default_match_settings)
162
167
  end
163
- end
168
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Applitools
2
4
  module EyesConfigurationDSL
3
5
  def methods_to_delegate
@@ -23,11 +25,7 @@ module Applitools
23
25
 
24
26
  define_method("#{field_name}=") do |*args|
25
27
  value = args.shift
26
- if value
27
- config_hash[field_name] = true
28
- else
29
- config_hash[field_name] = false
30
- end
28
+ config_hash[field_name] = value ? true : false
31
29
  end
32
30
 
33
31
  define_method("defined_#{field_name}?") do
@@ -43,7 +41,9 @@ module Applitools
43
41
 
44
42
  define_method("#{field_name}=") do |*args|
45
43
  value = args.shift
46
- raise Applitools::EyesIllegalArgument, "Expected #{field_name} to be a String but got #{value.class} instead" unless value.is_a? String
44
+ unless value.is_a? String
45
+ raise Applitools::EyesIllegalArgument, "Expected #{field_name} to be a String but got #{value.class} instead"
46
+ end
47
47
  config_hash[field_name.to_sym] = value.freeze
48
48
  end
49
49
 
@@ -61,10 +61,12 @@ module Applitools
61
61
  end
62
62
  define_method("#{field_name}=") do |*args|
63
63
  value = args.shift
64
- raise(
64
+ unless value.is_a? klass
65
+ raise(
65
66
  Applitools::EyesIllegalArgument,
66
67
  "Expected #{klass} but got #{value.class}"
67
- ) unless value.is_a? klass
68
+ )
69
+ end
68
70
  config_hash[field_name.to_sym] = value
69
71
  end
70
72
  define_method("defined_#{field_name}?") do
@@ -104,11 +106,13 @@ module Applitools
104
106
 
105
107
  define_method("#{field_name}=") do |*args|
106
108
  value = args.shift
107
- raise(
109
+ unless available_values_array.include? value
110
+ raise(
108
111
  Applitools::EyesIllegalArgument,
109
112
  "Unknown #{field_name} #{value}. Allowed session types: " \
110
- "#{available_values_array.join(', ')}"
111
- ) unless available_values_array.include? value
113
+ "#{available_values_array.join(', ')}"
114
+ )
115
+ end
112
116
  config_hash[field_name.to_sym] = value
113
117
  end
114
118
 
@@ -117,4 +121,4 @@ module Applitools
117
121
  end
118
122
  end
119
123
  end
120
- end
124
+ end
@@ -1,13 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Applitools
2
4
  class EyesRunner
3
5
  attr_accessor :batches_server_connectors_map
4
6
 
5
- def initialize()
7
+ def initialize
6
8
  self.batches_server_connectors_map = {}
7
9
  end
8
10
 
9
11
  def add_batch(batch_id, &block)
10
- puts batch_id
11
12
  batches_server_connectors_map[batch_id] ||= block if block_given?
12
13
  end
13
14
 
@@ -15,4 +16,4 @@ module Applitools
15
16
  batches_server_connectors_map.each_value { |v| v.call if v.respond_to? :call }
16
17
  end
17
18
  end
18
- end
19
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Applitools
2
4
  class Future
3
5
  attr_accessor :result, :semaphore, :block, :thread
@@ -8,11 +10,11 @@ module Applitools
8
10
  self.semaphore = semaphore
9
11
  self.thread = Thread.new do
10
12
  begin
11
- self.result = block.call(semaphore)
13
+ self.result = yield(semaphore)
12
14
  rescue StandardError => e
13
- Applitools::EyesLogger.logger.error "Failed to execute future"
15
+ Applitools::EyesLogger.logger.error 'Failed to execute future'
14
16
  Applitools::EyesLogger.logger.error e.message
15
- Applitools::EyesLogger.logger.error e.backtrace.join( ' ')
17
+ Applitools::EyesLogger.logger.error e.backtrace.join(' ')
16
18
  end
17
19
  end
18
20
  end
@@ -22,4 +24,4 @@ module Applitools
22
24
  result
23
25
  end
24
26
  end
25
- end
27
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'oj'
2
4
  module Applitools
3
5
  module Jsonable
@@ -17,17 +19,15 @@ module Applitools
17
19
  field = args.first.to_sym
18
20
  options = { method: field }.merge! options
19
21
  json_methods[field] = options[:method]
20
- if options[:method].to_sym == field
21
- attr_accessor field
22
- ruby_style_field = Applitools::Utils.underscore(field.to_s)
23
- unless field.to_s == ruby_style_field
24
- define_method(ruby_style_field) do
25
- send(field)
26
- end
27
- define_method("#{ruby_style_field}=") do |v|
28
- send("#{field}=", v)
29
- end
30
- end
22
+ return unless options[:method].to_sym == field
23
+ attr_accessor field
24
+ ruby_style_field = Applitools::Utils.underscore(field.to_s)
25
+ return if field.to_s == ruby_style_field
26
+ define_method(ruby_style_field) do
27
+ send(field)
28
+ end
29
+ define_method("#{ruby_style_field}=") do |v|
30
+ send("#{field}=", v)
31
31
  end
32
32
  end
33
33
 
@@ -37,7 +37,7 @@ module Applitools
37
37
  end
38
38
 
39
39
  def json_data
40
- self.class.json_methods.sort.map {|k,v| [k, json_value(send(v))]}.to_h
40
+ self.class.json_methods.sort.map { |k, v| [k, json_value(send(v))] }.to_h
41
41
  end
42
42
 
43
43
  def json
@@ -49,7 +49,7 @@ module Applitools
49
49
  def json_value(value)
50
50
  case value
51
51
  when Hash
52
- value.map { |k,v| [k, json_value(v)] }.sort {|a,b| a.first.to_s <=> b.first.to_s}.to_h
52
+ value.map { |k, v| [k, json_value(v)] }.sort { |a, b| a.first.to_s <=> b.first.to_s }.to_h
53
53
  when Array
54
54
  value.map { |el| json_value(el) }
55
55
  else
@@ -57,4 +57,4 @@ module Applitools
57
57
  end
58
58
  end
59
59
  end
60
- end
60
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: false
2
+
1
3
  module Applitools
2
4
  module MatchLevel
3
5
  extend self
@@ -12,4 +14,4 @@ module Applitools
12
14
  [NONE, LAYOUT, LAYOUT2, CONTENT, STRICT, EXACT]
13
15
  end
14
16
  end
15
- end
17
+ end
@@ -2,14 +2,15 @@
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) | Applitools::MatchLevel.enum_values.include?(value)
5
+ raise Applitools::EyesError unless
6
+ Applitools::MATCH_LEVEL.keys.include?(value) | Applitools::MatchLevel.enum_values.include?(value)
6
7
 
7
8
  if value != :exact && value != Applitools::MatchLevel::EXACT && (exact_options && !exact_options.empty?)
8
9
  raise Applitools::EyesError.new(
9
10
  'Exact options are accepted only for EXACT match level'
10
11
  )
11
12
  end
12
- match_level_value = if (Applitools::MatchLevel.enum_values.include?(value))
13
+ match_level_value = if Applitools::MatchLevel.enum_values.include?(value)
13
14
  value
14
15
  else
15
16
  Applitools::MATCH_LEVEL[value]
@@ -49,7 +49,8 @@ module Applitools
49
49
  'IgnoreMismatch' => false,
50
50
  'Trim' => {
51
51
  'Enabled' => false
52
- }
52
+ },
53
+ 'RenderId' => ''
53
54
  },
54
55
  'Id' => nil,
55
56
  'UserInputs' => [],
@@ -64,7 +65,8 @@ module Applitools
64
65
  'Y' => 0
65
66
  }
66
67
  },
67
- 'Tag' => nil
68
+ 'Tag' => nil,
69
+ 'RenderId' => ''
68
70
  }
69
71
  end
70
72
 
@@ -222,6 +224,15 @@ module Applitools
222
224
  current_data['Options']['ImageMatchSettings']['IgnoreDisplacements'] = value
223
225
  end
224
226
 
227
+ def render_id
228
+ current_data['Options']['RenderId']
229
+ end
230
+
231
+ def render_id=(value)
232
+ current_data['Options']['RenderId'] = value
233
+ current_data['RenderId'] = value
234
+ end
235
+
225
236
  def exact=(value)
226
237
  raise Applitools::EyesError.new('You should pass a hash as a value!') unless value.nil? || value.is_a?(Hash)
227
238
  return current_data['Options']['ImageMatchSettings']['Exact'] = nil if value.nil?
@@ -413,25 +424,25 @@ module Applitools
413
424
  def to_hash
414
425
  if @need_convert_accessibility_regions_coordinates
415
426
  raise Applitools::EyesError.new(
416
- 'You should convert coordinates for content_regions!'
427
+ 'You should convert coordinates for content_regions!'
417
428
  )
418
429
  end
419
430
 
420
431
  if @need_convert_content_regions_coordinates
421
432
  raise Applitools::EyesError.new(
422
- 'You should convert coordinates for content_regions!'
433
+ 'You should convert coordinates for content_regions!'
423
434
  )
424
435
  end
425
436
 
426
437
  if @need_convert_strict_regions_coordinates
427
438
  raise Applitools::EyesError.new(
428
- 'You should convert coordinates for strict_regions!'
439
+ 'You should convert coordinates for strict_regions!'
429
440
  )
430
441
  end
431
442
 
432
443
  if @need_convert_layout_regions_coordinates
433
444
  raise Applitools::EyesError.new(
434
- 'You should convert coordinates for layout_regions!'
445
+ 'You should convert coordinates for layout_regions!'
435
446
  )
436
447
  end
437
448
 
@@ -58,6 +58,7 @@ module Applitools
58
58
  end
59
59
 
60
60
  def square
61
+ return 0 if width.nil? || height.nil?
61
62
  width * height
62
63
  end
63
64
 
@@ -72,6 +73,10 @@ module Applitools
72
73
  def to_hash
73
74
  to_h
74
75
  end
76
+
77
+ def empty?
78
+ square.zero?
79
+ end
75
80
  end
76
81
  # rubocop:enable Metrics/BlockLength
77
82
  end
@@ -105,6 +105,10 @@ module Applitools
105
105
  self.class.sub_regions_with_varying_size self, subregion_size
106
106
  end
107
107
 
108
+ def [](value)
109
+ send value if respond_to? value
110
+ end
111
+
108
112
  def to_hash
109
113
  {
110
114
  x: left,
@@ -116,7 +120,7 @@ module Applitools
116
120
  }
117
121
  end
118
122
 
119
- alias :json_data :to_hash
123
+ alias json_data to_hash
120
124
 
121
125
  def to_s
122
126
  "(#{left}, #{top}), #{width} x #{height}"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Applitools
2
4
  module SessionTypes
3
5
  extend self
@@ -8,4 +10,4 @@ module Applitools
8
10
  [SEQUENTIAL, PROGRESSION]
9
11
  end
10
12
  end
11
- end
13
+ end
@@ -1,13 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Applitools
2
4
  class TestResultSummary
3
-
4
5
  attr_accessor :results, :passed, :unresolved, :failed, :exceptions, :mismatches, :missing, :matches
5
6
  def initialize(results)
6
7
  Applitools::ArgumentGuard.is_a?(results, 'results', Array)
7
8
  results.each_with_index do |r, i|
8
9
  Applitools::ArgumentGuard.is_a?(r, "results[#{i}]", Applitools::TestResults)
9
10
  end
10
-
11
11
  end
12
12
  end
13
- end
13
+ end
@@ -260,7 +260,8 @@ module Applitools::Utils
260
260
  end
261
261
 
262
262
  def set_transforms(executor, value)
263
- root_element = executor.browser.running_browser_name == :internet_explorer ? 'document.body' : 'document.documentElement'
263
+ root_element =
264
+ executor.browser.running_browser_name == :internet_explorer ? 'document.body' : 'document.documentElement'
264
265
  script = value.keys.map do |k|
265
266
  JS_SET_TRANSFORM_VALUE % {
266
267
  element: root_element,
@@ -78,7 +78,7 @@ module Applitools::Utils
78
78
  when Array
79
79
  value.map { |el| stringify_for_hash(el) }.join('')
80
80
  when Hash
81
- value.keys.sort { |a, b| b.to_s <=> a.to_s }.map { |k| "#{k}#{stringify_for_hash(value[k])}"}.join('')
81
+ value.keys.sort { |a, b| b.to_s <=> a.to_s }.map { |k| "#{k}#{stringify_for_hash(value[k])}" }.join('')
82
82
  else
83
83
  value.to_s
84
84
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Applitools
4
- VERSION = '3.15.39'.freeze
4
+ VERSION = '3.15.40'.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.39
4
+ version: 3.15.40
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-11-06 00:00:00.000000000 Z
11
+ date: 2019-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oily_png