eyes_selenium 3.8.0 → 3.9.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: 2206265c53d0bb13432e0d17365803e0cbc06005
4
- data.tar.gz: 65173ed7a9db0552a62b31790fabd5b6641fdb46
3
+ metadata.gz: 6c25739a777c2089bc71f6d8c8398ed75c1b6ac3
4
+ data.tar.gz: 615617ba1201c888500bc577142aeeeb83c60ed6
5
5
  SHA512:
6
- metadata.gz: 26a51f64ed59c4b58b70f34a73eb48c3411b79d831ff2e07b2ffc66728f12ebdea74c727791a96e14aa3dda2ab45c9963745523edaca4064a6d49604f2f4adfa
7
- data.tar.gz: f53320d71c5fe812b84904fac278cbf8a27e0f0cb3b2f0678f9274a9e76a4e6be30b81a2147366e6047955f80a902aefcc281dc5508fde2f17aa332591cb2f56
6
+ metadata.gz: d3e71cdf0e0c78309267d970557356c70eaa3804bccbb18348b535bae3299bb3a8d9a1fe64d7ca3f87f69d1899d2302d82994cda80b24efcf2ea3062775ad708
7
+ data.tar.gz: e057576f1cc912cabfd7597f21bc42b15c4025f39cad44335eb7ee54600227090934641f8f83759577124d05f75c8c1f190955bd85f86302b519e2cbe92051e8
@@ -77,8 +77,9 @@ module Applitools::Selenium
77
77
  # Returns +true+ if the driver orientation is landscape.
78
78
  def landscape_orientation?
79
79
  driver.orientation.to_s.upcase == LANDSCAPE
80
- rescue NameError
80
+ rescue NameError, Selenium::WebDriver::Error::UnknownError
81
81
  Applitools::EyesLogger.debug 'driver has no "orientation" attribute. Assuming: portrait.'
82
+ false
82
83
  end
83
84
 
84
85
  # Returns +true+ if the platform running the test is a mobile platform. +false+ otherwise.
@@ -2,6 +2,10 @@ module Applitools
2
2
  module Selenium
3
3
  class Target
4
4
  class << self
5
+ def frame(element)
6
+ new.frame(element)
7
+ end
8
+
5
9
  def window
6
10
  new
7
11
  end
@@ -11,12 +15,12 @@ module Applitools
11
15
  end
12
16
  end
13
17
 
14
- attr_accessor :element, :frames, :region_to_check, :coordinate_type, :options, :ignored_regions
18
+ attr_accessor :element, :frames, :region_to_check, :coordinate_type, :options, :ignored_regions, :floating_regions
15
19
 
16
20
  # Initialize a Applitools::Selenium::Target instance.
17
21
  def initialize
18
22
  self.frames = []
19
- self.options = {}
23
+ self.options = { ignore_caret: false }
20
24
  reset_for_fullscreen
21
25
  end
22
26
 
@@ -26,23 +30,46 @@ module Applitools
26
30
  # @option args [String] :name The name of the region to ignore.
27
31
  # @option args [Integer] :id The id of the region to ignore.
28
32
  def ignore(*args)
29
- if args.first
30
- ignored_regions << if args.first.is_a? Applitools::Selenium::Element
31
- proc do
32
- args.first
33
- end
33
+ if args.empty?
34
+ reset_ignore
35
+ else
36
+ ignored_regions << case args.first
37
+ when Applitools::Selenium::Element
38
+ proc { args.first }
39
+ when Applitools::Region
40
+ proc { args.first }
34
41
  else
35
42
  proc do |driver|
36
43
  driver.find_element(*args)
37
44
  end
38
45
  end
39
- else
40
- reset_ignore
46
+
41
47
  end
42
48
  self
43
49
  end
44
50
 
45
- def float(*_)
51
+ def ignore_caret(value = false)
52
+ options[:ignore_caret] = value ? true : false
53
+ self
54
+ end
55
+
56
+ def floating(*args)
57
+ value = case args.first
58
+ when Applitools::FloatingRegion
59
+ proc { args.first }
60
+ when Applitools::Selenium::Element
61
+ proc { Applitools::FloatingRegion.for_element args.shift, *args }
62
+ when Applitools::Region
63
+ proc do
64
+ region = args.shift
65
+ Applitools::FloatingRegion.new region.left, region.top, region.width, region.height, *args
66
+ end
67
+ else
68
+ proc do |driver|
69
+ Applitools::FloatingRegion.for_element driver.find_element(args.shift, args.shift), *args
70
+ end
71
+ end
72
+ floating_regions << value
46
73
  self
47
74
  end
48
75
 
@@ -69,10 +96,11 @@ module Applitools
69
96
  # @option args [Integer] :id The id of the region.
70
97
  # @return [Applitools::Selenium::Target] Self instance.
71
98
  def region(*args)
72
- self.region_to_check = if args.first.is_a? Applitools::Selenium::Element
73
- proc do
74
- args.first
75
- end
99
+ self.region_to_check = case args.first
100
+ when Applitools::Selenium::Element
101
+ proc { args.first }
102
+ when Applitools::Region
103
+ proc { args.first }
76
104
  else
77
105
  proc do |driver|
78
106
  driver.find_element(*args)
@@ -81,6 +109,7 @@ module Applitools
81
109
  self.coordinate_type = Applitools::EyesScreenshot::COORDINATE_TYPES[:context_relative]
82
110
  options[:timeout] = nil
83
111
  reset_ignore
112
+ reset_floating
84
113
  self
85
114
  end
86
115
 
@@ -95,6 +124,7 @@ module Applitools
95
124
  self.coordinate_type = nil
96
125
  self.region_to_check = proc { Applitools::Region::EMPTY }
97
126
  reset_ignore
127
+ reset_floating
98
128
  options[:stitch_content] = false
99
129
  options[:timeout] = nil
100
130
  options[:trim] = false
@@ -103,6 +133,10 @@ module Applitools
103
133
  def reset_ignore
104
134
  self.ignored_regions = []
105
135
  end
136
+
137
+ def reset_floating
138
+ self.floating_regions = []
139
+ end
106
140
  end
107
141
  end
108
142
  end
@@ -1,3 +1,3 @@
1
1
  module Applitools
2
- VERSION = '3.8.0'.freeze
2
+ VERSION = '3.9.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.8.0
4
+ version: 3.9.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-05-23 00:00:00.000000000 Z
11
+ date: 2017-05-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.8.0
19
+ version: 3.9.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.8.0
26
+ version: 3.9.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: selenium-webdriver
29
29
  requirement: !ruby/object:Gem::Requirement