eyes_selenium 3.4.1 → 3.5.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: 49464fd2846206f3d89711efe90adf900793f036
4
- data.tar.gz: bc4a1895ed93664a3b0bd36a264c3a2dca284430
3
+ metadata.gz: f93b8793605ac58e0e53ea8e917b514c7edf3b64
4
+ data.tar.gz: 9c641c00d1f5c417c6c657f6f7b0c3bcfa9e7d02
5
5
  SHA512:
6
- metadata.gz: 0ab0179aaaa1ee9f9326532dc9440d4774aac8a85afe66f52c29064a65f500e74b861fbb567104bdf8c24f5ec1162fd795282aad8b60b31c50bd85dfc85f1d96
7
- data.tar.gz: bc5593f084702c3a89c160e11ceff53d1c2d42258d522b394ec73338253dcc7d57ccb8c2564dbb840827439d10825903d5187a486a813b012a5f59a63f8d16fd
6
+ metadata.gz: 9846f6b0578ad8aee3bfb76bfcc40cdd1107040b87f516e12ce62d68b60f0a551c419838dbffaaeb84ad3643366a3e966666efea6e1349a3f94b38505ab0a892
7
+ data.tar.gz: 37271c08ea7a37e15a45f6e0f9a8b242cd3f6f77e0e1056ebff55eaba57d46987500d3e9c9216b9fc49b3d6f1694598aa4fd8db17b2e621dc15bab92bcb93ac3
@@ -226,30 +226,29 @@ module Applitools::Selenium
226
226
 
227
227
  self.eyes_screenshot_factory = lambda do |image|
228
228
  Applitools::Selenium::EyesWebDriverScreenshot.new(
229
- image, driver: driver, force_offset: position_provider.force_offset
229
+ image, driver: driver, force_offset: position_provider.force_offset
230
230
  )
231
231
  end
232
232
 
233
233
  check_in_frame target_frames: target.frames do
234
234
  begin
235
235
  eyes_element = target.region_to_check.call(driver)
236
-
237
236
  region_visibility_strategy.move_to_region original_position_provider,
238
237
  Applitools::Location.new(eyes_element.location.x.to_i, eyes_element.location.y.to_i)
239
238
 
240
239
  check_window = false
241
- if (!target.frames.empty?) && eyes_element.is_a?(Applitools::Region)
242
- #check_current_frame
240
+ if !target.frames.empty? && eyes_element.is_a?(Applitools::Region)
241
+ # check_current_frame
243
242
  region_provider = region_provider_for_frame
244
243
 
245
244
  elsif eyes_element.is_a? Applitools::Selenium::Element
246
- #check_element
245
+ # check_element
247
246
  region_provider = Applitools::Selenium::RegionProvider.new(
248
- region_for_element(eyes_element),
249
- target.coordinate_type
247
+ region_for_element(eyes_element),
248
+ target.coordinate_type
250
249
  )
251
250
  else
252
- #check_window
251
+ # check_window
253
252
  region_provider = Applitools::Selenium::RegionProvider.new(
254
253
  region_for_element(eyes_element),
255
254
  target.coordinate_type
@@ -268,23 +267,18 @@ module Applitools::Selenium
268
267
 
269
268
  self.region_to_check = region_provider
270
269
 
271
- region_provider = Object.new.tap do |prov|
272
- prov.instance_eval do
273
- define_singleton_method :region do
274
- Applitools::Region::EMPTY
275
- end
276
-
277
- define_singleton_method :coordinate_type do
278
- nil
279
- end
280
- end
281
- end
270
+ region_provider = Applitools::Selenium::RegionProvider.new(
271
+ Applitools::Region::EMPTY,
272
+ nil
273
+ )
282
274
  end
283
275
 
284
276
  check_window_base(
285
277
  region_provider, name, false, target.options[:timeout] || USE_DEFAULT_MATCH_TIMEOUT,
286
- ignore: target.ignored_regions.map {|i| i.call(driver)},
287
- trim: target.options[:trim]
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]
288
282
  )
289
283
  ensure
290
284
  eyes_element.overflow = original_overflow unless original_overflow.nil?
@@ -312,13 +306,11 @@ module Applitools::Selenium
312
306
 
313
307
  yield if block_given?
314
308
 
315
-
316
309
  logger.info 'Switching back into top level frame...'
317
- driver.switch_to.default_content()
318
- unless original_frame_chain
319
- logger.info 'Switching back into original frame...'
320
- driver.switch_to.frames frame_chain: original_frame_chain
321
- end
310
+ driver.switch_to.default_content
311
+ return unless original_frame_chain
312
+ logger.info 'Switching back into original frame...'
313
+ driver.switch_to.frames frame_chain: original_frame_chain
322
314
  end
323
315
 
324
316
  def region_for_element(element)
@@ -333,23 +325,23 @@ module Applitools::Selenium
333
325
  border_bottom_width = element.border_bottom_width
334
326
 
335
327
  Applitools::Region.new(
336
- p.x + border_left_width,
337
- p.y + border_top_width,
338
- d.width - border_left_width - border_right_width,
339
- d.height - border_top_width - border_bottom_width
328
+ p.x + border_left_width,
329
+ p.y + border_top_width,
330
+ d.width - border_left_width - border_right_width,
331
+ d.height - border_top_width - border_bottom_width
340
332
  )
341
333
  end
342
334
 
343
- def region_provider_for_frame()
335
+ def region_provider_for_frame
344
336
  Object.new.tap do |provider|
345
337
  current_frame_size = lambda do
