eyes_appium 3.18.4 → 4.0.3

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: f869a65820cb46b1addb98441dd10f4221ec63e3
4
- data.tar.gz: 51d669db3cc8e0caefe897984aec5e7599313380
3
+ metadata.gz: 73597633033d0ce575d99730f3fa9bdc3fad0880
4
+ data.tar.gz: a3dc7413d88a59fa6992ac374e47deb8d6404e9a
5
5
  SHA512:
6
- metadata.gz: 72c6642084c186e36331110bdbc35d71bd3864fce26252087ababad84f93f4ccffd81c2154f31f8e45371ecfbbe281ac343a9ac498ef94dd4411c69fbaa40ae6
7
- data.tar.gz: a310e64abfb43f7065b38205937379ca3991ec45e844806d05e313421a73c1981f284ce145a3398ec29b012aba01f92a905486fcb865afb2aec0bb1ab4f0e872
6
+ metadata.gz: 8cf4f8d4fd1431dcd85c18898931fdf7d9140f0bea53674a03150a45f467b7f56964106c44e179192569473801e841d44111085b00e814a61274b0f9eeba311e
7
+ data.tar.gz: 0d5709fbd24faaa3162bc6ec7d274ea527944caed7390e024c8c6467c1eba32b44f1dd9355ea764607f1d38e2796cf00a4a32b74efff65c0dfdf62e75315026b
@@ -36,6 +36,7 @@ class Applitools::Appium::Eyes < Applitools::Selenium::SeleniumEyes
36
36
  self.tag_for_debug = name
37
37
  Applitools::ArgumentGuard.one_of? target, 'target', [Applitools::Selenium::Target, Applitools::Appium::Target]
38
38
 
39
+ return universal_check(name, target)
39
40
  return check_native(name, target) if native_app?
40
41
  super
41
42
  end
