eyes_selenium 3.5.4 → 3.6.4

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
  SHA1:
3
- metadata.gz: 7ecd05304907f838ab10bde703febf1503ec173f
4
- data.tar.gz: e4556c4df183806a9e107c6906ca74c097fe426e
3
+ metadata.gz: 30fb1a9d398f42edc43b8f3b6d32a39f844b4941
4
+ data.tar.gz: c112d73ecafabae62c6f06338104c53d1af1c2b5
5
5
  SHA512:
6
- metadata.gz: a50b765b3d3319cb007712ac2b8bd9c823faffd6aeed745ef5ce6f22eb6e8f0798e85eb47423bc698c12a80f805c18770ee0c72ed939bc41d0b49bbead8aebc6
7
- data.tar.gz: aad5dc13c8e202295e4f0c71a281316f70e709f4ee2e09da5931eae71bf029b14cc4ef0d0f99797b45f46efff50d0178f9b859545871bc3e6caca9a57709e6de
6
+ metadata.gz: 9a3f134e50c08325fcace7d6dbb728247e051086f15ffe37079c2a8cc7b6dca278ba229b985e2d255524e1b8cb384882d1e88ce1c6828b121bdc1a422712115a
7
+ data.tar.gz: 0f0e2f9ecaf9f0ff912a32f28ce2240373fdeb953f7bbd4af46c2395321575ce74e25efee7dc879b35132583408cbe292428fd77a792afb7393561073ca73118
@@ -6,10 +6,12 @@ module Applitools::Selenium
6
6
 
7
7
  attr_accessor :last_state_position
8
8
 
9
- def initialize(executor, disable_horizontal = false, disable_vertical = false)
9
+ def initialize(executor, disable_horizontal = false, disable_vertical = false, max_width: nil, max_height: nil)
10
10
  self.executor = executor
11
11
  self.disable_horizontal = disable_horizontal
12
12
  self.disable_vertical = disable_vertical
13
+ self.max_width = max_width
14
+ self.max_height = max_height
13
15
  end
14
16
 
15
17
  def current_position
@@ -48,16 +50,19 @@ module Applitools::Selenium
48
50
 
49
51
  def entire_size
50
52
  viewport_size = Applitools::Utils::EyesSeleniumUtils.extract_viewport_size(executor)
51
- e_size = Applitools::Utils::EyesSeleniumUtils.current_frame_content_entire_size(executor)
52
- logger.info "Entire size: #{e_size}"
53
- e_size.width = viewport_size.width if disable_horizontal
54
- e_size.height = viewport_size.height if disable_vertical
55
- e_size
53
+ result = Applitools::Utils::EyesSeleniumUtils.current_frame_content_entire_size(executor)
54
+ logger.info "Entire size: #{result}"
55
+ result.width = viewport_size.width if disable_horizontal
56
+ result.height = viewport_size.height if disable_vertical
57
+ result.width = max_width unless max_width.nil?
58
+ result.height = max_height unless max_height.nil?
59
+ logger.info "Actual size to scroll: #{result}"
60
+ result
56
61
  end
57
62
 
58
63
  private
59
64
 
60
- attr_accessor :executor, :disable_horizontal, :disable_vertical
65
+ attr_accessor :executor, :disable_horizontal, :disable_vertical, :max_width, :max_height
61
66
 
62
67
  def get_position_from_transform(transform)
63
68
  regexp = /^translate\(\s*(\-?)(\d+)px,\s*(\-?)(\d+)px\s*\)/
@@ -71,10 +71,13 @@ module Applitools::Selenium
71
71
  # When :CSS - SDK will use CSS transitions to perform scrolling, otherwise it will use Javascript
72
72
  # window.scroll_to() function for scrolling purposes
73
73
  # @return [boolean] stitch_mode (:CSS or :SCROLL)
74
+ # @!attribute [Applitools::RectangleSize] explicit_entire_size
75
+ # May be set to an Applitools::RectangleSize instance or +nil+ (default).
76
+ # @return [Applitools::RectangleSize] explicit_entire_size
74
77
 
75
78
  attr_accessor :base_agent_id, :screenshot, :force_full_page_screenshot, :hide_scrollbars,
76
79
  :wait_before_screenshots, :debug_screenshot, :stitch_mode, :disable_horizontal_scrolling,
77
- :disable_vertical_scrolling
80
+ :disable_vertical_scrolling, :explicit_entire_size
78
81
  attr_reader :driver
