org.netbeans.jemmy.operators.JButtonOperator Java Examples

The following examples show how to use org.netbeans.jemmy.operators.JButtonOperator. 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: CreateProjectTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testCreateTestWithoutInitializerAndFinalizer() {
    // select source packages node
    ProjectsTabOperator pto = new ProjectsTabOperator();
    ProjectRootNode prn = pto.getProjectRootNode(TEST_PROJECT_NAME);
    prn.select();

    //deletes previous test package
    Node testPkgNode = new Node(prn, "Test Packages|junit3testproject");
    testPkgNode.select();
    new ActionNoBlock(null,"Delete").perform(testPkgNode);
    NbDialogOperator deleteOp = new NbDialogOperator("Delete");
    new JButtonOperator(deleteOp, "OK").clickMouse();

    // create test
    Node node = new Node(prn, "Source Packages|junit3testproject|Main.java"); // NOI18N
    node.select();
    new ActionNoBlock(null,"Tools|Create JUnit Test").perform(node);

    NbDialogOperator newTestOp = new NbDialogOperator("Create Tests");
    checkAllCheckboxes(newTestOp);
    new JCheckBoxOperator(newTestOp, 3).setSelected(false);
    new JCheckBoxOperator(newTestOp, 4).setSelected(false);

    new JButtonOperator(newTestOp, "OK").clickMouse();

}
 
Example #2
Source File: AddProfilingPointWizardTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void initialize() {
    commandName = "Profiling Points"; //NOI18N
    windowName = "Profiling Points"; ////NOI18N
    new Action(menuPrefix+commandName,null).performMenu(); // NOI18N  
    ppointsPane = new TopComponentOperator(windowName);
    addPointButton = new JButtonOperator(ppointsPane,new ComponentChooser() {

        public boolean checkComponent(Component component) {
            try{
                if ( (((JButton)component).getToolTipText()).equals("Add Profiling Point") ) {
                    return true;
                }
                else {
                    return false;
                }
            } catch (java.lang.NullPointerException npe) {}
             return false;
        }

        public String getDescription() {
            return "Selecting button by tooltip";
        }
        });
}
 
Example #3
Source File: IncrementalSearchTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testPrevButton() {
    openDefaultProject();
    openFile("Source Packages|org.netbeans.test.editor.search.IncrementalSearchTest", "match.txt");
    EditorOperator editor = new EditorOperator("match.txt");
    editor.setCaretPosition(3, 1);
    SearchBarOperator barOperator = SearchBarOperator.invoke(editor);
    JTextComponentOperator t = barOperator.findCombo();
    t.clearText();
    new EventTool().waitNoEvent(100);
    t.typeText("abc");
    JButtonOperator b = barOperator.prevButton();
    b.push();
    assertSelection(editor, 4, 7);
    b.push();
    assertSelection(editor, 0, 3);
    t.pushKey(KeyEvent.VK_ESCAPE);
    new EventTool().waitNoEvent(100);
    assertFalse("ToolBar not closed",barOperator.isVisible());
    editor.closeDiscard();        
}
 
