Skip to content

Commit

Permalink
Select From Popup Menu On Selected Tree Nodes does not check for item…
Browse files Browse the repository at this point in the history
… menu (#147)

* Select From Popup Menu On Selected Tree Nodes checks for menu item
  • Loading branch information
cristii006 authored Mar 31, 2021
1 parent 2855bae commit 1071079
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,23 @@ public void selectFromTreeNodePopupMenuInSeparateThread(String identifier, Strin
}

@RobotKeyword("Invokes a menu action on all the selected tree nodes.\n"
+ "Does not wait for a result.\n"
+ "If ``checkItemIsEnabled`` is set to False, it does not wait for a result, "
+ "so even if the menu item is disabled, the keyword does not fail .\n "
+ "By default `checkItemIsEnabled` is True. \n"
+ "Separator for items is ``|``.\n\n"
+ "Examples:\n"
+ "| `Select Tree Node` | myTree | Root|Folder1 |\n"
+ "| `Select Tree Node` | myTree | Root|Folder1 | true |\n"
+ "| `Select Tree Node` | myTree | Root|Folder2 |\n"
+ "| `Select From Popup Menu On Selected Tree Nodes` | myTree | Remove | ")
@ArgumentNames({"identifier", "menuPath"})
public void selectFromPopupMenuOnSelectedTreeNodes(String identifier, String menuPath) {
@ArgumentNames({"identifier", "menuPath", "checkItemIsEnabled=True"})
public void selectFromPopupMenuOnSelectedTreeNodes(String identifier, String menuPath, Boolean checkItemIsEnabled) {
JPopupMenuOperator popupOperator = treeOperator(identifier).createPopupOperatorOnSelectedNodes();
popupOperator.pushMenuNoBlock(menuPath, new EqualsStringComparator());
SwingWaiter.waitToAvoidInstability(300);
if (checkItemIsEnabled == Boolean.TRUE) {
popupOperator.pushMenu(menuPath, new EqualsStringComparator());
} else {
popupOperator.pushMenuNoBlock(menuPath, new EqualsStringComparator());
SwingWaiter.waitToAvoidInstability(300);
}
}

@RobotKeyword("Fails if given popup menu item is disabled.\n\n"
Expand Down
6 changes: 6 additions & 0 deletions src/test/resources/robot-tests/tree.robot
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,12 @@ Get Current Selection Paths
${selected_elements} = getSelectionPaths ${treeName}
listsShouldBeEqual ${selected_elements} ${expected_elements}

Select From Popup Menu On Selected Tree Nodes Check Menu Item
[Setup] resetNodes
selectNodes
selectFromPopupMenuOnSelectedTreeNodes ${treeName} Disabled menuitem False
Run Keyword And Expect Error Menu pushing: (JMenuItem with text "Disabled menuitem") selectFromPopupMenuOnSelectedTreeNodes ${treeName} Disabled menuitem True

*** Keywords ***
keywordShouldFailBecauseContextIsIllegal
[Arguments] ${keyword} @{arguments}
Expand Down

0 comments on commit 1071079

Please sign in to comment.