79
82
 
80
83
  def_delegators 'Applitools::EyesLogger', :logger, :log_handler, :log_handler=
@@ -97,6 +100,7 @@ module Applitools::Selenium
97
100
  self.debug_screenshot = false
98
101
  self.disable_horizontal_scrolling = false
99
102
  self.disable_vertical_scrolling = false
103
+ self.explicit_entire_size = nil
100
104
  end
101
105
 
102
106
  # Starts a test
@@ -140,7 +144,7 @@ module Applitools::Selenium
140
144
  self.device_pixel_ratio = UNKNOWN_DEVICE_PIXEL_RATIO
141
145
 
142
146
  self.position_provider = self.class.position_provider(
143
- stitch_mode, driver, disable_horizontal_scrolling, disable_vertical_scrolling
147
+ stitch_mode, driver, disable_horizontal_scrolling, disable_vertical_scrolling, explicit_entire_size
144
148
  )
145
149
 
146
150
  self.eyes_screenshot_factory = lambda do |image|
@@ -157,7 +161,7 @@ module Applitools::Selenium
157
161
  @stitch_mode = value.to_s.upcase == STICH_MODE[:css].to_s ? STICH_MODE[:css] : STICH_MODE[:scroll]
158
162
  unless driver.nil?
159
163
  self.position_provider = self.class.position_provider(
160
- stitch_mode, driver, disable_horizontal_scrolling, disable_vertical_scrolling
164
+ stitch_mode, driver, disable_horizontal_scrolling, disable_vertical_scrolling, explicit_entire_size
161
165
  )
162
166
  end
163
167
  if stitch_mode == STICH_MODE[:css]
@@ -199,7 +203,13 @@ module Applitools::Selenium
199
203
  )
200
204
  end
201
205
 
202
- check_window_base region_provider, tag, false, match_timeout, match_level: default_match_settings[:match_level]
206
+ match_data = Applitools::MatchWindowData.new.tap do |d|
207
+ d.tag = tag
208
+ d.ignore_mismatch = false
209
+ d.match_level = default_match_settings[:match_level]
210
+ end
211
+
212
+ check_window_base region_provider, match_timeout, match_data
203
213
  end
204
214
 
205
215
  # @!visibility private
@@ -232,6 +242,10 @@ module Applitools::Selenium
232
242
 
233
243
  check_in_frame target_frames: target.frames do
234
244
  begin
245
+ match_data = Applitools::MatchWindowData.new
246
+ match_data.tag = name
247
+ match_data.match_level = default_match_settings[:match_level]
248
+ match_data.read_target(target, driver)
235
249
  eyes_element = target.region_to_check.call(driver)
236
250
  region_visibility_strategy.move_to_region original_position_provider,
237
251
  Applitools::Location.new(eyes_element.location.x.to_i, eyes_element.location.y.to_i)
@@ -274,11 +288,7 @@ module Applitools::Selenium
274
288
  end
275
289
 
276
290
  check_window_base(
277
- region_provider, name, false, target.options[:timeout] || USE_DEFAULT_MATCH_TIMEOUT,
278
- ignore: target.ignored_regions.map { |i| i.call(driver) },
279
- trim: target.options[:trim],
280
- match_level: default_match_settings[:match_level],
281
- exact: default_match_settings[:exact]
291
+ region_provider, target.options[:timeout] || USE_DEFAULT_MATCH_TIMEOUT, match_data
282
292
  )
283
293
  ensure
284
294
  eyes_element.overflow = original_overflow unless original_overflow.nil?
@@ -865,7 +875,13 @@ module Applitools::Selenium
865
875
  )
866
876
  end
867
877
 
868
- check_window_base region_provider, tag, false, match_timeout, match_level: default_match_settings[:match_level]
878
+ match_data = Applitools::MatchWindowData.new.tap do |d|
879
+ d.tag = tag
880
+ d.ignore_mismatch = false
881
+ d.match_level = default_match_settings[:match_level]
882
+ end
883
+
884
+ check_window_base region_provider, match_timeout, match_data
869
885
  end
870
886
 
871
887
  def app_environment
@@ -947,8 +963,14 @@ module Applitools::Selenium
947
963
  Applitools::Selenium::EyesWebDriverScreenshot.new(image, driver: driver)
948
964
  end
949
965
 