346
338
  frame_region = Applitools::Region.from_location_size(
347
- Applitools::Location.new(0, 0), driver.frame_chain!.current_frame.size
339
+ Applitools::Location.new(0, 0), driver.frame_chain!.current_frame.size
348
340
  )
349
341
  begin
350
342
  frame_region.intersect Applitools::Region.from_location_size(
351
- Applitools::Location.new(0, 0),
352
- Applitools::Utils::EyesSeleniumUtils.entire_page_size(driver)
343
+ Applitools::Location.new(0, 0),
344
+ Applitools::Utils::EyesSeleniumUtils.entire_page_size(driver)
353
345
  )
354
346
  frame_region
355
347
  ensure
@@ -557,9 +549,11 @@ module Applitools::Selenium
557
549
  'or :frame_chain option or :frames_path option'
558
550
  end
559
551
 
560
- if (needed_keys = (
561
- options.keys & [:index, :name_or_id, :frame_element, :frame_chain, :frames_path, :target_frames])
562
- ).length == 1
552
+ needed_keys = (
553
+ options.keys & [:index, :name_or_id, :frame_element, :frame_chain, :frames_path, :target_frames]
554
+ )
555
+
556
+ if needed_keys.length == 1
563
557
  frame_key = needed_keys.first
564
558
  else
565
559
  raise Applitools::EyesIllegalArgument.new 'You\'ve passed some extra keys!' /
@@ -183,12 +183,12 @@ module Applitools::Selenium
183
183
  logger.info 'Switching to frame...'
184
184
  logger.info frame_name_or_id
185
185
  case frame_name_or_id
186
- when String
187
- frame(name_or_id: frame_name_or_id)
188
- when Applitools::Selenium::Element
189
- frame(frame_element: frame_name_or_id.reference)
190
- else
191
- Applitools::ArgumentGuard.raise_argument_error Applitools::EyesNoSuchFrame.new frame_name_or_id
186
+ when String
187
+ frame(name_or_id: frame_name_or_id)
188
+ when Applitools::Selenium::Element
189
+ frame(frame_element: frame_name_or_id.reference)
190
+ else
191
+ Applitools::ArgumentGuard.raise_argument_error Applitools::EyesNoSuchFrame.new frame_name_or_id
192
192
  end
193
193
 
194
194
  logger.info 'Done!'
@@ -1,10 +1,10 @@
1
1
  module Applitools::Selenium
2
2
  class RegionProvider
3
- #он нам нужен в селениум?
3
+ # Do we need it under Selenium module?
4
4
  attr_reader :region, :coordinate_type
5
5
  def initialize(region, coordinate_type)
6
6
  @region = region
7
7
  @coordinate_type = coordinate_type
8
8
  end
9
9
  end
10
- end
10
+ end
@@ -3,40 +3,40 @@ module Applitools
3
3
  class Target
4
4
  class << self
5
5
  def window
6
- self.new()
6
+ new
7
7
  end
8
8
 
9
9
  def region(element)
10
- self.new().region(element)
10
+ new.region(element)
11
11
  end
12
12
  end
13
13
 
14
- attr_accessor :element, :frames, :region_to_check, :coordinate_type, :options, :ignored_regions
14
+ attr_accessor :element, :frames, :region_to_check, :coordinate_type, :options, :ignored_regions
15
15
 
16
- def initialize()
16
+ def initialize
17
17
  self.frames = []
18
18
  self.options = {}
19
19
  reset_for_fullscreen
20
20
  end
21
21
 
22
22
  def ignore(*args)
23
- if(args.first)
24
- if args.first.is_a? Applitools::Selenium::Element
25
- self.ignored_regions << proc do
26
- args.first
27
- end
28
- else
29
- self.ignored_regions << proc do |driver|
30
- driver.find_element *args
31
- end
32
- end
23
+ if args.first
24
+ ignored_regions << if args.first.is_a? Applitools::Selenium::Element
25
+ proc do
26
+ args.first
27
+ end
28
+ else
29
+ proc do |driver|
30
+ driver.find_element(*args)
31
+ end
32
+ end
33
33
  else
34
34
  reset_ignore
35
35
  end
36
36
  self
37
37
  end
38
38
 
39
- def float(*args)
39
+ def float(*_)
40
40
  self
41
41
  end
42
42
 
@@ -57,15 +57,15 @@ module Applitools
57
57
  end
58
58
 
59
59
  def region(*args)
60
- if args.first.is_a? Applitools::Selenium::Element
61
- self.region_to_check = proc do
62
- args.first
63
- end
64
- else
65
- self.region_to_check = proc do |driver|
66
- driver.find_element *args
67
- end
68
- end
60
+ self.region_to_check = if args.first.is_a? Applitools::Selenium::Element
61
+ proc do
62
+ args.first
63
+ end
64
+ else
65
+ proc do |driver|
66
+ driver.find_element(*args)
67
+ end
68
+ end
69
69
  self.coordinate_type = Applitools::EyesScreenshot::COORDINATE_TYPES[:context_relative]
70
70
  options[:timeout] = nil
71
71
  reset_ignore
@@ -94,4 +94,3 @@ module Applitools
94
94
  end
95
95
  end
96
96
  end
97
-
@@ -1,3 +1,3 @@
1
1
  module Applitools
2
- VERSION = '3.4.1'.freeze
2
+ VERSION = '3.5.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: 3.4.1
4
+ version: 3.5.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: 2017-04-25 00:00:00.000000000 Z
11
+ date: 2017-04-27 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.4.1
19
+ version: 3.5.0
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.4.1
26
+ version: 3.5.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: selenium-webdriver
29
29
  requirement: !ruby/object:Gem::Requirement