@@ -83,8 +84,8 @@ class Applitools::Appium::Eyes < Applitools::Selenium::SeleniumEyes
83
84
  self.screenshot = screenshot_class.new(
84
85
  Applitools::Screenshot.from_image(
85
86
  case scaled_image
86
- when ChunkyPNG::Image
87
- scaled_image
87
+ # when ChunkyPNG::Image
88
+ # scaled_image
88
89
  when Applitools::Screenshot::Datastream
89
90
  scaled_image.image
90
91
  else
@@ -2,207 +2,232 @@
2
2
 
3
3
  module Applitools
4
4
  module Appium
5
- class Target
6
- include Applitools::FluentInterface
7
- attr_accessor :region_to_check, :options, :ignored_regions, :floating_regions, :layout_regions, :content_regions, :strict_regions, :accessibility_regions
8
-
9
- class << self
10
- def window
11
- new
12
- end
13
-
14
- def region(*args)
15
- new.region(*args)
16
- end
17
- end
18
-
19
- def initialize
20
- self.region_to_check = proc { Applitools::Region::EMPTY }
21
- self.ignored_regions = []
22
- self.floating_regions = []
23
- self.layout_regions = []
24
- self.content_regions = []
25
- self.strict_regions = []
26
- self.accessibility_regions = []
27
- self.options = {}
28
- end
29
-
30
- def region(*args)
31
- self.region_to_check = case args.first
32
- when ::Selenium::WebDriver::Element
33
- proc { args.first }
34
- else
35
- proc do |driver|
36
- driver.find_element(*args)
37
- end
38
- end
39
- self
40
- end
5
+ class Target < Applitools::Selenium::Target
41
6
 
42
7
  def ignore(*args)
43
- requested_padding = if args.last.is_a? Applitools::PaddingBounds
44
- args.pop
45
- else
46
- Applitools::PaddingBounds::ZERO_PADDING
47
- end
48
- ignored_regions << case (first_argument = args.first)
49
- when ::Selenium::WebDriver::Element
50
- proc do
51
- Applitools::Region
52
- .from_location_size(first_argument.location, first_argument.size)
53
- .padding(requested_padding)
54
- end
55
- when Applitools::Region
56
- result = first_argument.padding(requested_padding)
57
- if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
58
- def result.converted?
59
- true
60
- end
61
- end
62
- result
63
- else
64
- proc do |driver|
65
- element = driver.find_element(*args)
66
- Applitools::Region
67
- .from_location_size(element.location, element.size)
68
- .padding(requested_padding)
69
- end
70
- end
71
- self
72
- end
73
-
74
- def floating(*args)
75
- value = case args.first
76
- when Applitools::FloatingRegion
77
- args.first
78
- when Applitools::Region
79
- result = Applitools::FloatingRegion.any(*args)
80
- if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
81
- def result.converted?
82
- true
83
- end
84
- end
85
- result
86
- when ::Selenium::WebDriver::Element
87
- args_dup = args.dup
88
- Applitools::FloatingRegion.any(*args_dup)
89
- else
90
- proc do |driver|
91
- args_dup = args.dup
92
- region = driver.find_element(args_dup.shift, args_dup.shift)
93
- Applitools::FloatingRegion.any(
94
- region, *args_dup
95
- )
96
- end
97
- end
98
- floating_regions << value
99
- self
100
- end
101
-
102
- def layout
103
- return match_level(Applitools::MatchLevel::LAYOUT) if args.empty?
104
- region = process_region(*args)
105
- layout_regions << region
106
- self
107
-
108
- end
109
-
110
- def content(*args)
111
- return match_level(Applitools::MatchLevel::CONTENT) if args.empty?
112
- region = process_region(*args)
113
- content_regions << region
114
- self
115
- end
116
-
117
- def strict(*args)
118
- return match_level(Applitools::MatchLevel::STRICT) if args.empty?
119
- region = process_region(*args)
120
- strict_regions << region
121
- self
122
- end
123
-
124
- def exact(*args)
125
- match_level(Applitools::MatchLevel::EXACT, *args)
126
- end
127
-
128
- def accessibility(*args)
129
- options = Applitools::Utils.extract_options! args
130
- unless options[:type]
131
- raise Applitools::EyesError,
132
- 'You should call Target.accessibility(region, type: type). The region_type option is required'
133
- end
134
- unless Applitools::AccessibilityRegionType.enum_values.include?(options[:type])
135
- raise Applitools::EyesIllegalArgument,
136
- "The region type should be one of [#{Applitools::AccessibilityRegionType.enum_values.join(', ')}]"
8
+ if args.empty?
9
+ reset_ignore
10
+ else
11
+ value = convert_to_universal(args)
12
+ value = { type: args[0], selector: args[1] } if value.nil?
13
+ # value = value[:selector] if value.is_a?(Hash) && (value[:type].to_s === 'id') && !is_a?(Applitools::Appium::Target)
14
+ ignored_regions << value
137
15
  end
138
-
139
- accessibility_regions << case args.first
140
- when ::Selenium::WebDriver::Element
141
- element = args.first
142
- Applitools::AccessibilityRegion.new(
143
- element,
144
- options[:type]
145
- )
146
- when Applitools::Region
147
- result = Applitools::AccessibilityRegion.new(
148
- args.first, options[:type]
149
- )
150
- if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
151
- def result.converted?
152
- true
153
- end
154
- end
155
- result
156
- when String
157
- proc do |driver|
158
- element = driver.find_element(name_or_id: args.first)
159
- Applitools::AccessibilityRegion.new(
160
- element,
161
- options[:type]
162
- )
163
- end
164
- else
165
- proc do |driver|
166
- elements = driver.find_elements(*args)
167
- elements.map do |e|
168
- Applitools::AccessibilityRegion.new(
169
- e,
170
- options[:type]
171
- )
172
- end
173
- end
174
- end
175
16
  self
176
17
  end
177
18
 
178
- def finalize
19
+ def region(*args)
20
+ value = convert_to_universal(args)
21
+ value = { type: args[0], selector: args[1] } if value.nil?
22
+ # value = value[:selector] if value.is_a?(Hash) && (value[:type].to_s === 'id') && !is_a?(Applitools::Appium::Target)
23
+ self.region_to_check = value
24
+ self.coordinate_type = Applitools::EyesScreenshot::COORDINATE_TYPES[:context_relative]
25
+ options[:timeout] = nil
26
+ reset_ignore
27
+ reset_floating
179
28
  self
180
29
  end
181
-
182
- private
183
-
184
- def process_region(*args)
185
- r = args.first
186
- case r
187
- when ::Selenium::WebDriver::Element
188
- proc do |driver|
189
- Applitools::Region.from_location_size(r.location, r.size)
190
- end
191
- when Applitools::Region
192
- if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
193
- def r.converted?
194
- true
195
- end
196
- end
197
- r
198
- else
199
- proc do |driver|
200
- element = driver.find_element(*args)
201
- Applitools::Region.from_location_size(element.location, element.size)
202
- end
203
- end
204
- end
205
-
30
+ # class Target
31
+ # include Applitools::FluentInterface
32
+ # attr_accessor :region_to_check, :options, :ignored_regions, :floating_regions, :layout_regions, :content_regions, :strict_regions, :accessibility_regions
33
+ #
34
+ # class << self
35
+ # def window
36
+ # new
37
+ # end
38
+ #
39
+ # def region(*args)
40
+ # new.region(*args)
41
+ # end
42
+ # end
43
+ #
44
+ # def initialize
45
+ # self.region_to_check = proc { Applitools::Region::EMPTY }
46
+ # self.ignored_regions = []
47
+ # self.floating_regions = []
48
+ # self.layout_regions = []
49
+ # self.content_regions = []
50
+ # self.strict_regions = []
51
+ # self.accessibility_regions = []
52
+ # self.options = {}
53
+ # end
54
+ #
55
+ # def region(*args)
56
+ # self.region_to_check = case args.first
57
+ # when ::Selenium::WebDriver::Element
58
+ # proc { args.first }
59
+ # else
60
+ # proc do |driver|
61
+ # driver.find_element(*args)
62
+ # end
63
+ # end
64
+ # self
65
+ # end
66
+ #
67
+ # def ignore(*args)
68
+ # requested_padding = if args.last.is_a? Applitools::PaddingBounds
69
+ # args.pop
70
+ # else
71
+ # Applitools::PaddingBounds::ZERO_PADDING
72
+ # end
73
+ # ignored_regions << case (first_argument = args.first)
74
+ # when ::Selenium::WebDriver::Element
75
+ # proc do
76
+ # Applitools::Region
77
+ # .from_location_size(first_argument.location, first_argument.size)
78
+ # .padding(requested_padding)
79
+ # end
80
+ # when Applitools::Region
81
+ # result = first_argument.padding(requested_padding)
82
+ # if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
83
+ # def result.converted?
84
+ # true
85
+ # end
86
+ # end
87
+ # result
88
+ # else
89
+ # proc do |driver|
90
+ # element = driver.find_element(*args)
91
+ # Applitools::Region
92
+ # .from_location_size(element.location, element.size)
93
+ # .padding(requested_padding)
94
+ # end
95
+ # end
96
+ # self
97
+ # end
98
+ #
99
+ # def floating(*args)
100
+ # value = case args.first
101
+ # when Applitools::FloatingRegion
102
+ # args.first
103
+ # when Applitools::Region
104
+ # result = Applitools::FloatingRegion.any(*args)
105
+ # if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
106
+ # def result.converted?
107
+ # true
108
+ # end
109
+ # end
110
+ # result
111
+ # when ::Selenium::WebDriver::Element
112
+ # args_dup = args.dup
113
+ # Applitools::FloatingRegion.any(*args_dup)
114
+ # else
115
+ # proc do |driver|
116
+ # args_dup = args.dup
117
+ # region = driver.find_element(args_dup.shift, args_dup.shift)
118
+ # Applitools::FloatingRegion.any(
119
+ # region, *args_dup
120
+ # )
121
+ # end
122
+ # end
123
+ # floating_regions << value
124
+ # self
125
+ # end
126
+ #
127
+ # def layout
128
+ # return match_level(Applitools::MatchLevel::LAYOUT) if args.empty?
129
+ # region = process_region(*args)
130
+ # layout_regions << region
131
+ # self
132
+ #
133
+ # end
134
+ #
135
+ # def content(*args)
136
+ # return match_level(Applitools::MatchLevel::CONTENT) if args.empty?
137
+ # region = process_region(*args)
138
+ # content_regions << region
139
+ # self
140
+ # end
141
+ #
142
+ # def strict(*args)
143
+ # return match_level(Applitools::MatchLevel::STRICT) if args.empty?
144
+ # region = process_region(*args)
145
+ # strict_regions << region
146
+ # self
147
+ # end
148
+ #
149
+ # def exact(*args)
150
+ # match_level(Applitools::MatchLevel::EXACT, *args)
151
+ # end
152
+ #
153
+ # def accessibility(*args)
154
+ # options = Applitools::Utils.extract_options! args
155
+ # unless options[:type]
156
+ # raise Applitools::EyesError,
157
+ # 'You should call Target.accessibility(region, type: type). The region_type option is required'
158
+ # end
159
+ # unless Applitools::AccessibilityRegionType.enum_values.include?(options[:type])
160
+ # raise Applitools::EyesIllegalArgument,
161
+ # "The region type should be one of [#{Applitools::AccessibilityRegionType.enum_values.join(', ')}]"
162
+ # end
163
+ #
164
+ # accessibility_regions << case args.first
165
+ # when ::Selenium::WebDriver::Element
166
+ # element = args.first
167
+ # Applitools::AccessibilityRegion.new(
168
+ # element,
169
+ # options[:type]
170
+ # )
171
+ # when Applitools::Region
172
+ # result = Applitools::AccessibilityRegion.new(
173
+ # args.first, options[:type]
174
+ # )
175
+ # if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
176
+ # def result.converted?
177
+ # true
178
+ # end
179
+ # end
180
+ # result
181
+ # when String
182
+ # proc do |driver|
183
+ # element = driver.find_element(name_or_id: args.first)
184
+ # Applitools::AccessibilityRegion.new(
185
+ # element,
186
+ # options[:type]
187
+ # )
188
+ # end
189
+ # else
190
+ # proc do |driver|
191
+ # elements = driver.find_elements(*args)
192
+ # elements.map do |e|
193
+ # Applitools::AccessibilityRegion.new(
194
+ # e,
195
+ # options[:type]
196
+ # )
197
+ # end
198
+ # end
199
+ # end
200
+ # self
201
+ # end
202
+ #
203
+ # def finalize
204
+ # self
205
+ # end
206
+ #
207
+ # private
208
+ #
209
+ # def process_region(*args)
210
+ # r = args.first
211
+ # case r
212
+ # when ::Selenium::WebDriver::Element
213
+ # proc do |driver|
214
+ # Applitools::Region.from_location_size(r.location, r.size)
215
+ # end
216
+ # when Applitools::Region
217
+ # if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
218
+ # def r.converted?
219
+ # true
220
+ # end
221
+ # end
222
+ # r
223
+ # else
224
+ # proc do |driver|
225
+ # element = driver.find_element(*args)
226
+ # Applitools::Region.from_location_size(element.location, element.size)
227
+ # end
228
+ # end
229
+ # end
230
+ #
206
231
  end
207
232
  end
208
233
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Applitools
4
- VERSION = '3.18.4'.freeze
4
+ VERSION = '4.0.3'.freeze
5
+ UNIVERSAL_VERSION = '2.5.7'.freeze
5
6
  end
data/lib/eyes_appium.rb CHANGED
@@ -9,7 +9,9 @@ if defined? Appium::Driver
9
9
  Appium::Core::Base::Driver.class_eval do
10
10
  def driver_for_eyes(eyes)
11
11
  if defined? Appium
12
- Appium.promote_appium_methods(Applitools::Appium::Driver::AppiumLib)
12
+ if driver.public_methods(false).none? {|k| Applitools::Appium::Driver::AppiumLib.method_defined?(k) }
13
+ Appium.promote_appium_methods(Applitools::Appium::Driver::AppiumLib)
14
+ end
13
15
  end
14
16
  Applitools::Appium::Driver.new(eyes, driver: self, is_mobile_device: true)
15
17
  end
@@ -17,7 +19,9 @@ if defined? Appium::Driver
17
19
 
18
20
  Appium::Driver.class_eval do
19
21
  def driver_for_eyes(eyes)
20
- Appium.promote_appium_methods(Applitools::Appium::Driver::AppiumLib, self)
22
+ if driver.public_methods(false).none? {|k| Applitools::Appium::Driver::AppiumLib.method_defined?(k) }
23
+ Appium.promote_appium_methods(Applitools::Appium::Driver::AppiumLib, self)
24
+ end
21
25
  started_driver = self.http_client ? self.driver : self.start_driver
22
26
  Applitools::Appium::Driver.new(eyes, driver: started_driver, is_mobile_device: true)
23
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eyes_appium
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.18.4
4
+ version: 4.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Applitools Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-31 00:00:00.000000000 Z
11
+ date: 2022-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eyes_selenium
@@ -16,26 +16,26 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.18.4
19
+ version: 4.0.3
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.18.4
26
+ version: 4.0.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: appium_lib
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 10.6.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 10.6.0
41
41
  description: Appium support for Applitools Ruby SDK