Class: TestCentricity::MenuBar
- Inherits:
-
ScreenSection
- Object
- BaseScreenSectionObject
- ScreenSection
- TestCentricity::MenuBar
- Defined in:
- lib/testcentricity_apps/app_elements/menubar.rb
Instance Attribute Summary
Attributes inherited from ScreenSection
#context, #list_index, #locator, #name, #parent, #parent_list
Class Method Summary collapse
-
.menu(element_name, locator) ⇒ Object
Declare and instantiate a single menu UI Element for this MenuBar object.
-
.menus(element_hash) ⇒ Object
Declare and instantiate a collection of menus for this MenuBar object.
Instance Method Summary collapse
-
#get_item_count ⇒ Integer
Return the number of menus in a MenuBar object.
-
#get_menubar_item(index) ⇒ String
(also: #get_list_item)
Return text caption of menu item at specified index.
-
#get_menubar_items ⇒ Array
(also: #get_list_items)
Return array of strings of all menus in a MenuBar object.
- #get_object_type ⇒ Object
-
#initialize(name, parent, locator, context) ⇒ MenuBar
constructor
A new instance of MenuBar.
Methods inherited from ScreenSection
button, buttons, checkbox, checkboxes, #click, #disabled?, #double_tap, element, elements, #enabled?, #exists?, #get_locator, #get_name, #height, #hidden?, #identifier, image, images, label, labels, list, lists, #long_press, radio, radios, #scroll_into_view, section, sections, selectlist, selectlists, #send_keys, #set_list_index, #set_parent, switch, switches, #tap, textfield, textfields, #visible?, #wait_until_exists, #wait_until_gone, #wait_until_hidden, #wait_until_visible, #width, #x_loc, #y_loc
Methods inherited from BaseScreenSectionObject
#populate_data_fields, #swipe_gesture, trait, #verify_ui_states
Constructor Details
#initialize(name, parent, locator, context) ⇒ MenuBar
Returns a new instance of MenuBar.
9 10 11 12 13 14 15 |
# File 'lib/testcentricity_apps/app_elements/menubar.rb', line 9 def initialize(name, parent, locator, context) super @parent = nil # define the menu bar item element for the menu bar list object list_elements = { list_item: { xpath: '(//XCUIElementTypeMenuBarItem)' } } .define_list_elements(list_elements) end |
Class Method Details
.menu(element_name, locator) ⇒ Object
Declare and instantiate a single menu UI Element for this MenuBar object.
28 29 30 |
# File 'lib/testcentricity_apps/app_elements/menubar.rb', line 28 def self.(element_name, locator) define_section_element(element_name, TestCentricity::AppElements::AppMenu, locator) end |
.menus(element_hash) ⇒ Object
Declare and instantiate a collection of menus for this MenuBar object.
39 40 41 |
# File 'lib/testcentricity_apps/app_elements/menubar.rb', line 39 def self.(element_hash) element_hash.each_pair { |element_name, locator| (element_name, locator) } end |
Instance Method Details
#get_item_count ⇒ Integer
Return the number of menus in a MenuBar object.
49 50 51 |
# File 'lib/testcentricity_apps/app_elements/menubar.rb', line 49 def get_item_count .get_item_count end |
#get_menubar_item(index) ⇒ String Also known as: get_list_item
Return text caption of menu item at specified index.
71 72 73 74 |
# File 'lib/testcentricity_apps/app_elements/menubar.rb', line 71 def (index) items = get_list_items items[index - 1] end |
#get_menubar_items ⇒ Array Also known as: get_list_items
Return array of strings of all menus in a MenuBar object.
59 60 61 |
# File 'lib/testcentricity_apps/app_elements/menubar.rb', line 59 def .get_list_items end |
#get_object_type ⇒ Object
17 18 19 |
# File 'lib/testcentricity_apps/app_elements/menubar.rb', line 17 def get_object_type :menubar end |