Class: TestCentricity::BaseScreenSectionObject
- Inherits:
-
Object
- Object
- TestCentricity::BaseScreenSectionObject
show all
- Defined in:
- lib/testcentricity/app_core/screen_objects_helper.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.trait(trait_name, &block) ⇒ Object
Define a trait for this screen or section object.
14
15
16
|
# File 'lib/testcentricity/app_core/screen_objects_helper.rb', line 14
def self.trait(trait_name, &block)
define_method(trait_name.to_s, &block)
end
|
Instance Method Details
#populate_data_fields(data, wait_time = nil) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/testcentricity/app_core/screen_objects_helper.rb', line 18
def populate_data_fields(data, wait_time = nil)
timeout = wait_time.nil? ? 5 : wait_time
data.each do |data_field, data_param|
unless data_param.blank?
data_field.wait_until_visible(timeout)
if data_param == '!DELETE'
data_field.clear
else
case data_field.get_object_type
when :checkbox
data_field.set_checkbox_state(data_param.to_bool)
when :textfield
data_field.clear
data_field.set(data_param)
end
end
end
end
end
|
#verify_ui_states(ui_states) ⇒ Object
39
40
41
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# File 'lib/testcentricity/app_core/screen_objects_helper.rb', line 39
def verify_ui_states(ui_states)
ui_states.each do |ui_object, object_states|
object_states.each do |property, state|
puts "#{ui_object.get_name} - #{property} = #{state}" if ENV['DEBUG']
case property
when :class
actual = ui_object.get_attribute(:class)
when :exists
actual = ui_object.exists?
when :enabled
actual = ui_object.enabled?
when :disabled
actual = ui_object.disabled?
when :visible
actual = ui_object.visible?
when :hidden
actual = ui_object.hidden?
when :checked
actual = ui_object.checked?
when :selected
actual = ui_object.selected?
when :value
actual = ui_object.get_value
when :caption
actual = ui_object.get_caption
when :name
actual = ui_object.tag_name
when :placeholder
actual = ui_object.get_placeholder
when :readonly
actual = ui_object.read_only?
when :maxlength
actual = ui_object.get_max_length
when :items
actual = ui_object.get_list_items
when :itemcount
actual = ui_object.get_item_count
when :width
actual = ui_object.width
when :height
actual = ui_object.height
when :x
actual = ui_object.x_loc
when :y
actual = ui_object.y_loc
end
error_msg = "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) #{property} property to"
ExceptionQueue.enqueue_comparison(ui_object, state, actual, error_msg)
end
end
rescue ObjectNotFoundError => e
ExceptionQueue.enqueue_exception(e.message)
ensure
ExceptionQueue.post_exceptions
end
|