Example #4
Source File: CreateVisualMIDletTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void close() {
    new Thread("Question dialog discarder") {
        @Override
        public void run() {
            try {
                new JButtonOperator(new JDialogOperator("Question"), "Discard").push();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }.start();
    if (midletName != null) {
        MIDletEditorOperator.findMIDletEditorOperator(midletName + ".java").close();
    }
}
 
Example #5
Source File: CloseProjectPropertyTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void prepare(){

      Node pNode = new ProjectsTabOperator().getProjectRootNode(testProjectName);
      pNode.select();
      pNode.performPopupAction("Properties");
       
     jdo = new NbDialogOperator(testProjectName);
     JTreeOperator cattree = new JTreeOperator(jdo);       
     Node cNode = new Node(cattree,"Abilities") ;
     cNode.select();
      
     JButtonOperator addButton = new JButtonOperator(jdo,"Add");
     addButton.pushNoBlock();

     NbDialogOperator add_abil = new NbDialogOperator("Add Ability");
     JComboBoxOperator abilityCombo = new JComboBoxOperator(add_abil); 
     abilityCombo.clearText();
     abilityCombo.typeText("Ability_"+System.currentTimeMillis());
     JButtonOperator abil_okButton = new JButtonOperator(add_abil,"OK");
     abil_okButton.push();
     
  }
 
Example #6
Source File: ButtonDemoScreenshotTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void checkButton(JFrameOperator jfo, int i, Robot rob) {
    JButtonOperator button = new JButtonOperator(jfo, i);

    Point loc = button.getLocationOnScreen();
    rob.mouseMove(loc.x, loc.y);

    BufferedImage initialButtonImage = capture(rob, button);
    assertNotBlack(initialButtonImage);
    save(initialButtonImage, "button" + i + "_0initial.png");
    rob.mousePress(InputEvent.BUTTON1_MASK);
    try {
        waitPressed(button);
        BufferedImage pressedButtonImage = capture(rob, button);
        assertNotBlack(pressedButtonImage);
        save(pressedButtonImage, "button" + i + "_1pressed.png");

        StrictImageComparator sComparator = new StrictImageComparator();
        assertNotEquals("Button " + i + " Test", sComparator, initialButtonImage, pressedButtonImage);
    } finally {
        rob.mouseRelease(InputEvent.BUTTON1_MASK);
    }
}
 
Example #7
Source File: OpenMIDletEditorTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void close() {
    if (testedComponentOperator != null) {
        new Thread("Question dialog discarder") {

            @Override
            public void run() {
                try {
                    new JButtonOperator(new JDialogOperator("Question"), "Discard").push();
                } catch (Exception e) {
                    //  There is no need to care about this exception as this dialog is optional
                    e.printStackTrace();
                }
            }
        }.start();
        ((MIDletEditorOperator) testedComponentOperator).close();
    }
}
 
Example #8
Source File: JavaHelpDialogTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testHelpByButtonNestedModal() {
    String toolsMenu = Bundle.getStringTrimmed("org.netbeans.core.ui.resources.Bundle", "Menu/Tools"); // Tools
    String javaPlatformMenu = Bundle.getStringTrimmed("org.netbeans.modules.java.platform.ui.Bundle", "CTL_PlatformManager"); // Java Platforms

    new JMenuBarOperator(MainWindowOperator.getDefault().getJMenuBar()).pushMenuNoBlock(toolsMenu + "|" + javaPlatformMenu, "|");
    //new NbDialogOperator(Bundle.getStringTrimmed("org.netbeans.core.ui.Bundle", "CTL_SetupWizardTitle")).help();    // Setup Wizard
    NbDialogOperator javaPlatformManager = new NbDialogOperator(Bundle.getStringTrimmed("org.netbeans.api.java.platform.Bundle", "TXT_PlatformsManager"));// Java Platform Manager

    new JButtonOperator(javaPlatformManager, Bundle.getStringTrimmed("org.netbeans.modules.java.platform.ui.Bundle", "CTL_AddPlatform")).pushNoBlock(); // Add Platform...
    NbDialogOperator addJavaPlatform = new NbDialogOperator(Bundle.getStringTrimmed("org.netbeans.modules.java.platform.ui.Bundle", "CTL_AddPlatformTitle"));// Add Java Platform
    addJavaPlatform.help();
    helpWindow = new HelpOperator();

    // close
    addJavaPlatform.cancel();
    javaPlatformManager.closeByButton();
}
 
Example #9
Source File: MasterDetailFormTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Uses Master/Detail Sample wizard */
public void testMasterDetailWizard() {
    NewFileWizardOperator nfwo = NewFileWizardOperator.invoke();
    nfwo.selectProject(getTestProjectName());
    nfwo.selectCategory("Swing GUI Forms"); // NOI18N
    nfwo.selectFileType("Master/Detail Sample Form"); // NOI18N
    nfwo.next();
    
    NewJavaFileNameLocationStepOperator nfnlso = new NewJavaFileNameLocationStepOperator();
    nfnlso.txtObjectName().clearText();
    nfnlso.txtObjectName().typeText(_newFormName);
    nfnlso.setPackage(getTestPackageName());
    nfnlso.next();
    
    NbDialogOperator masterOp = new NbDialogOperator("New Master/Detail Form"); // NOI18N
    new JComboBoxOperator(masterOp,1).selectItem(SetUpDerbyDatabaseTest.JDBC_URL);
    new JButtonOperator(masterOp,"Next").clickMouse(); // NOI18N
    
    masterOp = new NbDialogOperator("New Master/Detail Form"); // NOI18N
    new JButtonOperator(masterOp,"Finish").clickMouse(); // NOI18N
    waitNoEvent(8000);
}
 
Example #10
Source File: SetUpDerbyDatabaseTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Creates sample db */
public void testCreateDb() {
    new ActionNoBlock(DB_CREATE_DB_MENU, null).perform(); // NOI18N

    DialogOperator op = new DialogOperator(DB_CREATE_DB_DIALOG_TITLE);
    new JTextFieldOperator(op,0).typeText(DB_PASSWORD);
    new JTextFieldOperator(op,1).typeText(DB_USER_NAME);
    new JTextFieldOperator(op,3).typeText(DB_NAME);
    
    JButtonOperator okOp = new JButtonOperator(op,"OK"); // NOI18N
    
    if (okOp.isEnabled()) {
        okOp.clickMouse();
    } else {
        // db already exists
        new JButtonOperator(op,"Cancel").clickMouse(); // NOI18N
    }
}
 
Example #11
Source File: MavenWebProjectValidation.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Cancel Indexing Maven repository or Unpacking index tasks which are not
 * necessary for tests.
 */
protected void cancelIndexing() {
    String[] labels = {"Indexing Maven repository", "Transferring Maven repository index", "Unpacking index"};
    for (String label : labels) {
        Object lblIndexing = JLabelOperator.findJLabel(
                (Container) MainWindowOperator.getDefault().getSource(),
                label, false, false);
        if (lblIndexing != null) {
            JButton cancelJButton = (JButton) JButtonOperator.findJComponent(
                    (Container) MainWindowOperator.getDefault().getSource(),
                    "Click to cancel process", true, true);
            if (cancelJButton != null) {
                JButtonOperator btnCancel = new JButtonOperator(cancelJButton);
                btnCancel.pushNoBlock();
                try {
                    new NbDialogOperator("Cancel Running Task").yes();
                } catch (TimeoutExpiredException tee) {
                    // ignore if not opened
                }
            }
        }
    }
}
 
Example #12
Source File: CommonUtilities.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public static void addTomcatServer() {
    String appServerPath = System.getProperty("tomcat.installRoot");
    
    if (appServerPath == null) {
        throw new Error("Can't add tomcat server. tomcat.installRoot property is not set.");
    }
    
    String addServerMenuItem = Bundle.getStringTrimmed("org.netbeans.modules.j2ee.deployment.impl.ui.actions.Bundle", "LBL_Add_Server_Instance"); // Add Server...
    String addServerInstanceDialogTitle = Bundle.getStringTrimmed("org.netbeans.modules.j2ee.deployment.impl.ui.wizard.Bundle", "LBL_ASIW_Title"); //"Add Server Instance"
    String nextButtonCaption = Bundle.getStringTrimmed("org.openide.Bundle", "CTL_NEXT");
    String finishButtonCaption = Bundle.getStringTrimmed("org.openide.Bundle", "CTL_FINISH");

    RuntimeTabOperator rto = RuntimeTabOperator.invoke();
    Node serversNode = new Node(rto.getRootNode(), "Servers");
    // Let's check whether GlassFish is already added
    if (!serversNode.isChildPresent("Tomcat")) {
        serversNode.performPopupActionNoBlock(addServerMenuItem);
        NbDialogOperator addServerInstanceDialog = new NbDialogOperator(addServerInstanceDialogTitle);
        new JListOperator(addServerInstanceDialog, 1).selectItem("Tomcat");
        new JButtonOperator(addServerInstanceDialog, nextButtonCaption).push();
        new JTextFieldOperator(addServerInstanceDialog, 1).setText(appServerPath);
        new JCheckBoxOperator(addServerInstanceDialog,1).changeSelection(false);
        new JButtonOperator(addServerInstanceDialog, finishButtonCaption).push();
    }
}
 
Example #13
Source File: WsValidation.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void addHandlers(NbDialogOperator ndo, String[] handlers) {
    JButtonOperator jbo = new JButtonOperator(ndo, "Add...");
    //Add Message Handler Class
    String addHandlerDlg = Bundle.getStringTrimmed("org.netbeans.modules.websvc.utilities.ui.Bundle", "TTL_SelectHandler");
    //Source Packages
    String srcPkgLabel = Bundle.getStringTrimmed("org.netbeans.modules.java.j2seproject.Bundle", "NAME_src.dir");
    for (int i = 0; i < handlers.length; i++) {
        jbo.pushNoBlock();
        NbDialogOperator ndo2 = new NbDialogOperator(addHandlerDlg);
        JTreeOperator jto2 = new JTreeOperator(ndo2);
        Node spn = new Node(jto2, srcPkgLabel);
        Node pkg = new Node(spn, getHandlersPackage());
        Node handler = new Node(pkg, handlers[i]);
        handler.select();
        ndo2.ok();
    }
}
 
Example #14
Source File: testNavigation.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void GoToLine( int iLineToGo, int iLineToCome )
{
  EditorOperator eoPHP = new EditorOperator( "EmptyPHPWebPage.php" );
  eoPHP.clickForPopup( );
  JPopupMenuOperator menu = new JPopupMenuOperator( );
  eoPHP.typeKey('g', InputEvent.CTRL_MASK);
  JDialogOperator jdGoto = new JDialogOperator( "Go to Line or Bookmark" );
  JComboBoxOperator jcLine = new JComboBoxOperator( jdGoto, 0 );
  JTextFieldOperator jtTemp = jcLine.getTextField( );
  jtTemp.setText( "" + iLineToGo );
  JButtonOperator jbGoto = new JButtonOperator( jdGoto, "Go To" );
  jbGoto.push( );
  jdGoto.waitClosed( );
  int iLine = eoPHP.getLineNumber( );
  if( iLineToCome != iLine )
  {
    fail( "Navigate go to line came to incorrect one. Found: " + iLine + ", expected: " + iLineToCome );
  }
}
 
Example #15
Source File: DTDActionsTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testGenerateDocumentation() throws Exception{
    final String docName = "dokumentace";
    final String fileName = docName+".html";
    final String generated = "Generated.*\n";
    //dissable showing browser
    setSwingBrowser();
    Node node = WebPagesNode.getInstance(projectName).getChild(dtdfileName, Node.class);
    new ActionNoBlock(null, Bundle.getString(TOOLS_DOCLET_BUNDLE, "NAME_Generate_Documentation")).perform(node);
    JDialogOperator op = new JDialogOperator(Bundle.getString(TOOLS_GENERATOR_BUNDLE, "PROP_fileNameTitle"));
    new JTextFieldOperator(op, 0).setText(docName);
    new JButtonOperator(op, "OK").push();
    Node docNode = WebPagesNode.getInstance(projectName).getChild(fileName, Node.class);
    new ActionNoBlock(null, "Open").performPopup(docNode);
    Thread.sleep(5000);//wait opening the window
    String text = new EditorOperator(fileName).getText();
    text = text.replaceFirst(generated, generated);
    ref(text);
    ending();
}
 
Example #16
Source File: OutputOperatorTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Test of find method
 */
public void testFind() throws Exception {
    outputOperator.find();
    // "Find"
    String findTitle = Bundle.getString("org.netbeans.core.output2.Bundle", "LBL_Find_Title");
    NbDialogOperator findDialog = new NbDialogOperator(findTitle);
    // assuming debug string is printed in output at least twice
    new JTextFieldOperator(findDialog).setText("b");   // NOI18N
    // "Find"
    String findButtonLabel = Bundle.getStringTrimmed("org.netbeans.core.output2.Bundle", "BTN_Find");
    new JButtonOperator(findDialog, findButtonLabel).push();
    // wait a little until "b" is selected
    new EventTool().waitNoEvent(500);
    // verify "b" is selected
    outputOperator.copy();
    if (!getClipboardText().equals("b")) {
        // repeat because find action was not executed
        outputOperator.find();
        findDialog = new NbDialogOperator(findTitle);
        new JTextFieldOperator(findDialog).setText("b");   // NOI18N
        new JButtonOperator(findDialog, findButtonLabel).push();
    }
}
 
Example #17
Source File: JsfFunctionalTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Test that delete safely bean removes record from faces-config.xml. */
public void testManagedBeanDelete() {
    // if scanning starts later we have to wait here
    waitScanFinished();
    Node node = new Node(new SourcePackagesNode(PROJECT_NAME), "mypackage|MyManagedBean.java");
    new ActionNoBlock(null, "Refactor|Safely Delete...").perform(node);
    NbDialogOperator safeDeleteDialog = new NbDialogOperator("Safely Delete");
    new JButtonOperator(safeDeleteDialog, "Refactor").push();
    node.waitNotPresent();
}
 
Example #18
Source File: testInsertDatabase.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void InsertConnectionToDatabase( ) throws Exception
{
  startTest( );

  // Get editor
  EditorOperator eoPHP = new EditorOperator( "index.php" );
  // Locate comment
  eoPHP.setCaretPosition( "// put your code here\n", false );
  eoPHP.insert( "\nclass name\n{\n\n}\n" );
  eoPHP.setCaretPosition( "}", false );
  TypeCode(eoPHP, " ");
  Sleep( 1000 );
  InvokeInsert( eoPHP );
  Sleep( 1000 );

  JDialogOperator jdInsetter = new JDialogOperator( );
  JListOperator jlList = new JListOperator( jdInsetter );

  ClickListItemNoBlock( jlList, 0, 1 );

  JDialogOperator jdGenerator = new JDialogOperator( "Select Database Connection" );

  JButtonOperator jbCancel = new JButtonOperator( jdGenerator, "Cancel" );
  jbCancel.pushNoBlock( );
  jdGenerator.waitClosed( );

  endTest( );
}
 
Example #19
Source File: Utils.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static void stepSetDir(
    TestData data,
    String label,
    String dir
  )
{
  JFrameOperator installerMain = new JFrameOperator( MAIN_FRAME_TITLE );

  if( null == dir )
  {
    String sDefaultPath = new JTextFieldOperator( ( JTextField )( new JLabelOperator( installerMain, label ).getLabelFor( ) ) ).getText( );
    // Set default path to data
    data.SetDefaultPath( sDefaultPath );
  }
  else
  {
    try
    {
      new JTextFieldOperator( ( JTextField )( new JLabelOperator( installerMain, label ).getLabelFor( ) ) ).setText( ( new File( dir ) ).getCanonicalPath( ) );
    }
    catch( IOException ex )
    {
      ex.printStackTrace( );
    }
  }

  new JButtonOperator( installerMain, NEXT_BUTTON_LABEL ).push( );
}
 
Example #20
Source File: ProfilerValidationTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Test Profiler options.
 */
public void testOptions() {
    OptionsOperator options = OptionsOperator.invoke();
    options.selectJava();
    JTabbedPaneOperator tabbedPane = new JTabbedPaneOperator(options);
    tabbedPane.selectPage("Profiler");
    JListOperator categoriesOper = new JListOperator(options);
    // General category
    assertEquals("Wrong profiling port.", 5140, new JSpinnerOperator(options).getValue());
    // manage calibration data
    new JButtonOperator(options, "Manage").pushNoBlock();
    NbDialogOperator manageOper = new NbDialogOperator("Manage Calibration data");
    JTableOperator platformsOper = new JTableOperator(manageOper);
    platformsOper.selectCell(0, 0);
    new JButtonOperator(manageOper, "Calibrate").pushNoBlock();
    new NbDialogOperator("Information").ok();
    manageOper.closeByButton();
    // reset
    new JButtonOperator(options, "Reset").push();
    // Snapshots category
    categoriesOper.selectItem("Snapshots");
    JLabelOperator lblSnapshotOper = new JLabelOperator(options, "When taking snapshot:");
    assertEquals("Wrong value for " + lblSnapshotOper.getText(), "Open snapshot", new JComboBoxOperator((JComboBox) lblSnapshotOper.getLabelFor()).getSelectedItem());
    JLabelOperator lblOpenOper = new JLabelOperator(options, "Open automatically:");
    assertEquals("Wrong value for " + lblOpenOper.getText(), "On first saved snapshot", new JComboBoxOperator((JComboBox) lblOpenOper.getLabelFor()).getSelectedItem());
    // Engine category
    categoriesOper.selectItem("Engine");
    JLabelOperator lblSamplingOper = new JLabelOperator(options, "Sampling frequency");
    assertEquals("Wrong value for " + lblSamplingOper.getText(), 10, new JSpinnerOperator((JSpinner) lblSamplingOper.getLabelFor()).getValue());
    options.cancel();
}
 
Example #21
Source File: BrowserRegistry.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
      External Browser (Unix) :  Set Process with Full Path to Browser
                          &
      External Browser (Unix) :  Use String '{params}' in Process    
    **/

   public void testSetProcessWithFullPathToBrowserEBU() {
String newExec = fullPathCommand();
OptionsOperator oo = OptionsOperator.invoke();
TextFieldProperty pr = getTFProperty(ideConfiguration + iSep + sets + iSep + browsers + iSep + ub, pnameBrowserExecutable);
pr.openEditor();
NbDialogOperator nbo = new NbDialogOperator(pnameBrowserExecutable);
if(!(new JTextComponentOperator(nbo, 1)).getText().equals("{params}")) {
    fail("Wrong default arguments field: " + (new JTextFieldOperator(nbo, 1)).getText());
}
String custom = "..."; //Correct bundle Not found currently
new JButtonOperator(nbo, custom).pushNoBlock();
System.out.println("Before wait for open");
NbDialogOperator nbo1 = new NbDialogOperator("Open");
System.out.println("After wait for open");
new JTextFieldOperator(nbo1, 0).setText(newExec);
String openTitle =  Bundle.getString("org.openide.explorer.propertysheet.editors.Bundle", "CTL_OpenButtonName");
new JButtonOperator(nbo1, openTitle).push();
nbo.ok();
pr = getTFProperty(ideConfiguration + iSep + sets + iSep + browsers + iSep + ub, pnameBrowserExecutable);
if (!pr.getValue().equals(newExec + " {params}")) {
    fail("Browser Executable not set via editor. \"" + pr.getValue() + "\" instead of \"" + newExec + " {params}\"");
}
oo.close();
oo = OptionsOperator.invoke();
pr = getTFProperty(ideConfiguration + iSep + sets + iSep + browsers + iSep + ub, pnameBrowserExecutable);
if (!pr.getValue().equals(newExec + " {params}")) {
    fail("Browser Executable field not saved, if set via editor. "+ pr.getValue() + " instead of \"" + newExec + " {params}\"");
}
   }
 
Example #22
Source File: ReplaceActionTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Close open Replace dialog. */
@Override
public void tearDown() {
    // waits for close button (it is second button with given tooltip ebcause first one for search row is hidden)
    JButtonOperator closeButton = new JButtonOperator(eo, new JButtonOperator.JComponentByTipFinder("Close Incremental Search Sidebar"));
    closeButton.push();
    // close editor after last test case
    if (getName().equals("testPerformShortcut")) {
        eo.close();
    }
}
 
Example #23
Source File: CodeTemplatesTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testAddDuplicity() {
    final String abbrev = "2al";
    CodeTemplatesOperator oper = null;
    try {
        oper = CodeTemplatesOperator.invoke(true);
        oper.switchLanguage("Java").addNewTemplate(abbrev);
        JDialogOperator dialog = new JDialogOperator("Error");
        JButtonOperator button = new JButtonOperator(dialog, "OK");
        button.pushNoBlock();
    } finally {
        oper.ok();
    }
}
 
Example #24
Source File: PluginsOperator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Switches to Updates tab and finds "Update" JButton.
 * @return JButtonOperator
 */
public JButtonOperator btUpdate() {
    selectUpdates();
    return new JButtonOperator(this, Bundle.getStringTrimmed(
            "org.netbeans.modules.autoupdate.ui.Bundle",
            "UnitTab_bTabAction_Name_UPDATE"));
}
 
Example #25
Source File: ExtJellyTestCase.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Removes file from actual project and actual test package
 */
public void removeFile(String fileName) {
    if (DELETE_FILES) {
        ProjectsTabOperator project = new ProjectsTabOperator();
        Node node = new Node(project.tree(), _testProjectName + "|Source Packages|" + _testPackageName + "|" + fileName + ".java"); // NOI18N
        DeleteAction act = new DeleteAction();
        act.performPopup(node);

        //new NbDialogOperator(DELETE_OBJECT_CONFIRM).yes();
        NbDialogOperator op = new NbDialogOperator("Delete");
        new JButtonOperator(op, "Ok").clickMouse();
    }
}
 
Example #26
Source File: BeanInfoEditorTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testCreateBeanInfo() {
    org.netbeans.jellytools.nodes.Node node = new org.netbeans.jellytools.nodes.Node(
            new ProjectsTabOperator().getProjectRootNode("Beans"),"Source Packages|Beans|Generate.java");
    node.performPopupAction("BeanInfo Editor...");
    JDialogOperator jDialogOperator = new JDialogOperator("Question");
    JButtonOperator okButon = new JButtonOperator(jDialogOperator,"Yes");
    okButon.push();
    try {
        editor = openEditor("beans", "GenerateBeanInfo");
        switchToDesign(editor);
        BeanInfoOperator bio = new BeanInfoOperator("GenerateBeanInfo");
        String tree = getTree(bio.getTreeOperator(), BeanInfoOperator.defaultConverter);
       String expected = ""
                + "BeanInfo\n"
                + "__Bean\n"
                + "____beans.Source\n"
                + "__Properties\n"
                + "____x\n"
                + "__Event Sources\n"
                + "__Methods\n";
        assertEquals(tree, expected);
    } finally {
        if (editor != null) {
            editor.closeDiscard();
        }
    }        
}
 
Example #27
Source File: PrepareIDEForEnterpriseComplexMeasurements.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void addApplicationServer() {
        // FIXME: Make a call of the following method
//        Utilities.addApplicationServer();
       String appServerPath = System.getProperty("com.sun.aas.installRoot");
        
        if (appServerPath == null) {
            throw new Error("Can't add application server. com.sun.aas.installRoot property is not set.");
        }

        String addServerMenuItem = Bundle.getStringTrimmed("org.netbeans.modules.j2ee.deployment.impl.ui.actions.Bundle", "LBL_Add_Server_Instance"); // Add Server...
        String addServerInstanceDialogTitle = Bundle.getStringTrimmed("org.netbeans.modules.j2ee.deployment.impl.ui.wizard.Bundle", "LBL_ASIW_Title"); //"Add Server Instance"
        String glassFishV2ListItem = Bundle.getStringTrimmed("org.netbeans.modules.j2ee.sun.ide.Bundle", "LBL_GlassFishV2");
        String nextButtonCaption = Bundle.getStringTrimmed("org.openide.Bundle", "CTL_NEXT");
        String finishButtonCaption = Bundle.getStringTrimmed("org.openide.Bundle", "CTL_FINISH");

        RuntimeTabOperator rto = RuntimeTabOperator.invoke();        
        JTreeOperator runtimeTree = rto.tree();
        
        long oldTimeout = runtimeTree.getTimeouts().getTimeout("JTreeOperator.WaitNextNodeTimeout");
        runtimeTree.getTimeouts().setTimeout("JTreeOperator.WaitNextNodeTimeout", 60000);
        
        TreePath path = runtimeTree.findPath("Servers");
        runtimeTree.selectPath(path);
        
        new JPopupMenuOperator(runtimeTree.callPopupOnPath(path)).pushMenuNoBlock(addServerMenuItem);
       
        NbDialogOperator addServerInstanceDialog = new NbDialogOperator(addServerInstanceDialogTitle);
        
        new JListOperator(addServerInstanceDialog, 1).selectItem(glassFishV2ListItem);
        
        new JButtonOperator(addServerInstanceDialog,nextButtonCaption).push();
        
        new JTextFieldOperator(addServerInstanceDialog).enterText(appServerPath);
        
        new JButtonOperator(addServerInstanceDialog,finishButtonCaption).push();
        
        runtimeTree.getTimeouts().setTimeout("JTreeOperator.WaitNextNodeTimeout", oldTimeout);
    }
 
Example #28
Source File: OpenMobileProjectTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void prepare() {
    new ActionNoBlock("File|Open Project...", null).perform(); //NOI18N
    WizardOperator opd = new WizardOperator("Open Project"); //NOI18N
    JTextComponentOperator path = new JTextComponentOperator(opd, 1);
    openButton = new JButtonOperator(opd, "Open Project"); //NOI18N
    String paths = getDataDir().toString()+ java.io.File.separator + projectName;
    path.setText(paths);
}
 
Example #29
Source File: ExtJellyTestCaseForJunit4.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Removes file from actual project and actual test package
 */
public void removeFile(String fileName) {
    if (DELETE_FILES) {
        ProjectsTabOperator project = new ProjectsTabOperator();
        Node node = new Node(project.tree(), TEST_PROJECT_NAME + "|Source Packages|" + TEST_PACKAGE_NAME + "|" + fileName + ".java"); // NOI18N
        DeleteAction act = new DeleteAction();
        act.performPopup(node);

        //new NbDialogOperator(DELETE_OBJECT_CONFIRM).yes();
        NbDialogOperator op = new NbDialogOperator("Safe Delete");
        new JButtonOperator(op, "Refactor").clickMouse();
    }
}
 
Example #30
Source File: OpenBPELprojectTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void prepare(){
    new ActionNoBlock("File|Open Project...",null).perform(); //NOI18N
    WizardOperator opd = new WizardOperator("Open Project"); //NOI18N
    JTextComponentOperator path = new JTextComponentOperator(opd,1);
    openButton = new JButtonOperator(opd,"Open Project"); //NOI18N
    String paths = getDataDir() + java.io.File.separator + projectName;
    path.setText(paths);
}