Class: TestCentricity::CheckBox
- Defined in:
- lib/testcentricity_web/elements/checkbox.rb
Instance Attribute Summary
Attributes inherited from UIElement
#alt_locator, #context, #locator, #parent, #type
Instance Method Summary collapse
-
#checked? ⇒ Boolean
Is checkbox checked?.
-
#initialize(parent, locator, context) ⇒ CheckBox
constructor
A new instance of CheckBox.
-
#set_checkbox_state(state) ⇒ Object
Set the check state of a checkbox object.
-
#set_siebel_checkbox_state(state) ⇒ Object
Set the check state of a Siebel OUI JCheckBox object.
- #verify_check_state(state, enqueue = false) ⇒ Object
Methods inherited from UIElement
#clear_alt_locator, #click, #click_at, #disabled?, #double_click, #drag_by, #enabled?, #exists?, #get_list_items, #get_locator, #get_object_type, #get_siebel_object_type, #get_value, #hidden?, #hover, #invoke_siebel_dialog, #send_keys, #set, #set_alt_locator, #verify_value, #visible?, #wait_until_exists, #wait_until_gone, #wait_until_value_changes, #wait_until_value_is
Constructor Details
#initialize(parent, locator, context) ⇒ CheckBox
Returns a new instance of CheckBox.
4 5 6 7 8 9 10 |
# File 'lib/testcentricity_web/elements/checkbox.rb', line 4 def initialize(parent, locator, context) @parent = parent @locator = locator @context = context @type = :checkbox @alt_locator = nil end |
Instance Method Details
#checked? ⇒ Boolean
Is checkbox checked?
18 19 20 21 22 |
# File 'lib/testcentricity_web/elements/checkbox.rb', line 18 def checked? obj, _ = find_element object_not_found_exception(obj, 'Checkbox') obj.checked? end |
#set_checkbox_state(state) ⇒ Object
Set the check state of a checkbox object.
30 31 32 33 34 35 |
# File 'lib/testcentricity_web/elements/checkbox.rb', line 30 def set_checkbox_state(state) obj, _ = find_element object_not_found_exception(obj, 'Checkbox') invalid_object_type_exception(obj, 'checkbox') obj.set(state) end |
#set_siebel_checkbox_state(state) ⇒ Object
Set the check state of a Siebel OUI JCheckBox object.
50 51 52 53 54 55 56 |
# File 'lib/testcentricity_web/elements/checkbox.rb', line 50 def set_siebel_checkbox_state(state) obj, _ = find_element object_not_found_exception(obj, 'Siebel checkbox') raise "#{locator} is not a Siebel CheckBox object" unless get_siebel_object_type == 'JCheckBox' expected = state.to_bool obj.click unless expected == obj.checked? end |
#verify_check_state(state, enqueue = false) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/testcentricity_web/elements/checkbox.rb', line 37 def verify_check_state(state, enqueue = false) actual = checked? enqueue ? ExceptionQueue.enqueue_assert_equal(state, actual, "Expected #{@locator}") : assert_equal(state, actual, "Expected #{@locator} to be #{state} but found #{actual} instead") end |