966
+ match_data = Applitools::MatchWindowData.new.tap do |d|
967
+ d.tag = tag
968
+ d.ignore_mismatch = false
969
+ d.match_level = default_match_settings[:match_level]
970
+ end
971
+
950
972
  result = check_window_base(
951
- region_provider, tag, false, match_timeout, match_level: default_match_settings[:match_level]
973
+ region_provider, match_timeout, match_data
952
974
  )
953
975
 
954
976
  logger.info 'Done! trying to scroll back to original position...'
@@ -1044,8 +1066,14 @@ module Applitools::Selenium
1044
1066
  )
1045
1067
  end
1046
1068
 
1069
+ match_data = Applitools::MatchWindowData.new.tap do |d|
1070
+ d.tag = tag
1071
+ d.ignore_mismatch = false
1072
+ d.match_level = default_match_settings[:match_level]
1073
+ end
1074
+
1047
1075
  check_window_base(
1048
- base_check_region_provider, tag, false, match_timeout, match_level: default_match_settings[:match_level]
1076
+ base_check_region_provider, match_timeout, match_data
1049
1077
  )
1050
1078
  ensure
1051
1079
  eyes_element.overflow = original_overflow unless original_overflow.nil?
@@ -1083,12 +1111,19 @@ module Applitools::Selenium
1083
1111
  end
1084
1112
 
1085
1113
  class << self
1086
- def position_provider(stitch_mode, driver, disable_horizontal = false, disable_vertical = false)
1114
+ def position_provider(stitch_mode, driver, disable_horizontal=false, disable_vertical=false, explicit_entire_size=nil)
1115
+ max_width, max_height = nil, nil
1116
+ unless explicit_entire_size.nil?
1117
+ max_width = explicit_entire_size.width
1118
+ max_height = explicit_entire_size.height
1119
+ end
1087
1120
  case stitch_mode
1088
1121
  when :SCROLL
1089
- Applitools::Selenium::ScrollPositionProvider.new(driver, disable_horizontal, disable_vertical)
1122
+ Applitools::Selenium::ScrollPositionProvider.new(driver, disable_horizontal, disable_vertical,
1123
+ max_width: max_width, max_height: max_height)
1090
1124
  when :CSS
1091
- Applitools::Selenium::CssTranslatePositionProvider.new(driver, disable_horizontal, disable_vertical)
1125
+ Applitools::Selenium::CssTranslatePositionProvider.new(driver, disable_horizontal, disable_vertical,
1126
+ max_width: max_width, max_height: max_height)
1092
1127
  end
1093
1128
  end
1094
1129
  end
@@ -5,10 +5,12 @@ module Applitools::Selenium
5
5
 
6
6
  def_delegators 'Applitools::EyesLogger', :logger, :log_handler, :log_handler=
7
7
 
8
- def initialize(executor, disable_horizontal = false, disable_vertical = false)
8
+ def initialize(executor, disable_horizontal = false, disable_vertical = false, max_width: nil, max_height: nil)
9
9
  self.executor = executor
10
10
  self.disable_horizontal = disable_horizontal
11
11
  self.disable_vertical = disable_vertical
12
+ self.max_width = max_width
13
+ self.max_height = max_height
12
14
  end
13
15
 
14
16
  # The scroll position of the current frame
@@ -43,6 +45,9 @@ module Applitools::Selenium
43
45
  logger.info "Entire size: #{result}"
44
46
  result.width = viewport_size.width if disable_horizontal
45
47
  result.height = viewport_size.height if disable_vertical
48
+ result.width = max_width unless max_width.nil?
49
+ result.height = max_height unless max_height.nil?
50
+ logger.info "Actual size to scroll: #{result}"
46
51
  result
47
52
  end
48
53
 
@@ -52,6 +57,6 @@ module Applitools::Selenium
52
57
 
53
58
  private
54
59
 
55
- attr_accessor :executor, :disable_horizontal, :disable_vertical
60
+ attr_accessor :executor, :disable_horizontal, :disable_vertical, :max_width, :max_height
56
61
  end
57
62
  end
@@ -1,3 +1,3 @@
1
1
  module Applitools
2
- VERSION = '3.5.4'.freeze
2
+ VERSION = '3.6.4'.freeze
3
3
  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.5.4
4
+ version: 3.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Applitools Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-02 00:00:00.000000000 Z
11
+ date: 2017-05-06 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.5.4
19
+ version: 3.6.4
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.5.4
26
+ version: 3.6.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: selenium-webdriver
29
29
  requirement: !ruby/object:Gem::Requirement