eyes_selenium 3.17.6 → 3.17.7

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: e81278b147df24895ba9b7ca6182a8c709c8e64df2c5abc74e5f834260825aed
4
- data.tar.gz: 1dc8b2beaa8b84b39d5e7663f897ea6bdf43ed7b7e3769955f20dbb3df6348e2
3
+ metadata.gz: d1e1cc6d5f14b8764c463018f3f808431682bb3cb7feedacc1c4d078c8bf2856
4
+ data.tar.gz: 695298fd561d6c9a9736f16358135a3805417e18190daf6d9e349d47cc18a9db
5
5
  SHA512:
6
- metadata.gz: b8190f7ef1c3bbc79d5e99b9c46cbfe1a209267349ca787f76cab54c1297d414efbe8de2fd1c35fdfcff6f8f6a66436619b58f274be4a6edb913db26f92d6b41
7
- data.tar.gz: aab5775f889d219b99e0d01080e1fcd381f7e9b1f363ffbc23287b713561d62f54d6ca3bcd9b42522937872d5d53ab39239516b395e3988a37d5f08b7010652b
6
+ metadata.gz: ac8f4829d35af73da8fbd52bf3fec733d8231575d8c8721c9fffc9ae23a22fcc3af3ddce45f90c0ec024dfb2202ac3bcb59201bcc54bcde3c60894e1618080bc
7
+ data.tar.gz: 02ba588e928af04592b2bdffa57be76adc4c19d235d63649e82f3fc46e707fa4afa8fff65665e2aee77c8e49a3da2c8c3a88972be0edea01b77d154f3fad1693
@@ -21,7 +21,7 @@ module Applitools
21
21
 
22
22
  attr_accessor :element, :frames, :region_to_check, :coordinate_type, :options, :ignored_regions,
23
23
  :floating_regions, :frame_or_element, :regions, :layout_regions, :content_regions,
24
- :strict_regions, :accessibility_regions
24
+ :strict_regions, :accessibility_regions, :convert_coordinates_block
25
25
 
26
26
  private :frame_or_element, :frame_or_element=
27
27
 
@@ -33,6 +33,7 @@ module Applitools
33
33
  script_hooks: { beforeCaptureScreenshot: '' }
34
34
  }
35
35
  self.regions = {}
36
+ self.convert_coordinates_block = nil
36
37
  reset_for_fullscreen
37
38
  end
38
39
 
@@ -374,6 +375,10 @@ module Applitools
374
375
  nil
375
376
  end
376
377
 
378
+ def convert_coordinates(&block)
379
+ self.convert_coordinates_block = block
380
+ end
381
+
377
382
  private
378
383
 
379
384
  def reset_for_fullscreen
@@ -54,7 +54,6 @@ module Applitools
54
54
  logger.error "Error retrieving coordinates for region #{e.region}"
55
55
  logger.error e.message
56
56
  end
57
-
58
57
  check_result = check_window_base(
59
58
  dummy_region_provider, timeout, match_data
60
59
  )
@@ -3,6 +3,15 @@
3
3
  module Applitools
4
4
  module Selenium
5
5
  class VgMatchWindowData < Applitools::MatchWindowData
6
+ CONVERT_COORDINATES = proc do |region, selector_regions|
7
+ begin
8
+ offset_region = selector_regions.last
9
+ new_location = region.location.offset_negative(Applitools::Location.new(offset_region['x'].to_i, offset_region['y'].to_i))
10
+ region.location = new_location
11
+ rescue
12
+ Applitools::EyesLogger.error("Failed to convert coordinates for #{region}")
13
+ end
14
+ end
6
15
  class RegionCoordinatesError < ::Applitools::EyesError
7
16
  attr_accessor :region
8
17
  def initialize(region, message)
@@ -109,7 +118,11 @@ module Applitools
109
118
  region = selector_regions[target.regions[region]]
110
119
  raise RegionCoordinatesError.new(r, region['error']) if region['error']
111
120
  retrieved_region = Applitools::Region.new(region['x'], region['y'], region['width'], region['height'])
112
- result_region = r.padding_proc.call(retrieved_region) if r.padding_proc.is_a? Proc
121
+ result_region = if r.padding_proc.is_a? Proc
122
+ r.padding_proc.call(retrieved_region)
123
+ else
124
+ retrieved_region
125
+ end
113
126
  result << result_region
