eyes_core 3.15.35 → 3.15.36

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: 8caebc0e5dcc9674a057eafc8b94526b1fe5474116941cef3c739d43ea75ae3a
4
- data.tar.gz: 3dbcee8777b44102d749caf42cf1d62986b4c6fbef2122a9344d1b7c445cadc0
3
+ metadata.gz: e83ac161c7c438799a4d6d8a5179d6444b3e2fa0b2c9514008a442803d864ff6
4
+ data.tar.gz: 6adcc0d17224d03b32bf26158d47feb3e85aa92c188c2e7527628e791382ddd2
5
5
  SHA512:
6
- metadata.gz: 1759415ac403bb615a61585d429d26511edf656728186c94b45227f780a3d656ce5aa0b1cf8f8a91b4490874f95223a27bfda2928f8053dae82d775dc32087c1
7
- data.tar.gz: b51243ce7a727827d17d856613f13bc0d626565c6b7e1f897dd5ce60a0b72f86b0dd81b19ed0b1b9d02c34e0e2c3aca48f6c7d1047c81105bbf24bc657dcbf44
6
+ metadata.gz: 6a7eb31c2124376db45cadaa7cfb0efe9ba5cee9181139143254bf733480a0a08a09995d25a62ccc0202f63ae5596f2ed470d386d164d99b35f16030a33bcb91
7
+ data.tar.gz: b2a46e55eda62ff8845cddc7995da6f3cc5642eef6481a0e9ebe73f3636269aa429e938ed51d74706a1e84e0a870c9f23168483f809e490c3c8199b823afb2e8
@@ -140,6 +140,7 @@ module Applitools::Connectivity
140
140
 
141
141
  def match_window(session, data)
142
142
  # Notice that this does not include the screenshot.
143
+ puts data.to_hash
143
144
  json_data = Oj.dump(Applitools::Utils.camelcase_hash_keys(data.to_hash)).force_encoding('BINARY')
144
145
  body = [json_data.length].pack('L>') + json_data + data.screenshot
145
146
  Applitools::EyesLogger.debug 'Sending match data...'
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Applitools
4
+ module AccessibilityLevel
5
+ extend self
6
+ NONE = 'None'
7
+ AA = 'AA'
8
+ AAA = 'AAA'
9
+
10
+ def enum_values
11
+ [NONE, AA, AAA]
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,23 @@
1
+ require_relative 'region'
2
+
3
+ module Applitools
4
+ class AccessibilityRegion < ::Applitools::Region
5
+ attr_accessor :region_type
6
+ def initialize(element, region_type)
7
+ super(element.location.x, element.location.y, element.size.width, element.size.height)
8
+ self.region_type = region_type
9
+ end
10
+
11
+ def to_hash
12
+ super.merge(type: region_type)
13
+ end
14
+
15
+ def with_padding
16
+ self
17
+ end
18
+
19
+ def ==(other)
20
+ super && region_type == other.region_type
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Applitools
4
+ module AccessibilityRegionType
5
+ extend self
6
+
7
+ NONE = 'None'
8
+ IGNORE_CONTRAST = 'IgnoreContrast'
9
+ REGULAR_TEXT = 'RegularText'
10
+ LARGE_TEXT = 'LargeText'
11
+ BOLD_TEXT = 'BoldText'
12
+ GRAPHICAL_OBJECT = 'GraphicalObject'
13
+
14
+ def enum_values
15
+ [
16
+ NONE,
17
+ IGNORE_CONTRAST,
18
+ REGULAR_TEXT,
19
+ LARGE_TEXT,
20
+ BOLD_TEXT,
21
+ GRAPHICAL_OBJECT
22
+ ]
23
+ end
24
+ end
25
+ end
@@ -35,12 +35,22 @@ module Applitools
35
35
  def convert_region_location(region, from, to)
36
36
  Applitools::ArgumentGuard.not_nil region, 'region'
37
37
  Applitools::ArgumentGuard.is_a? region, 'region', Applitools::Region
38
- return Region.new(0, 0, 0, 0) if region.empty?
38
+ if region.empty?
39
+ return region.dup.tap do |r|
40
+ r.left = 0
41
+ r.top = 0
42
+ r.width = 0
43
+ r.height = 0
44
+ end
45
+ end
39
46
  Applitools::ArgumentGuard.not_nil from, 'from'
