eyes_selenium 3.10.2 → 3.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15870d2d4f82382cfb5e1a66f0b250203bcf55a4
4
- data.tar.gz: 1d65c7e9e6ea324b9f31c456836c8e9588db587d
3
+ metadata.gz: 461576a40676995994ac77c99edc3c857503679a
4
+ data.tar.gz: e77407eb57a87304423c116766a30d682d1002e8
5
5
  SHA512:
6
- metadata.gz: 880a3ee29beb57e4dd1694d817d44934f1bcccd0576163da8ecf03b262fa43dc907e1033bb93c53eb371ac36848b55fcd2f457cd65fde811ab12ad85d32b135e
7
- data.tar.gz: '094d8aca9b731dca647045c665a45221326621d2194030ef4f496f67063787e658506093ffc96a14a2940e049c4c24d5096b4054e8fbccfae50bca8aa1895f8d'
6
+ metadata.gz: 786dcc1d992d30a2185e39112231662c7cb0e95827e175ada361acc1beb4dbcd0d01ae532f222a3f1002ae3458d5e0d60a8a4f7d4e82b53cb100ebb14566dd51
7
+ data.tar.gz: 99da45a0101adbb9ef2a21c01ed4124a7145d8c0d67c9e84d689b67aa10d936873f9c423bf385504ef255e0067533f4747904d53dcba92396f8565b9952659bb
@@ -106,7 +106,7 @@ module Applitools::Selenium
106
106
  top = 0
107
107
  end
108
108
 
109
- Applitools::Base::Region.new(left, top, width, height)
109
+ Applitools::Region.new(left, top, width, height)
110
110
  end
111
111
 
112
112
  def find_element(*args)
@@ -434,8 +434,6 @@ module Applitools::Selenium
434
434
  check(options[:tag], target)
435
435
  end
436
436
 
437
- # @!parse def check_region(element, how=nil, what=nil, options = {}); end
438
-
439
437
  # Use this method to perform seamless testing with selenium through eyes driver.
440
438
  # It yields a block and passes to it an Applitools::Selenium::Driver instance, which wraps standard driver.
441
439
  # Using Selenium methods inside the 'test' block will send the messages to Selenium
@@ -22,7 +22,6 @@ module Applitools::Selenium
22
22
  class << self
23
23
  alias _new new
24
24
 
25
- # rubocop:disable LineLength
26
25
  # Creates new image.
27
26
  #
28
27
  # @param [Applitools::Screenshot] image
@@ -35,7 +34,6 @@ module Applitools::Selenium
35
34
 
36
35
  # @return [Applitools::Screenshot] The image.
37
36
  # @!parse def initialize(image, options); end
38
- # rubocop:enable LineLength
39
37
 
40
38
  def new(*args)
41
39
  image = args.shift
@@ -7,13 +7,12 @@ module Applitools::Selenium
7
7
  def_delegators 'Applitools::EyesLogger', :logger, :log_handler, :log_handler=
8
8
  attr_accessor :original_position
9
9
 
10
- # rubocop:disable LineLength
11
10
  # Set the location of the position provider.
12
11
  #
13
12
  # @param [Applitools::Selenium::CssTranslatePositionProvider, Applitools::Selenium::ScrollPositionProvider] position_provider
14
13
  # The position provider type (e.g. Applitools::Selenium::CssTranslatePositionProvider, Applitools::Selenium::ScrollPositionProvider).
15
14
  # @param [Applitools::Location] location The location to move to.
16
- # rubocop:enable LineLength
15
+
17
16
  def move_to_region(position_provider, location)
18
17
  logger.info 'Getting current position state...'
19
18
  self.original_position = position_provider.state
@@ -30,11 +29,10 @@ module Applitools::Selenium
30
29
  logger.info 'Done!'
31
30
  end
32
31
 
33
- # rubocop:disable LineLength
34
32
  # Returns the position provider to its original position.
35
33
  # @param [Applitools::Selenium::CssTranslatePositionProvider, Applitools::Selenium::ScrollPositionProvider] position_provider
36
34
  # The position provider type (e.g. Applitools::Selenium::CssTranslatePositionProvider, Applitools::Selenium::ScrollPositionProvider).
37
- # rubocop:enable LineLength
35
+
38
36
  def return_to_original_position(position_provider)
39
37
  return if original_position.nil?
40
38
  logger.info 'Returning to original position...'
@@ -28,25 +28,38 @@ module Applitools
28
28
  reset_for_fullscreen
29
29
  end
30
30
 
31
- # rubocop:disable LineLength
32
31
  # Add the wanted ignored regions.
33
32
  #
34
33
  # @param [Applitools::Selenium::Element, Applitools::Region, ::Selenium::WebDriver::Element] region_or_element the region to ignore or an element representing the region to ignore
35
34
  # @param [Symbol, String] how A finder to be used (see Selenium::WebDriver documentation for complete list of available finders)
36
35
  # @param [Symbol, String] what An id or selector to find
37
- # @!parse def ignore(region_or_element, how, what); end;
38
- # rubocop:enable LineLength
36
+ # @!parse def ignore(region_or_element, how, what, padding = Applitools::PaddingBounds::PIXEL_PADDING); end;
39
37
 
