Class: Applitools::Appium::Target
- Inherits:
-
Object
- Object
- Applitools::Appium::Target
show all
- Includes:
- FluentInterface
- Defined in:
- lib/applitools/appium/target.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#enable_patterns, #ignore_caret, #ignore_displacements, #ignore_mismatch, included, #match_level, #timeout, #trim
#match_level_with_exact
Constructor Details
#initialize ⇒ Target
Returns a new instance of Target.
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/applitools/appium/target.rb', line 19
def initialize
self.region_to_check = proc { Applitools::Region::EMPTY }
self.ignored_regions = []
self.floating_regions = []
self.layout_regions = []
self.content_regions = []
self.strict_regions = []
self.accessibility_regions = []
self.options = {}
end
|
Instance Attribute Details
#accessibility_regions ⇒ Object
Returns the value of attribute accessibility_regions.
7
8
9
|
# File 'lib/applitools/appium/target.rb', line 7
def accessibility_regions
@accessibility_regions
end
|
#content_regions ⇒ Object
Returns the value of attribute content_regions.
7
8
9
|
# File 'lib/applitools/appium/target.rb', line 7
def content_regions
@content_regions
end
|
#floating_regions ⇒ Object
Returns the value of attribute floating_regions.
7
8
9
|
# File 'lib/applitools/appium/target.rb', line 7
def floating_regions
@floating_regions
end
|
#ignored_regions ⇒ Object
Returns the value of attribute ignored_regions.
7
8
9
|
# File 'lib/applitools/appium/target.rb', line 7
def ignored_regions
@ignored_regions
end
|
#layout_regions ⇒ Object
Returns the value of attribute layout_regions.
7
8
9
|
# File 'lib/applitools/appium/target.rb', line 7
def layout_regions
@layout_regions
end
|
#options ⇒ Object
Returns the value of attribute options.
7
8
9
|
# File 'lib/applitools/appium/target.rb', line 7
def options
@options
end
|
#region_to_check ⇒ Object
Returns the value of attribute region_to_check.
7
8
9
|
# File 'lib/applitools/appium/target.rb', line 7
def region_to_check
@region_to_check
end
|
#strict_regions ⇒ Object
Returns the value of attribute strict_regions.
7
8
9
|
# File 'lib/applitools/appium/target.rb', line 7
def strict_regions
@strict_regions
end
|
Class Method Details
.region(*args) ⇒ Object
14
15
16
|
# File 'lib/applitools/appium/target.rb', line 14
def region(*args)
new.region(*args)
end
|
.window ⇒ Object
10
11
12
|
# File 'lib/applitools/appium/target.rb', line 10
def window
new
end
|
Instance Method Details
#accessibility(*args) ⇒ Object
#content(*args) ⇒ Object
110
111
112
113
114
115
|
# File 'lib/applitools/appium/target.rb', line 110
def content(*args)
return match_level(Applitools::MatchLevel::CONTENT) if args.empty?
region = process_region(*args)
content_regions << region
self
end
|
#exact(*args) ⇒ Object
124
125
126
|
# File 'lib/applitools/appium/target.rb', line 124
def exact(*args)
match_level(Applitools::MatchLevel::EXACT, *args)
end
|
#finalize ⇒ Object
178
179
180
|
# File 'lib/applitools/appium/target.rb', line 178
def finalize
self
end
|
#floating(*args) ⇒ Object
#ignore(*args) ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/applitools/appium/target.rb', line 42
def ignore(*args)
requested_padding = if args.last.is_a? Applitools::PaddingBounds
args.pop
else
Applitools::PaddingBounds::ZERO_PADDING
end
ignored_regions << case (first_argument = args.first)
when ::Selenium::WebDriver::Element
proc do
Applitools::Region
.from_location_size(first_argument.location, first_argument.size)
.padding(requested_padding)
end
when Applitools::Region
result = first_argument.padding(requested_padding)
if Applitools::Appium::Utils.ios?(Applitools::Appium::Driver::AppiumLib)
def result.converted?
true
end
end
result
else
proc do |driver|
element = driver.find_element(*args)
Applitools::Region
.from_location_size(element.location, element.size)
.padding(requested_padding)
end
end
self
end
|
#layout ⇒ Object
102
103
104
105
106
107
108
|
# File 'lib/applitools/appium/target.rb', line 102
def layout
return match_level(Applitools::MatchLevel::LAYOUT) if args.empty?
region = process_region(*args)
layout_regions << region
self
end
|
#region(*args) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/applitools/appium/target.rb', line 30
def region(*args)
self.region_to_check = case args.first
when ::Selenium::WebDriver::Element
proc { args.first }
else
proc do |driver|
driver.find_element(*args)
end
end
self
end
|
#strict(*args) ⇒ Object
117
118
119
120
121
122
|
# File 'lib/applitools/appium/target.rb', line 117
def strict(*args)
return match_level(Applitools::MatchLevel::STRICT) if args.empty?
region = process_region(*args)
strict_regions << region
self
end
|