Class: TestCentricity::AppCheckBox

Inherits:
AppUIElement show all
Defined in:
lib/testcentricity/app_elements/checkbox.rb

Instance Attribute Summary

Attributes inherited from AppUIElement

#context, #locator, #name, #parent, #type

Instance Method Summary collapse

Methods inherited from AppUIElement

#clear, #click, #disabled?, #double_tap, #enabled?, #exists?, #get_attribute, #get_caption, #get_locator, #get_name, #get_object_type, #get_value, #height, #hidden?, #scroll, #selected?, #send_keys, #set, #swipe, #tag_name, #tap, #visible?, #wait_until_enabled, #wait_until_exists, #wait_until_gone, #wait_until_hidden, #wait_until_value_changes, #wait_until_value_is, #wait_until_visible, #width, #x_loc, #y_loc

Constructor Details

#initialize(name, parent, locator, context) ⇒ AppCheckBox

Returns a new instance of AppCheckBox.



3
4
5
6
# File 'lib/testcentricity/app_elements/checkbox.rb', line 3

def initialize(name, parent, locator, context)
  super
  @type  = :checkbox
end

Instance Method Details

#checkObject

Set the check state of a checkbox object.

Examples:

remember_me_checkbox.check


19
20
21
# File 'lib/testcentricity/app_elements/checkbox.rb', line 19

def check
  set_checkbox_state(true)
end

#checked?Boolean

Returns:

  • (Boolean)


8
9
10
11
12
# File 'lib/testcentricity/app_elements/checkbox.rb', line 8

def checked?
  obj = element
  object_not_found_exception(obj)
  obj.selected?
end

#set_checkbox_state(state) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/testcentricity/app_elements/checkbox.rb', line 32

def set_checkbox_state(state)
  obj = element
  object_not_found_exception(obj)
  if state
    obj.click unless obj.selected?
  else
    obj.click if obj.selected?
  end
end

#uncheckObject

Uncheck a checkbox object.

Examples:

remember_me_checkbox.uncheck


28
29
30
# File 'lib/testcentricity/app_elements/checkbox.rb', line 28

def uncheck
  set_checkbox_state(false)
end