114
127
  end
115
128
  end
@@ -118,36 +131,54 @@ module Applitools
118
131
 
119
132
  def convert_ignored_regions_coordinates
120
133
  return unless @need_convert_ignored_regions_coordinates
134
+ if target.convert_coordinates_block.is_a?(Proc)
135
+ @ignored_regions.each { |r| target.convert_coordinates_block.call(r, selector_regions)}
136
+ end
121
137
  self.ignored_regions = @ignored_regions.map(&:with_padding).map(&:to_hash)
122
138
  @need_convert_ignored_regions_coordinates = false
123
139
  end
124
140
 
125
141
  def convert_floating_regions_coordinates
126
142
  return unless @need_convert_floating_regions_coordinates
143
+ if target.convert_coordinates_block.is_a?(Proc)
144
+ @floating_regions.each { |r| target.convert_coordinates_block.call(r, selector_regions)}
145
+ end
127
146
  self.floating_regions = @floating_regions
128
147
  @need_convert_floating_regions_coordinates = false
129
148
  end
130
149
 
131
150
  def convert_layout_regions_coordinates
132
151
  return unless @need_convert_layout_regions_coordinates
152
+ if target.convert_coordinates_block.is_a?(Proc)
153
+ @layout_regions.each { |r| target.convert_coordinates_block.call(r, selector_regions)}
154
+ end
133
155
  self.layout_regions = @layout_regions
134
156
  @need_convert_layout_regions_coordinates = false
135
157
  end
136
158
 
137
159
  def convert_strict_regions_coordinates
138
160
  return unless @need_convert_strict_regions_coordinates
161
+ if target.convert_coordinates_block.is_a?(Proc)
162
+ @strict_regions.each { |r| target.convert_coordinates_block.call(r, selector_regions)}
163
+ end
139
164
  self.strict_regions = @strict_regions
140
165
  @need_convert_strict_regions_coordinates = false
141
166
  end
142
167
 
143
168
  def convert_content_regions_coordinates
144
169
  return unless @need_convert_content_regions_coordinates
170
+ if target.convert_coordinates_block.is_a?(Proc)
171
+ @content_regions.each { |r| target.convert_coordinates_block.call(r, selector_regions)}
172
+ end
145
173
  self.content_regions = @content_regions
146
174
  @need_convert_content_regions_coordinates = false
147
175
  end
148
176
 
149
177
  def convert_accessibility_regions_coordinates
150
178
  return unless @need_convert_accessibility_regions_coordinates
179
+ if target.convert_coordinates_block.is_a?(Proc)
180
+ @accessibility_regions.each { |r| target.convert_coordinates_block.call(r, selector_regions)}
181
+ end
151
182
  self.accessibility_regions = @accessibility_regions
152
183
  @need_convert_accessibility_regions_coordinates = false
153
184
  end
@@ -154,6 +154,7 @@ module Applitools
154
154
  mod = Digest::SHA2.hexdigest(script_thread_result[:script_result])
155
155
 
156
156
  region_x_paths = get_regions_x_paths(target_to_check)
157
+
157
158
  render_task = RenderTask.new(
158
159
  "Render #{config.short_description} - #{tag}",
159
160
  script_thread_result[:result]['value'],
@@ -169,6 +170,10 @@ module Applitools
169
170
  )
170
171
  end
171
172
 
173
+ if size_mod == 'selector'
174
+ target_to_check.convert_coordinates(&Applitools::Selenium::VgMatchWindowData::CONVERT_COORDINATES)
175
+ end
176
+
172
177
  title = begin
173
178
  driver.title
174
179
  rescue StandardError => e
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Applitools
4
- VERSION = '3.17.6'.freeze
4
+ VERSION = '3.17.7'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eyes_selenium
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.17.6
4
+ version: 3.17.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Applitools Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-16 00:00:00.000000000 Z
11
+ date: 2020-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eyes_core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.17.6
19
+ version: 3.17.7
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.17.6
26
+ version: 3.17.7
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: selenium-webdriver
29
29
  requirement: !ruby/object:Gem::Requirement