eyes_selenium 4.1.0.alpha → 4.1.2

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: 0f163c4e0692f7ccc871bc997b9c04c58df599f6f56b27893b8323f73fadff09
4
- data.tar.gz: f8633757d78f182eb6601ec8a808f22ca3a9b1339035afffd7fc816e267856de
3
+ metadata.gz: b26b8cab2a5dee12cd6762d42835c5ac5a551c301dbaabd6ad3eee5a654a5d8e
4
+ data.tar.gz: 0ba8f11f92e059a7bee775aa3e531be9acf73c1f21838463492b606eb9c37856
5
5
  SHA512:
6
- metadata.gz: c5a95eb92f14c46ae5a42075bf1071e59bdd8b9e34306766ad01427650bc74313649aa183afd50290d1176dc7260329e47c3c45c695a6d345a33a63f998f4167
7
- data.tar.gz: 3e9ce225621dce2546ab9bd517463b3516aa6669030eb5f0c82405aa10aabf561056ebb1ffa2034d7aa48cee2eaf30988f540a22d94d41965f586fde069c049d
6
+ metadata.gz: 81a285c6e029db6f3d93844a2cfc89bdb8ed4af57bc3d5d56023dd29c0c0e606f3ca6d000dd05bd4825c485c731fd18b36d15c13a94b7a0da678df95d3f92011
7
+ data.tar.gz: 95ab65d07256a45d79f130ab6ba84221bdbf27fd8f90533600e4520349d343794abb8557579002fca2c9df0285087c762c764340b81f736804736dae6b54d5d6
@@ -49,10 +49,8 @@ module Applitools
49
49
  if args.empty?
50
50
  reset_ignore
51
51
  else
52
- value = convert_to_universal(args)
53
- value = { type: args[0], selector: args[1] } if value.nil?
54
- value = value[:selector] if value.is_a?(Hash) && (value[:type].to_s === 'id')
55
- ignored_regions << value
52
+ region = region_from_args(args)
53
+ ignored_regions << region if region
56
54
  end
57
55
  self
58
56
  end
@@ -81,33 +79,36 @@ module Applitools
81
79
  # @!parse def floating(region_or_element, bounds, left,top, right, bottom, padding); end;
82
80
 
83
81
  def floating(*args)
84
- requested_padding = get_requested_padding(args)
82
+ options = Applitools::Utils.extract_options!(args)
83
+ padding = options && options[:padding]
84
+ requested_padding = get_requested_padding(padding, args)
85
+ bounds = get_bounds(args)
85
86
  value = convert_to_universal(args)
86
87
  value = { type: args[0], selector: args[1] } if value.nil?
87
88
  value = value[:selector] if value.is_a?(Hash) && (value[:type].to_s === 'id')
88
- value = { region: value }.merge(requested_padding)
89
- floating_regions << value
89
+ region = { region: value }
90
+ region.merge!(bounds) if bounds != {}
91
+ region.merge!(padding: requested_padding) if requested_padding != {}
92
+ region.merge!(regionId: options[:region_id]) if options[:region_id]
93
+ floating_regions << region
90
94
  self
91
95
  end
92
96
 
93
97
  def layout(*args)
94
- return match_level(Applitools::MatchLevel::LAYOUT) if args.empty?
95
- region = process_region(*args)
96
- layout_regions << region
98
+ region = region_from_args(args)
99
+ layout_regions << region if region
97
100
  self
98
101
  end
99
102
 
100
103
  def content(*args)
101
- return match_level(Applitools::MatchLevel::CONTENT) if args.empty?
102
- region = process_region(*args)
103
- content_regions << region
104
+ region = region_from_args(args)
105
+ content_regions << region if region
104
106
  self
105
107
  end
106
108
 
107
109
  def strict(*args)
108
- return match_level(Applitools::MatchLevel::STRICT) if args.empty?
109
- region = process_region(*args)
110
- strict_regions << region
110
+ region = region_from_args(args)
111
+ strict_regions << region if region
111
112
  self
112
113
  end
113
114
 
@@ -344,6 +345,11 @@ module Applitools
344
345
  self
345
346
  end
346
347
 
348
+ def lazy_load(*args) # scroll_length, waiting_time, max_amount_to_scroll
349
+ options[:lazy_load] = args.is_a?(Hash) ? args : true
350
+ self
351
+ end
352
+
347
353
  private
348
354
 
349
355
  def reset_for_fullscreen
@@ -395,16 +401,41 @@ module Applitools
395
401
  driver.find_element(:xpath, xpath)
396
402
  end
397
403
 
398
- def get_requested_padding(args)
404
+ def get_requested_padding(padding, args)
405
+ return padding.to_hash if padding && padding.is_a?(Applitools::PaddingBounds)
406
+ return padding if padding && (padding.is_a?(Hash) || padding.is_a?(Numeric))
399
407
  if args.last.is_a? Applitools::PaddingBounds
400
408
  args.pop
401
- elsif args.last.is_a?(Applitools::FloatingBounds)
402
- args.pop.to_hash
409
+ # elsif args.last.is_a?(Applitools::FloatingBounds)
410
+ # args.pop.to_hash
411
+ else
412
+ {}
413
+ end
414
+ end
415
+
416
+ def get_bounds(args)
417
+ return args.pop.to_hash if args.last.is_a?(Applitools::FloatingBounds)
418
+ last4 = args.last(4)
419
+ if last4.size === 4 && last4.all? { |e| e.is_a?(Numeric) }
420
+ FloatingBounds.new(*last4).to_hash
403
421
  else
404
422
  {}
405
423
  end
406
424
  end
407
425
 
426
+ def region_from_args(args)
427
+ options = Applitools::Utils.extract_options!(args)
428
+ padding = options && options[:padding]
429
+ requested_padding = get_requested_padding(padding, args)
430
+ value = convert_to_universal(args)
431
+ value = { type: args[0], selector: args[1] } if value.nil?
432
+ value = value[:selector] if value.is_a?(Hash) && (value[:type].to_s === 'id')
433
+ return nil if value === {selector: nil, type: nil}
434
+ region = { region: value }
435
+ region.merge!(padding: requested_padding) if requested_padding != {}
436
+ region.merge!(regionId: options[:region_id]) if options[:region_id]
437
+ region
438
+ end
408
439
 
409
440
 
410
441
  def is_element?(el)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Applitools
4
- VERSION = '4.1.0.alpha'.freeze
5
- UNIVERSAL_VERSION = '2.7.2'.freeze
4
+ VERSION = '4.1.2'.freeze
5
+ UNIVERSAL_VERSION = '2.9.5'.freeze
6
6
  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: 4.1.0.alpha
4
+ version: 4.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Applitools Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-13 00:00:00.000000000 Z
11
+ date: 2022-07-07 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: 4.1.0.alpha
19
+ version: 4.1.2
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: 4.1.0.alpha
26
+ version: 4.1.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: selenium-webdriver
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -178,9 +178,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
178
178
  version: '0'
179
179
  required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  requirements:
181
- - - ">"
181
+ - - ">="
182
182
  - !ruby/object:Gem::Version
183
- version: 1.3.1
183
+ version: '0'
184
184
  requirements: []
185
185
  rubygems_version: 3.3.14
186
186
  signing_key: