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 +4 -4
- data/lib/applitools/eyes.rb +29 -19
- data/lib/applitools/selenium/browser.rb +6 -4
- data/lib/applitools/selenium/driver.rb +10 -0
- data/lib/applitools/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8eb600a1b703d7494ac2ef3c062e8d8c5d3110e1
|
4
|
+
data.tar.gz: f8bd75c7a205a4ee88f123bfa526d6794467f988
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40197eea7129826dcc60433694c50433a581e6fb17438fbfe05252ca6f88c2b8b2c16a76478e45a8b0f27c1632ef48a2228d4a309516a8c35d82a13120a7b10c
|
7
|
+
data.tar.gz: 5a1c9b42716c731c3bb8ee32a912f13d7560c6c411a59d547a7cdbe87df101a0631b3ef3b62de01f39cc32c7e44837eec9c47226e5f6ae52a7f018c78aadc2d1
|
data/lib/applitools/eyes.rb
CHANGED
@@ -195,29 +195,39 @@ class Applitools::Eyes
|
|
195
195
|
Applitools::EyesLogger.debug 'Done!'
|
196
196
|
end
|
197
197
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
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
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
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
|
-
|
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+.
|
data/lib/applitools/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2016-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|