-
Notifications
You must be signed in to change notification settings - Fork 67
/
menu.robot
143 lines (116 loc) · 5.6 KB
/
menu.robot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
*** Settings ***
Test Teardown selectMainWindow
Library TestSwingLibrary
*** Variables ***
${menuText} Test Menu
${showDialog} ${menuText}|Show Test Dialog
${mutableMenu} ${menuText}|Mutable Menu
${disabledMenu} ${menuText}|Disabled Menu Item
${checkboxMenu} Test menu checkbox
${radioButtonMenu} Test menu radiobutton
*** Test Cases ***
Select From Main Menu
selectEmptyContext
selectFromMainMenu ${showDialog}
dialogShouldBeOpen Message
closeDialog Message
Select From Main Menu And Wait
selectEmptyContext
selectFromMainMenuAndWait ${mutableMenu}
mainMenuItemShouldExist ${menuText}|Menu Item Was Pushed
Selecting Disabled Menu Item Should Fail
selectEmptyContext
runKeywordAndExpectError Menu item '${disabledMenu}' is disabled. selectFromMainMenu ${disabledMenu}
Menu Item Should Exist
menuItemShouldExist ${showDialog}
runKeywordAndExpectError Menu item 'unexisting|menu' does not exist. menuItemShouldExist unexisting|menu
Menu Item Should Not Exist
menuItemShouldNotExist unexisting|menu
runKeywordAndExpectError Menu item '${showDialog}' exists. menuItemShouldNotExist ${showDialog}
Main Menu Item Should Exist
selectEmptyContext
mainMenuItemShouldExist ${showDialog}
runKeywordAndExpectError Menu item 'unexisting|menu' does not exist. mainMenuItemShouldExist unexisting|menu
Main Menu Item Should Not Exist
selectEmptyContext
mainMenuItemShouldNotExist unexisting|menu
runKeywordAndExpectError Menu item '${showDialog}' exists. mainMenuItemShouldNotExist ${showDialog}
Menu Item Should Be Enabled
menuItemShouldBeEnabled ${showDialog}
Menu Item Should Be Disabled
menuItemShouldBeDisabled ${disabledMenu}
Get Menu Item Names
[Template] menuItemsShouldContain
Test Menu2|Sub Menu1 item 1
Test Menu2|Sub Menu1 item 2
Test Menu2|Sub Menu1 item 3
Test Menu2 placeholder item 1
Test Menu2 Sub Menu1
Test Menu2 placeholder item 2
Get Menu Item Names Failures
runKeywordAndExpectError Menu item 'unexisting|menu' does not exist.
... getMenuItemNames unexisting|menu
@{submenu}= getMenuItemNames Test Menu2|Sub Menu1|item 3
should be empty ${submenu}
@{submenu}= getMenuItemNames Test Menu2|empty menu
should be empty ${submenu}
Get Main Menu Item Name
mainMenuItemNameShouldBe 0 ${menuText}
Get Main Menu Item Names
mainMenuItemNamesShouldContain ${menuText}
Main Menu Item Should Be Selected
runKeywordAndExpectError Menu item '${menuText}|${checkboxMenu}' is not selected. mainMenuItemShouldBeChecked ${menuText}|${checkboxMenu}
selectFromMainMenuAndWait ${menuText}|${checkboxMenu}
mainMenuItemShouldBeChecked ${menuText}|${checkboxMenu}
[Teardown] selectFromMainMenuAndWait ${menuText}|${checkboxMenu}
Main Menu Item Should Not Be Selected
mainMenuItemShouldNotBeChecked ${menuText}|${checkboxMenu}
selectFromMainMenuAndWait ${menuText}|${checkboxMenu}
runKeywordAndExpectError Menu item '${menuText}|${checkboxMenu}' is selected. mainMenuItemShouldNotBeChecked ${menuText}|${checkboxMenu}
[Teardown] selectFromMainMenuAndWait ${menuText}|${checkboxMenu}
Menu Radio Item Should Be Selected
selectFromMainMenuAndWait ${menuText}|${radioButtonMenu}
radioMenuItemShouldBeSelected ${menuText}|${radioButtonMenu}
[Teardown] selectFromMainMenuAndWait ${menuText}|${radioButtonMenu}
Menu Radio Item Should Not Be Selected
selectFromMainMenuAndWait ${menuText}|${radioButtonMenu}
runKeywordAndExpectError Menu item '${menuText}|${radioButtonMenu}' is selected. radioMenuItemShouldNotBeSelected ${menuText}|${radioButtonMenu}
[Teardown] selectFromMainMenuAndWait ${menuText}|${radioButtonMenu}
Select From Popup Menu
selectFromPopupMenu testTextField Show name
selectDialog Message
# On Linux and Windows testTextField index is 0, on OSX it is 1. Using label name is a workaround.
${labelContents}= getLabelContent OptionPane.label
shouldBeEqual testTextField ${labelContents}
[Teardown] Run Keywords closeDialog Message AND Select main window
Get Menu Items From Popup Menu
${items}= getMenuItemsFromPopupMenu TableWithSingleValue ${EMPTY}
Should contain ${items} Replace text
Should contain ${items} Disabled menuitem
Should contain ${items} Submenu
Should contain ${items} Replace text in selected
Get Menu Items From Popup Menu's submenu
${items}= getMenuItemsFromPopupMenu TableWithSingleValue Submenu
Should contain ${items} Disabled menuitem
Should contain ${items} Enabled menuitem
Get Menu Items From Popup Menu contains no sub items
${items}= getMenuItemsFromPopupMenu TableWithSingleValue Replace text
Should be empty ${items}
Get Menu Items From Popup Menu's submenu contains no sub items
${items}= getMenuItemsFromPopupMenu TableWithSingleValue Submenu|Enabled menuitem
Should be empty ${items}
Get Menu Items From Popup Menu fails with non existing menu item
runKeywordAndExpectError Wait for "unexisting" subcomponent to be displayed getMenuItemsFromPopupMenu unexisting ${EMPTY}
*** Keywords ***
mainMenuItemNameShouldBe
[Arguments] ${menuItemIndex} ${expectedName}
${menuItemName}= getMainMenuItemName 0
shouldBeEqual ${expectedName} ${menuItemName}
mainMenuItemNamesShouldContain
[Arguments] ${expectedName}
@{menuItemNames}= getMainMenuItemNames
shouldContain ${menuItemNames} ${expectedName}
menuItemsShouldContain
[Arguments] ${path} ${item}
@{items}= getMenuItemNames ${path}
shouldContain ${items} ${item}