Class: TestCentricity::MenuBar

Inherits:
ScreenSection show all
Defined in:
lib/testcentricity_apps/app_elements/menubar.rb

Instance Attribute Summary

Attributes inherited from ScreenSection

#context, #list_index, #locator, #name, #parent, #parent_list

Instance Method Summary collapse

Methods inherited from ScreenSection

button, buttons, checkbox, checkboxes, #click, define_section_element, #disabled?, #double_tap, element, elements, #enabled?, #exists?, #get_locator, #get_name, #height, #hidden?, #identifier, image, images, label, labels, list, lists, #long_press, menu, menus, radio, radios, #scroll_into_view, section, sections, selectlist, selectlists, #send_keys, #set_list_index, #set_parent, switch, switches, table, tables, #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)' } }
  menu_list.define_list_elements(list_elements)
end

Instance Method Details

#get_item_countInteger

Return the number of menus in a MenuBar object.

Examples:

num_menus = menu_bar.get_item_count

Returns:

  • (Integer)


27
28
29
# File 'lib/testcentricity_apps/app_elements/menubar.rb', line 27

def get_item_count
  menu_list.get_item_count
end

#get_menubar_item(index) ⇒ String Also known as: get_list_item

Return text caption of menu item at specified index.

Examples:

menubar_item_text = menu_bar.get_menubar_item(3)

Returns:



49
50
51
52
# File 'lib/testcentricity_apps/app_elements/menubar.rb', line 49

def get_menubar_item(index)
  items = get_list_items
  items[index - 1]
end

#get_menubar_itemsArray Also known as: get_list_items

Return array of strings of all menus in a MenuBar object.

Examples:

menu_items = menu_bar.get_menubar_items

Returns:

  • (Array)


37
38
39
# File 'lib/testcentricity_apps/app_elements/menubar.rb', line 37

def get_menubar_items
  menu_list.get_list_items
end

#get_object_typeObject



17
18
19
# File 'lib/testcentricity_apps/app_elements/menubar.rb', line 17

def get_object_type
  :menubar
end