Java Code Examples for org.netbeans.jemmy.operators.JPopupMenuOperator#pushMenu()
The following examples show how to use
org.netbeans.jemmy.operators.JPopupMenuOperator#pushMenu() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: testFormatting.java From netbeans with Apache License 2.0 | 6 votes |
public void Undo_Formatting_of_PHP_file() { startTest(); EditorOperator eoPHP = new EditorOperator("EmptyPHP.php"); String sTextOriginal = eoPHP.getText(); eoPHP.setCaretPosition(0); eoPHP.insert(" "); String sTextChanged = eoPHP.getText(); Sleep(1000); eoPHP.clickForPopup(); Sleep(1000); JPopupMenuOperator menu = new JPopupMenuOperator(); menu.pushMenu("Format"); new JMenuBarOperator(MainWindowOperator.getDefault()).pushMenu("Edit|Undo"); Sleep(5000); new JMenuBarOperator(MainWindowOperator.getDefault()).pushMenu("Edit|Undo"); Sleep(5000); String sTextUndo = eoPHP.getText(); if (!sTextOriginal.equals(sTextUndo)) { fail("Undo formatting is not valid. Expected: \n" + sTextOriginal + " but was \n" + sTextUndo); } endTest(); }
Example 2
Source File: AntSanityTest.java From netbeans with Apache License 2.0 | 6 votes |
/** * Tests that it is possible to add watches. */ public void newWatch() throws IllegalAccessException, InvocationTargetException, InvalidExpressionException { Node projectNode = new ProjectsTabOperator().getProjectRootNode(DEBUG_TEST_PROJECT_ANT); Node testFile = new Node(new SourcePackagesNode(projectNode), "advanced|VariablesTest.java"); new OpenAction().perform(testFile); EditorOperator eo = new EditorOperator("VariablesTest.java"); eo.setCaretPositionToLine(49); new ToggleBreakpointAction().perform(); MainWindowOperator.StatusTextTracer stt = MainWindowOperator.getDefault().getStatusTextTracer(); stt.start(); new DebugJavaFileAction().perform(testFile); stt.waitText("Thread main stopped at VariablesTest.java:49"); stt.stop(); new ActionNoBlock("Debug|New Watch...", null).perform(); NbDialogOperator newWatchDialog = new NbDialogOperator("New Watch"); new JEditorPaneOperator(newWatchDialog, 0).setText("n"); newWatchDialog.ok(); TopComponentOperator variablesView = new TopComponentOperator(new ContainerOperator(MainWindowOperator.getDefault(), VIEW_CHOOSER), "Variables"); JTableOperator variablesTable = new JTableOperator(variablesView); assertEquals("n", variablesTable.getValueAt(0, 0).toString()); org.openide.nodes.Node.Property property = (org.openide.nodes.Node.Property) variablesTable.getValueAt(0, 2); assertEquals("50", property.getValue()); JPopupMenuOperator menu = new JPopupMenuOperator(variablesTable.callPopupOnCell(0, 0)); menu.pushMenu("Delete All"); }
Example 3
Source File: Utilities.java From netbeans with Apache License 2.0 | 6 votes |
/** * Deletes a node (file, package) * using pop-up menu */ public static void deleteNode(String path) { try { Node pn = new ProjectsTabOperator().getProjectRootNode( Utilities.TEST_PROJECT_NAME); if(pn != null && pn.isPresent()) { pn.select(); Node n = new Node(pn, path); n.select(); JPopupMenuOperator jpmo = n.callPopup(); jpmo.pushMenu("Delete"); new NbDialogOperator(CONFIRM_OBJECT_DELETION).btOK().push(); //confirm takeANap(500); } } catch (TimeoutExpiredException e) { System.out.println("Node hasn't been found!!!"); } }
Example 4
Source File: GotoTest.java From netbeans with Apache License 2.0 | 6 votes |
/** * Test selecting appropriate test from Editor's context menu */ public void testSelectTestFromEditorContextMenu() { //open sample class Node n = Utilities.openFile(Utilities.SRC_PACKAGES_PATH + "|" + TEST_PACKAGE_NAME+ "|" + Utilities.TEST_CLASS_NAME); EditorOperator eos = new EditorOperator(Utilities.TEST_CLASS_NAME); eos.clickForPopup(); JPopupMenuOperator jpmo = new JPopupMenuOperator(); String[] sf = {"Navigate", "Go to Test/Tested class"}; Utilities.takeANap(Utilities.ACTION_TIMEOUT); jpmo.pushMenu(sf[0]); JMenuItemOperator jmio = new JMenuItemOperator(new JMenuOperator(jpmo, sf[0]).getItem(2)); //Check if goto test is enabled inside menu assertTrue("Goto Test disabled when invoked from Explorer, over a class node!" + "see: http://www.netbeans.org/issues/show_bug.cgi?id=88599", jmio.isEnabled()); jpmo.pushMenu(sf); EditorOperator eot = new EditorOperator(Utilities.TEST_CLASS_NAME); assertTrue("Test for \"" + TEST_PACKAGE_NAME + Utilities.TEST_CLASS_NAME + "\" not opened!", eot.isVisible()); eot.close(false); eos.close(false); }
Example 5
Source File: OpenServletFileTest.java From netbeans with Apache License 2.0 | 6 votes |
@Override public ComponentOperator open() { JPopupMenuOperator popup = openNode.callPopup(); if (popup == null) { fail("Cannot get context menu for node [" + "Source Packages" + '|' + filePackage + '|' + fileName + "] in project [" + fileProject + "]"); } else { log("------------------------- after popup invocation ------------"); try { repaintManager().addRegionFilter(LoggingRepaintManager.EDITOR_FILTER); popup.pushMenu(menuItem); } catch (org.netbeans.jemmy.TimeoutExpiredException tee) { fail("Cannot push menu item " + menuItem + " of node [" + "Source Packages" + '|' + filePackage + '|' + fileName + "] in project [" + fileProject + "]"); } } log("------------------------- after open ------------"); return new EditorOperator(fileName); }
Example 6
Source File: testFormatting.java From netbeans with Apache License 2.0 | 6 votes |
public void Format_default_code_of_PHP_file() { startTest(); EditorOperator eoPHP = new EditorOperator("EmptyPHP.php"); String sTextOriginal = eoPHP.getText(); Sleep(1000); eoPHP.clickForPopup(); Sleep(1000); JPopupMenuOperator menu = new JPopupMenuOperator(); menu.pushMenu("Format"); String sTextFormatted = eoPHP.getText(); if (!sTextOriginal.equals(sTextFormatted)) { fail("Default formatting is not valid. BUG 181339 may be still valid."); } endTest(); }
Example 7
Source File: GeneralCSSPrep.java From netbeans with Apache License 2.0 | 5 votes |
protected void clickForTextPopup(EditorOperator eo, String menu) { JEditorPaneOperator txt = eo.txtEditorPane(); JEditorPane epane = (JEditorPane) txt.getSource(); try { Rectangle rct = epane.modelToView(epane.getCaretPosition()); txt.clickForPopup(rct.x, rct.y); JPopupMenuOperator popup = new JPopupMenuOperator(); popup.pushMenu(menu); } catch (BadLocationException ex) { System.out.println("=== Bad location"); } }
Example 8
Source File: testFormatting.java From netbeans with Apache License 2.0 | 5 votes |
/** * TODO finish */ public void bug177251() { startTest(); //check default EditorOperator eoPHP = new EditorOperator("EmptyPHP.php"); DeleteFileContent(eoPHP); eoPHP.insert("<?php \n" + "class G_Check {\n" + "private static $sizeUnits = array(\n" + "\"item\" => array(\n" + "\"item\" => array(\n" + ")\n" + "));\n" + "}\n" + "?>"); String sTextOriginal = eoPHP.getText(); Sleep(1000); eoPHP.clickForPopup(); Sleep(1000); JPopupMenuOperator menu = new JPopupMenuOperator(); menu.pushMenu("Format"); String sTextFormatted = eoPHP.getText(); String sTextIdeal = "<?php\n\n" + "class G_Check {\n\n" + " private static $sizeUnits = array(\n" + " \"item\" => array(\n" + " \"item\" => array(\n" + " \"blbblas\"\n" + " )\n" + " ));\n" + "}\n" + "?>"; setPHPIndentation(0, 8, 4); endTest(); }
Example 9
Source File: WidgetOperator.java From netbeans with Apache License 2.0 | 5 votes |
/** * Performs popup action on this widget. * * @param popupPath path of popup menu item (e.g. 'Go|Next') */ public void performPopupAction(String popupPath) { Point center = getCenter(); getViewOperator().clickForPopup(center.x, center.y); JPopupMenuOperator popupOper = new JPopupMenuOperator(); popupOper.setComparator(getComparator()); popupOper.pushMenu(popupPath, "|", getComparator()); }
Example 10
Source File: GeneralNodeJs.java From netbeans with Apache License 2.0 | 5 votes |
protected void clickForTextPopup(EditorOperator eo, String menu) { JEditorPaneOperator txt = eo.txtEditorPane(); JEditorPane epane = (JEditorPane) txt.getSource(); try { Rectangle rct = epane.modelToView(epane.getCaretPosition()); txt.clickForPopup(rct.x, rct.y); JPopupMenuOperator popup = new JPopupMenuOperator(); popup.pushMenu(menu); } catch (BadLocationException ex) { System.out.println("=== Bad location"); } }
Example 11
Source File: GeneralAngular.java From netbeans with Apache License 2.0 | 5 votes |
protected void clickForTextPopup(EditorOperator eo, String menu) { JEditorPaneOperator txt = eo.txtEditorPane(); JEditorPane epane = (JEditorPane) txt.getSource(); try { Rectangle rct = epane.modelToView(epane.getCaretPosition()); txt.clickForPopup(rct.x, rct.y); JPopupMenuOperator popup = new JPopupMenuOperator(); popup.pushMenu(menu); } catch (BadLocationException ex) { System.out.println("=== Bad location"); } }
Example 12
Source File: GeneralKnockout.java From netbeans with Apache License 2.0 | 5 votes |
protected void clickForTextPopup(EditorOperator eo, String menu) { JEditorPaneOperator txt = eo.txtEditorPane(); JEditorPane epane = (JEditorPane) txt.getSource(); try { Rectangle rct = epane.modelToView(epane.getCaretPosition()); txt.clickForPopup(rct.x, rct.y); JPopupMenuOperator popup = new JPopupMenuOperator(); popup.pushMenu(menu); } catch (BadLocationException ex) { System.out.println("=== Bad location"); } }
Example 13
Source File: OpenMIDletEditorTest.java From netbeans with Apache License 2.0 | 5 votes |
public ComponentOperator open() { JPopupMenuOperator popup = this.openNode.callPopup(); if (popup == null) { throw new Error("Cannot get context menu for node "); } try { popup.pushMenu(OPEN); } catch (org.netbeans.jemmy.TimeoutExpiredException tee) { throw new Error("Cannot push menu item "); } return MIDletEditorOperator.findMIDletEditorOperator(midletName); }
Example 14
Source File: testFormatting.java From netbeans with Apache License 2.0 | 5 votes |
public void Undo_Formatting_of_PHP_web_page() { startTest(); EditorOperator eoPHP = new EditorOperator("EmptyPHPWebPage.php"); String sTextOriginal = eoPHP.getText(); eoPHP.setCaretPosition(0); eoPHP.insert(" "); String sTextChanged = eoPHP.getText(); Sleep(1000); eoPHP.clickForPopup(); Sleep(1000); JPopupMenuOperator menu = new JPopupMenuOperator(); menu.pushMenu("Format"); String sTextFormatted = eoPHP.getText(); if (!sTextOriginal.equals(sTextFormatted)) { fail("Default formatting is not valid."); } new JMenuBarOperator(MainWindowOperator.getDefault()).pushMenu("Edit|Undo"); Sleep(5000); String sTextUndo = eoPHP.getText(); if (!sTextChanged.equals(sTextUndo)) { fail("Undo formatting is not valid. Expected: \n " + sTextChanged + " \n but was \n" + sTextUndo); } endTest(); }
Example 15
Source File: CommitOperator.java From netbeans with Apache License 2.0 | 5 votes |
/** Selects specified commit action for given row. * @param rowIndex index of row to be selected * @param action name of action to be selected */ public void selectCommitAction(int rowIndex, String action) { Rectangle rec = tabFiles().getCellRect(rowIndex, 0, true); tabFiles().clickForPopup(rec.x + rec.width / 2, rec.y + rec.height / 2); JPopupMenuOperator pmo = new JPopupMenuOperator(); pmo.pushMenu(action); }
Example 16
Source File: Utilities.java From netbeans with Apache License 2.0 | 5 votes |
/** * Pushes Tools|Create Junit tests over a node * @param n the node where the action will be invoked */ public static void pushCreateTestsPopup(Node n) { JPopupMenuOperator jpmo = n.callPopup(); String[] path = {"Tools", Bundle.getString(Utilities.JUNIT_BUNDLE, "LBL_Action_CreateTest")}; jpmo.pushMenu(path); }
Example 17
Source File: VersioningOperator.java From netbeans with Apache License 2.0 | 4 votes |
/** Performs popup menu on specified row. * @param row row number to be selected (starts from 0) * @param popupPath popup menu path */ public void performPopup(int row, String popupPath) { tabFiles().selectCell(row, 0); JPopupMenuOperator popup = new JPopupMenuOperator(tabFiles().callPopupOnCell(row, 0)); popup.pushMenu(popupPath); }
Example 18
Source File: VersioningOperator.java From netbeans with Apache License 2.0 | 4 votes |
/** Performs popup menu on specified row. * @param row row number to be selected (starts from 0) * @param popupPath popup menu path */ public void performPopup(int row, String popupPath) { tabFiles().selectCell(row, 0); JPopupMenuOperator popup = new JPopupMenuOperator(tabFiles().callPopupOnCell(row, 0)); popup.pushMenu(popupPath); }
Example 19
Source File: ShowLocalHistoryOperator.java From netbeans with Apache License 2.0 | 4 votes |
public void performPopupAction(int rowIndex, String path) { JPopupMenu popup = treeTableHistory().callPopupOnCell(rowIndex, 0); JPopupMenuOperator popupOperator = new JPopupMenuOperator(popup); popupOperator.pushMenu(path); }
Example 20
Source File: OpenFilesNoCloneableEditorTest.java From netbeans with Apache License 2.0 | 4 votes |
@Override public ComponentOperator open() { JPopupMenuOperator popup = openNode.callPopup(); popup.pushMenu("Open"); return new TopComponentOperator(fileName); }