Class: YuiRestClient::Widgets::Menucollection

Inherits:
Base
  • Object
show all
Defined in:
lib/yui_rest_client/widgets/menucollection.rb

Overview

Class representing a menucollection in UI. It can be YMenuButton, YMenuBar.

Instance Method Summary collapse

Methods inherited from Base

#action, #collect_all, #debug_label, #enabled?, #exists?, #initialize, #property

Methods included from YuiRestClient::Waitable

#wait_until, #wait_while

Constructor Details

This class inherits a constructor from YuiRestClient::Widgets::Base

Instance Method Details

#click(path) ⇒ Object

Sends action to click one item of a menu (menu button or menu bar) in UI. with id ‘test_id’.

Examples:

Click menu item with label ‘sub_menu_item’ for menucollection

app.menucollection(id: 'test_id').click('menu_item|sub_menu_item')

Parameters:

  • path (String)

    value to select from menu.



13
14
15
# File 'lib/yui_rest_client/widgets/menucollection.rb', line 13

def click(path)
  action(action: Actions::SELECT, value: path)
end

#itemsArray<String>

Returns the list of items available to select from widget.

Examples:

Get items from widget with id “test_id”

{
  "class": "YMenuButton",
  "debug_label": "test",
  "icon_base_path": "",
  "id": "test_id",
  "items": [
    {
      "label": "button1"
    },
    {
      "label": "button2"
    },
    {
      "label": "button3"
    }
  ],
  "items_count": 3,
  "label": "button group"
}
app.menucollection(id: 'test').items
# button1
# button2
# button3

Returns:

  • (Array<String>)

    array of strings.



44
45
46
# File 'lib/yui_rest_client/widgets/menucollection.rb', line 44

def items
  property(:items).map { |x| x[:label] }
end