40
38
  def ignore(*args)
41
39
  if args.empty?
42
40
  reset_ignore
43
41
  else
42
+ requested_padding = if args.last.is_a? Applitools::PaddingBounds
43
+ args.pop
44
+ else
45
+ Applitools::PaddingBounds::PIXEL_PADDING
46
+ end
44
47
  ignored_regions << case args.first
45
- when Applitools::Selenium::Element, Applitools::Region, ::Selenium::WebDriver::Element
46
- proc { args.first }
48
+ when Applitools::Region
49
+ proc { args.first.padding(requested_padding) }
50
+ when Applitools::Selenium::Element, ::Selenium::WebDriver::Element
51
+ proc do
52
+ region = args.first
53
+ Applitools::Region.from_location_size(
54
+ region.location, region.size
55
+ ).padding(requested_padding)
56
+ end
47
57
  else
48
58
  proc do |driver|
49
- driver.find_element(*args)
59
+ region = driver.find_element(*args)
60
+ Applitools::Region.from_location_size(
61
+ region.location, region.size
62
+ ).padding(requested_padding)
50
63
  end
51
64
  end
52
65
 
@@ -54,20 +67,45 @@ module Applitools
54
67
  self
55
68
  end
56
69
 
70
+ # Sets the wanted floating region
71
+ # @param region_or_element [Applitools::FloatingRegion, Selenium::WebDriver::Element, Applitools::Selenium::Element, Applitools::Region]
72
+ # @param bounds [Applitools::FloatingBounds]
73
+ # @!parse def floating(region_or_element, bounds, padding); end;
74
+ # @param left [Integer]
75
+ # @param top [Integer]
76
+ # @param right [Integer]
77
+ # @param bottom [Integer]
78
+ # @param padding [Applitools::PaddingBounds]
79
+ # @example
80
+ # target.floating(:id, 'my_id', 10, 10, 10, 10)
81
+ # @example
82
+ # target.floating(:id, 'my_id', Applitools::FloatingBounds.new(10, 10, 10, 10))
83
+ # @example
84
+ # target.floating(region, Applitools::FloatingBounds.new(10, 10, 10, 10))
85
+ # @example
86
+ # target.floating(floating_region)
87
+ # @example
88
+ # target.floating(floating_region, bounds)
89
+ # @example
90
+ # target.floating(:id, 'my_id', Applitools::FloatingBounds.new(10, 10, 10, 10), Applitools::PaddingBounds.new(10, 10, 10, 10))
91
+ # @!parse def floating(region_or_element, bounds, left,top, right, bottom, padding); end;
92
+
57
93
  def floating(*args)
94
+ requested_padding = if args.last.is_a? Applitools::PaddingBounds
95
+ args.pop
96
+ else
97
+ Applitools::PaddingBounds::PIXEL_PADDING
98
+ end
58
99
  value = case args.first
59
100
  when Applitools::FloatingRegion
60
- proc { args.first }
61
- when ::Selenium::WebDriver::Element, Applitools::Selenium::Element
62
- proc { Applitools::FloatingRegion.any args.shift, *args }
63
- when Applitools::Region
64
- proc do
65
- region = args.shift
66
- Applitools::FloatingRegion.new region.left, region.top, region.width, region.height, *args
67
- end
101
+ proc { args.first.padding(requested_padding) }
102
+ when ::Selenium::WebDriver::Element, Applitools::Selenium::Element, ::Applitools::Region
103
+ proc { Applitools::FloatingRegion.any(args.shift, *args).padding(requested_padding) }
68
104
  else
69
105
  proc do |driver|
70
- Applitools::FloatingRegion.any driver.find_element(args.shift, args.shift), *args
106
+ Applitools::FloatingRegion.any(
107
+ driver.find_element(args.shift, args.shift), *args
108
+ ).padding(requested_padding)
71
109
  end
72
110
  end
73
111
  floating_regions << value
@@ -85,9 +123,7 @@ module Applitools
85
123
  self
86
124
  end
87
125
 
88
- # rubocop:disable LineLength
89
126
  # Add the desired region.
90
- #
91
127
  # @param [Applitools::Selenium::Element, Applitools::Region, ::Selenium::WebDriver::Element] element the target region or an element representing the target region
92
128
  # @param [Symbol, String] how The finder to be used (:css, :id, etc. see Selenium::WebDriver documentation for complete list of available finders)
93
129
  # @param [Symbol, String] what Selector or id of an element
@@ -97,7 +133,6 @@ module Applitools
97
133
  # target.region(:id, 'target_region')
98
134
  # @return [Applitools::Selenium::Target] A Target instance.
99
135
  # @!parse def region(element, how, what); end;
100
- # rubocop:enable LineLength
101
136
 
102
137
  def region(*args)
103
138
  self.region_to_check = case args.first
@@ -1,3 +1,3 @@
1
1
  module Applitools
2
- VERSION = '3.10.2'.freeze
2
+ VERSION = '3.11.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.10.2
4
+ version: 3.11.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-07-10 00:00:00.000000000 Z
11
+ date: 2017-07-30 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.10.2
19
+ version: 3.11.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.10.2
26
+ version: 3.11.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: selenium-webdriver
29
29
  requirement: !ruby/object:Gem::Requirement