Class: AePageObjects::ElementProxy
- Inherits:
-
Object
- Object
- AePageObjects::ElementProxy
show all
- Defined in:
- lib/ae_page_objects/element_proxy.rb
Instance Method Summary
collapse
Constructor Details
#initialize(element_class, *args) ⇒ ElementProxy
Returns a new instance of ElementProxy.
14
15
16
17
|
# File 'lib/ae_page_objects/element_proxy.rb', line 14
def initialize(element_class, *args)
@element_class = element_class
@args = args
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
59
60
61
62
63
64
65
|
# File 'lib/ae_page_objects/element_proxy.rb', line 59
def method_missing(name, *args, &block)
if name == "class"
return @element_class
end
element.__send__(name, *args, &block)
end
|
Instance Method Details
#is_a?(type) ⇒ Boolean
51
52
53
|
# File 'lib/ae_page_objects/element_proxy.rb', line 51
def is_a?(type)
type == @element_class || type == ElementProxy
end
|
#kind_of?(type) ⇒ Boolean
55
56
57
|
# File 'lib/ae_page_objects/element_proxy.rb', line 55
def kind_of?(type)
is_a?(type)
end
|
#not_present? ⇒ Boolean
39
40
41
42
43
|
# File 'lib/ae_page_objects/element_proxy.rb', line 39
def not_present?
Waiter.wait_for do
! present?
end
end
|
#not_visible? ⇒ Boolean
28
29
30
31
32
33
|
# File 'lib/ae_page_objects/element_proxy.rb', line 28
def not_visible?
Waiter.wait_for do
inst = presence
inst.nil? || ! inst.visible?
end
end
|
#presence ⇒ Object
45
46
47
48
49
|
# File 'lib/ae_page_objects/element_proxy.rb', line 45
def presence
element
rescue Capybara::ElementNotFound
nil
end
|
#present? ⇒ Boolean
35
36
37
|
# File 'lib/ae_page_objects/element_proxy.rb', line 35
def present?
! presence.nil?
end
|
#respond_to?(*args) ⇒ Boolean
67
68
69
|
# File 'lib/ae_page_objects/element_proxy.rb', line 67
def respond_to?(*args)
super || @element_class.allocate.respond_to?(*args)
end
|
#visible? ⇒ Boolean
Provided so that visible? can be asked without an explicit check for present? first.
21
22
23
24
25
26
|
# File 'lib/ae_page_objects/element_proxy.rb', line 21
def visible?
Waiter.wait_for do
inst = presence
!! inst && inst.visible?
end
end
|