Class: TestCentricity::List
Instance Attribute Summary collapse
Attributes inherited from UIElement
#alt_locator, #context, #locator, #name, #parent, #type
Instance Method Summary
collapse
Methods inherited from UIElement
#clear_alt_locator, #click, #click_at, #disabled?, #double_click, #drag_and_drop, #drag_by, #enabled?, #exists?, #get_attribute, #get_locator, #get_name, #get_native_attribute, #get_object_type, #get_siebel_object_type, #get_value, #hidden?, #hover, #invoke_siebel_dialog, #right_click, #send_keys, #set, #set_alt_locator, #verify_value, #visible?, #wait_until_exists, #wait_until_gone, #wait_until_hidden, #wait_until_value_changes, #wait_until_value_is, #wait_until_visible
Constructor Details
#initialize(name, parent, locator, context) ⇒ List
Returns a new instance of List.
5
6
7
8
9
|
# File 'lib/testcentricity_web/elements/list.rb', line 5
def initialize(name, parent, locator, context)
super
@type = :list
define_list_elements({ :list_item => 'li' })
end
|
Instance Attribute Details
#list_item ⇒ Object
Returns the value of attribute list_item.
3
4
5
|
# File 'lib/testcentricity_web/elements/list.rb', line 3
def list_item
@list_item
end
|
Instance Method Details
#define_list_elements(element_spec) ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'lib/testcentricity_web/elements/list.rb', line 11
def define_list_elements(element_spec)
element_spec.each do |element, value|
case element
when :list_item
@list_item = value
end
end
end
|
#get_item_count ⇒ Object
32
33
34
35
36
|
# File 'lib/testcentricity_web/elements/list.rb', line 32
def get_item_count
obj, = find_element
object_not_found_exception(obj, nil)
obj.all(@list_item).count
end
|
#get_list_item(index) ⇒ Object
27
28
29
30
|
# File 'lib/testcentricity_web/elements/list.rb', line 27
def get_list_item(index)
items = get_list_items
items[index - 1]
end
|
#get_list_items(element_spec = nil) ⇒ Object
20
21
22
23
24
25
|
# File 'lib/testcentricity_web/elements/list.rb', line 20
def get_list_items(element_spec = nil)
define_list_elements(element_spec) unless element_spec.nil?
obj, = find_element
object_not_found_exception(obj, nil)
obj.all(@list_item).collect(&:text)
end
|
#get_list_row_locator(row) ⇒ Object
45
46
47
|
# File 'lib/testcentricity_web/elements/list.rb', line 45
def get_list_row_locator(row)
"#{@locator}/#{@list_item}[#{row}]"
end
|
#verify_list_items(expected, enqueue = false) ⇒ Object
38
39
40
41
42
43
|
# File 'lib/testcentricity_web/elements/list.rb', line 38
def verify_list_items(expected, enqueue = false)
actual = get_list_items
enqueue ?
ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list #{object_ref_message}") :
assert_equal(expected, actual, "Expected list #{object_ref_message} to be #{expected} but found #{actual}")
end
|