eyes_appium 3.18.4 → 4.0.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 +4 -4
- data/lib/applitools/appium/eyes.rb +1 -0
- data/lib/applitools/appium/target.rb +218 -193
- data/lib/applitools/version.rb +2 -1
- data/lib/eyes_appium.rb +6 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1df702beb615a35982abc497e4b60319188d7cd
|
4
|
+
data.tar.gz: 655084494906b2d0d083f65b391c90b411eaaa59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d72300c96ec1d801fa98901c6576bae9ec6b79c235750af4142f8bdc5b716c393dcbb98babfc67a034821955fdeda6d2bb78925461a7a0b2c29b376dff83079
|
7
|
+
data.tar.gz: 47bb8d0976fac4a00e2fd787db343483e39096ac6bc67a62541883f8d5a53c20edb9573ce81e4174ff9b81f10ba07ce9b0cce451defe0de2459817979db09e40
|
@@ -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
|
@@ -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
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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
|
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
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
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
|
data/lib/applitools/version.rb
CHANGED
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
|
-
|
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
|
-
|
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:
|
4
|
+
version: 4.0.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:
|
11
|
+
date: 2022-01-24 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:
|
19
|
+
version: 4.0.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:
|
26
|
+
version: 4.0.0
|
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
|