40
47
  Applitools::ArgumentGuard.not_nil to, 'to'
41
48
 
42
49
  updated_location = convert_location(region.location, from, to)
43
- Region.new updated_location.x, updated_location.y, region.width, region.height
50
+ region.dup.tap do |r|
51
+ r.left = updated_location.x
52
+ r.top = updated_location.y
53
+ end
44
54
  end
45
55
 
46
56
  private
@@ -19,11 +19,13 @@ module Applitools
19
19
  'Name' => nil,
20
20
  'UserInputs' => [],
21
21
  'ImageMatchSettings' => {
22
+ 'accessibilityLevel' => 'None',
22
23
  'MatchLevel' => 'Strict',
23
24
  'SplitTopHeight' => 0,
24
25
  'SplitBottomHeight' => 0,
25
26
  'IgnoreCaret' => true,
26
27
  'IgnoreDisplacements' => false,
28
+ 'Accessibility' => [],
27
29
  'Ignore' => [],
28
30
  'Floating' => [],
29
31
  'Layout' => [],
@@ -86,6 +88,7 @@ module Applitools
86
88
  @need_convert_strict_regions_coordinates = false
87
89
  @need_convert_content_regions_coordinates = false
88
90
  @need_convert_layout_regions_coordinates = false
91
+ @need_convert_accessibility_regions_coordinates = false
89
92
  end
90
93
 
91
94
  def screenshot
@@ -145,6 +148,13 @@ module Applitools
145
148
  end
146
149
  end
147
150
 
151
+ def accessibility_regions=(value)
152
+ Applitools::ArgumentGuard.is_a? value, 'value', Array
153
+ value.each do |r|
154
+ current_data['Options']['ImageMatchSettings']['Accessibility'] << r.to_hash if self.class.valid_region(r)
155
+ end
156
+ end
157
+
148
158
  def app_output=(value)
149
159
  Applitools::ArgumentGuard.is_a? value, 'value', Applitools::AppOutputWithScreenshot
150
160
  @app_output = value
@@ -267,9 +277,33 @@ module Applitools
267
277
  @content_regions = obtain_regions_coordinates(target.content_regions, driver)
268
278
  @need_convert_content_regions_coordinates = true unless @content_regions.empty?
269
279
  end
280
+
281
+ if target.respond_to? :accessibility_regions
282
+ @accessibility_regions = obtain_accessibility_regions_coordinates(target.accessibility_regions, driver)
283
+ @need_convert_accessibility_regions_coordinates = true unless @accessibility_regions.empty?
284
+ end
270
285
  target
271
286
  end
272
287
 
288
+ def obtain_accessibility_regions_coordinates(regions, driver)
289
+ result = []
290
+ regions.each do |r|
291
+ case r
292
+ when Proc
293
+ region_or_regions = r.call(driver)
294
+ case region_or_regions
295
+ when Array
296
+ result.concat(region_or_regions)
297
+ when Applitools::AccessibilityRegion
298
+ result << region_or_regions
299
+ end
300
+ else
301
+ raise Applitools::EyesError, 'Error getting accessibility_regions coordinates'
302
+ end
303
+ end
304
+ result
305
+ end
306
+
273
307
  def obtain_regions_coordinates(regions, driver)
274
308
  result = []
275
309
  regions.each do |r|
@@ -306,6 +340,14 @@ module Applitools
306
340
  current_data['Options']['ImageMatchSettings']['IgnoreCaret'] = value
307
341
  end
308
342
 
343
+ def accessibility_validation
344
+ current_data['Options']['ImageMatchSettings']['AccessibilityLevel']
345
+ end
346
+
347
+ def accessibility_validation=(value)
348
+ current_data['Options']['ImageMatchSettings']['AccessibilityLevel'] = value
349
+ end
350
+
309
351
  def convert_ignored_regions_coordinates
310
352
  return unless @need_convert_ignored_regions_coordinates
311
353
  self.ignored_regions = convert_regions_coordinates(@ignored_regions)
@@ -333,6 +375,12 @@ module Applitools
333
375
  @need_convert_content_regions_coordinates = false
334
376
  end
335
377
 
378
+ def convert_accessibility_regions_coordinates
379
+ return unless @need_convert_accessibility_regions_coordinates
380
+ self.accessibility_regions = convert_regions_coordinates(@accessibility_regions)
381
+ @need_convert_accessibility_regions_coordinates = false
382
+ end
383
+
336
384
  def convert_regions_coordinates(regions)
337
385
  regions.dup.map { |r| self.class.convert_coordinates(r, app_output.screenshot) } unless app_output.screenshot.nil?
338
386
  end
@@ -363,6 +411,12 @@ module Applitools
363
411
  end
364
412
 
365
413
  def to_hash
414
+ if @need_convert_accessibility_regions_coordinates
415
+ raise Applitools::EyesError.new(
416
+ 'You should convert coordinates for content_regions!'
417
+ )
418
+ end
419
+
366
420
  if @need_convert_content_regions_coordinates
367
421
  raise Applitools::EyesError.new(
368
422
  'You should convert coordinates for content_regions!'
@@ -47,6 +47,7 @@ module Applitools
47
47
  match_window_data.convert_layout_regions_coordinates
48
48
  match_window_data.convert_strict_regions_coordinates
49
49
  match_window_data.convert_content_regions_coordinates
50
+ match_window_data.convert_accessibility_regions_coordinates
50
51
  match_result = perform_match(match_window_data)
51
52
  else
52
53
  passed_ignore_mismatch = match_window_data.ignore_mismatch
@@ -57,6 +58,7 @@ module Applitools
57
58
  match_window_data.convert_layout_regions_coordinates
58
59
  match_window_data.convert_strict_regions_coordinates
59
60
  match_window_data.convert_content_regions_coordinates
61
+ match_window_data.convert_accessibility_regions_coordinates
60
62
  match_window_data.ignore_mismatch = true
61
63
  start = Time.now
62
64
  match_result = perform_match(match_window_data)
@@ -77,6 +79,7 @@ module Applitools
77
79
  match_window_data.convert_layout_regions_coordinates
78
80
  match_window_data.convert_strict_regions_coordinates
79
81
  match_window_data.convert_content_regions_coordinates
82
+ match_window_data.convert_accessibility_regions_coordinates
80
83
  match_window_data.ignore_mismatch = true
81
84
  match_result = perform_match(match_window_data)
82
85
  retry_time = Time.now - start
@@ -90,6 +93,7 @@ module Applitools
90
93
  match_window_data.convert_layout_regions_coordinates
91
94
  match_window_data.convert_strict_regions_coordinates
92
95
  match_window_data.convert_content_regions_coordinates
96
+ match_window_data.convert_accessibility_regions_coordinates
93
97
  match_window_data.ignore_mismatch = passed_ignore_mismatch
94
98
  match_result = perform_match(match_window_data)
95
99
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'argument_guard'
3
4
  module Applitools
4
5
  class PaddingBounds
5
6
  attr_accessor :padding_left, :padding_top, :padding_right, :padding_bottom
@@ -42,6 +42,14 @@ module Applitools
42
42
  original_results['isAborted']
43
43
  end
44
44
 
45
+ def api_session_url
46
+ original_results['apiUrls']['session']
47
+ end
48
+
49
+ def secret_token
50
+ original_results['secretToken']
51
+ end
52
+
45
53
  def ==(other)
46
54
  if other.is_a? self.class
47
55
  result = true
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Applitools
4
- VERSION = '3.15.35'.freeze
4
+ VERSION = '3.15.36'.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.35
4
+ version: 3.15.36
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-09-16 00:00:00.000000000 Z
11
+ date: 2019-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oily_png
@@ -259,6 +259,9 @@ files:
259
259
  - lib/applitools/connectivity/server_connector.rb
260
260
  - lib/applitools/core/abstract_configuration.rb
261
261
  - lib/applitools/core/abstract_region.rb
262
+ - lib/applitools/core/accessibility_level.rb
263
+ - lib/applitools/core/accessibility_region.rb
264
+ - lib/applitools/core/accessibility_region_type.rb
262
265
  - lib/applitools/core/app_environment.rb
263
266
  - lib/applitools/core/app_output.rb
264
267
  - lib/applitools/core/app_output_with_screenshot.rb