eyes_selenium 2.28.0 → 2.29.0

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: fd372027171990f6c9d885f7a7e00f65a0899d31
4
- data.tar.gz: f93869d827f4cf50963cf7148cf63cc9df762b09
3
+ metadata.gz: 8eb600a1b703d7494ac2ef3c062e8d8c5d3110e1
4
+ data.tar.gz: f8bd75c7a205a4ee88f123bfa526d6794467f988
5
5
  SHA512:
6
- metadata.gz: 2bf6b04cf2138f1714dd20d4720fe23d19dc311a9bbe24593c04263317063d298cf83771917354505870034f1fbea4430eb56944d96658ecc3dfeec0f7e7f32d
7
- data.tar.gz: 345cfaffd6a3c34f9d64de2cb07f878dd190034f07438c4250e0bc0a1fd3291d4b55a07fb033f84a94a467a9d2ab038cfdccc5c1cc3d5a1d6a69a26b78b0186f
6
+ metadata.gz: 40197eea7129826dcc60433694c50433a581e6fb17438fbfe05252ca6f88c2b8b2c16a76478e45a8b0f27c1632ef48a2228d4a309516a8c35d82a13120a7b10c
7
+ data.tar.gz: 5a1c9b42716c731c3bb8ee32a912f13d7560c6c411a59d547a7cdbe87df101a0631b3ef3b62de01f39cc32c7e44837eec9c47226e5f6ae52a7f018c78aadc2d1
@@ -195,29 +195,39 @@ class Applitools::Eyes
195
195
  Applitools::EyesLogger.debug 'Done!'
196
196
  end
197
197
 
198
- if how == :element
199
- Applitools::EyesLogger.debug 'Element given as an argument...'
200
- raise Applitools::EyesError.new('Element does not exist') if what.nil?
201
- element_to_check = what
202
- else
203
- Applitools::EyesLogger.debug 'Finding element...'
204
- element_to_check = driver.find_element(how, what)
205
- end
198
+ original_overflow = driver.hide_scrollbars if hide_scrollbars
199
+ begin
200
+ if how == :element
201
+ Applitools::EyesLogger.debug 'Element given as an argument...'
202
+ raise Applitools::EyesError.new('Element does not exist') if what.nil?
203
+ element_to_check = what
204
+ else
205
+ Applitools::EyesLogger.debug 'Finding element...'
206
+ element_to_check = driver.find_element(how, what)
207
+ end
206
208
 
207
- Applitools::EyesLogger.debug 'Done! Getting element location...'
208
- location = element_to_check.location
209
- Applitools::EyesLogger.debug 'Done! Getting element size...'
210
- size = element_to_check.size
211
- raise Applitools::EyesError.new("Invalid region size: #{size}") if size.width <= 0 || size.height <= 0
212
- Applitools::EyesLogger.debug 'Done! Creating region...'
213
- region = Applitools::Base::Region.new(location.x, location.y, size.width, size.height)
214
- Applitools::EyesLogger.debug "Done! Checking region... #{region}"
215
- check_region_(region, tag, specific_timeout)
216
- Applitools::EyesLogger.debug 'Done!'
209
+ Applitools::EyesLogger.debug 'Done! Getting element location...'
210
+ location = element_to_check.location
211
+ Applitools::EyesLogger.debug 'Done! Getting element size...'
212
+ size = element_to_check.size
213
+ raise Applitools::EyesError.new("Invalid region size: #{size}") if size.width <= 0 || size.height <= 0
214
+ Applitools::EyesLogger.debug 'Done! Creating region...'
215
+ region = Applitools::Base::Region.new(location.x, location.y, size.width, size.height)
216
+ Applitools::EyesLogger.debug "Done! Checking region... #{region}"
217
+ check_region_(region, tag, specific_timeout)
218
+ Applitools::EyesLogger.debug 'Done!'
219
+ ensure
220
+ driver.set_overflow(original_overflow) if hide_scrollbars
221
+ end
217
222
  end
218
223
 
219
224
  def check_window(tag = nil, specific_timeout = -1)
220
- check_region_(Applitools::Base::Region::EMPTY, tag, specific_timeout)
225
+ original_overflow = driver.hide_scrollbars if hide_scrollbars
226
+ begin
227
+ check_region_(Applitools::Base::Region::EMPTY, tag, specific_timeout)
228
+ ensure
229
+ driver.set_overflow(original_overflow) if hide_scrollbars
230
+ end
221
231
  end
222
232
 
223
233
  def close(raise_ex = true)
@@ -119,11 +119,17 @@ module Applitools::Selenium
119
119
  execute_script(JS_SET_TRANSFORM % { transform: transform }, 0.25)
120
120
  end
121
121
 
122
+ ## Set the overflow value for document element and return the original overflow value.
122
123
  def set_overflow(overflow)
123
124
  execute_script(JS_SET_OVERFLOW % { overflow: overflow }, 0.1)
124
125
  end
125
126
  # rubocop:enable Style/AccessorMethodName
126
127
 
128
+ ## Hide the main document's scrollbars and returns the original overflow value.
129
+ def hide_scrollbars
130
+ set_overflow(OVERFLOW_HIDDEN)
131
+ end
132
+
127
133
  def translate_to(point)
128
134
  set_transform("translate(-#{point.left}px, -#{point.top}px)")
129
135
  end
@@ -142,9 +148,6 @@ module Applitools::Selenium
142
148
  translate_to(Applitools::Base::Point::TOP_LEFT)
143
149
  end
144
150
 
145
- # Hide scrollbars.
146
- original_overflow = set_overflow(OVERFLOW_HIDDEN) if @eyes.hide_scrollbars
147
-
148
151
  # Take screenshot of the (0,0) tile.
149
152
  screenshot = @driver.visible_screenshot
150
153
 
@@ -182,7 +185,6 @@ module Applitools::Selenium
182
185
  screenshot = Applitools::Utils::ImageUtils.stitch_images(page_size, parts)
183
186
  end
184
187
 
185
- set_overflow(original_overflow) if @eyes.hide_scrollbars
186
188
  set_transform(original_transform) if @eyes.use_css_transition
187
189
 
188
190
  scroll_to(original_scroll_position)
@@ -73,6 +73,16 @@ module Applitools::Selenium
73
73
  @is_mobile_device
74
74
  end
75
75
 
76
+ ## Hide the main document's scrollbars and returns the original overflow value.
77
+ def hide_scrollbars
78
+ @browser.hide_scrollbars
79
+ end
80
+
81
+ ## Set the overflow value for document element and return the original overflow value.
82
+ def set_overflow(overflow)
83
+ @browser.set_overflow(overflow)
84
+ end
85
+
76
86
  # Return a PNG screenshot in the given format as a string
77
87
  #
78
88
  # +output_type+:: +Symbol+ The format of the screenshot. Accepted values are +:base64+ and +:png+.
@@ -1,3 +1,3 @@
1
1
  module Applitools
2
- VERSION = '2.28.0'.freeze
2
+ VERSION = '2.29.0'.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: 2.28.0
4
+ version: 2.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Applitools Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-17 00:00:00.000000000 Z
11
+ date: 2016-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver