Java Code Examples for org.netbeans.jemmy.operators.JComboBoxOperator#selectItem()

The following examples show how to use org.netbeans.jemmy.operators.JComboBoxOperator#selectItem() . 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: ParserIssueTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testBuild() {
    //open existing Java SE project
    Project p = (Project) ProjectSupport.openProject(new File(getDataDir(), "projects/Sample"));
    //set Ant verbosity level to "Debug"
    OptionsOperator oo = OptionsOperator.invoke();
    oo.selectJava();
    JTabbedPaneOperator jtpo = new JTabbedPaneOperator(oo);
    jtpo.selectPage("Ant"); // NOI18N
    JComboBoxOperator jcbo = new JComboBoxOperator(oo);
    jcbo.selectItem("Debug");
    oo.ok();
    //open output window
    new OutputWindowViewAction().perform();
    //build project
    Node n = ProjectsTabOperator.invoke().getProjectRootNode("Sample"); 
    new BuildJavaProjectAction().perform(n);
    try {
        Thread.sleep(10000);
    } catch (InterruptedException ie) {
        //ignore
    }
    String output = new OutputTabOperator("Sample").getText();
    assertTrue("build action output: \n" + output, output.contains("BUILD SUCCESSFUL")); //NOI18N
}
 
Example 2
Source File: actionsTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void createForm(String formType, String name) throws InterruptedException {
    NewFileWizardOperator nfwo = NewFileWizardOperator.invoke();
    nfwo.selectProject(DATA_PROJECT_NAME);
    Thread.sleep(3000);
    nfwo.selectCategory("Swing GUI Forms");
    nfwo.selectFileType(formType);
    nfwo.next();
    JTextFieldOperator form_name = new JTextFieldOperator(nfwo, 0);
    form_name.setText(name);
    JComboBoxOperator jcb_package = new JComboBoxOperator(nfwo, 1);
    jcb_package.selectItem("data");
    Thread.sleep(3000);

    if (formType.equals("Bean Form")) {
        nfwo.next();
        JTextFieldOperator class_name = new JTextFieldOperator(nfwo);
        class_name.setText("javax.swing.JButton");
        nfwo.finish();
        log(formType + " is created correctly");
    } else {
        nfwo.finish();
        log(formType + " is created correctly");
        Thread.sleep(3000);
    }

}
 
Example 3
Source File: AbbreviationsAddRemovePerformer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testChangeExpansionKey() {
    Abbreviations abbrevs = Abbreviations.invoke("Java");
    JComboBoxOperator expandOnCombo = abbrevs.getExpandOnCombo();
    expandOnCombo.selectItem("Enter");                       
    abbrevs.ok();                
    new EventTool().waitNoEvent(2000);
    final EditorOperator editor = openFile("Test2");
    try {            
        editor.setCaretPosition(16, 9);
        System.out.println("here");
        editor.txtEditorPane().typeText("sout");            
        System.out.println("Typed");        
        new EventTool().waitNoEvent(2000);
        editor.pushKey(KeyEvent.VK_ENTER);
        System.out.println("here");
        ref(editor.getText());
    } finally {            
        editor.closeDiscard();
        abbrevs = Abbreviations.invoke("Java");
        expandOnCombo = abbrevs.getExpandOnCombo();
        expandOnCombo.selectItem("Tab");
        abbrevs.ok();
    }
}
 
Example 4
Source File: CSSTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void checkAtrribute(String attributeName, JComboBoxOperator operator, boolean ignoreLastItem) {
    openFile(newFileName);
    int size = getSize(operator);
    assertFalse("SOME ITEMS", size == 0);
    //--------INSERT ONCE--------//
    if (ignoreLastItem) --size;
    int order = new Random().nextInt(size-1)+1;
    operator.selectItem(order);
    waitUpdate();
    String selected = getItems(operator).get(order);
    //String selected = operator.getSelectedItem().toString();
    assertTrue("INSERTING", getRootRuleText().contains(attributeName + ": " + selected));
    //--------  UPDATE   --------//
    order = new Random().nextInt(size-1)+1;
    operator.selectItem(order);
    waitUpdate();
    selected = getItems(operator).get(order);
    //selected = operator.getSelectedItem().toString();
    assertTrue("UPDATING", getRootRuleText().contains(attributeName + ": "+selected));
    //-------- REMOVE -----------//
    operator.selectItem(0);//<NOT SET>
    waitUpdate();
    assertFalse("REMOVING", getRootRuleText().contains(attributeName));
}
 
Example 5
Source File: ComboBoxDemoTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void comboBoxChecker(JFrameOperator jfo, ComboBoxInfo comboBoxInfo) {
    JComboBoxOperator jcbo = new JComboBoxOperator(jfo, comboBoxInfo.ordinal());
    for (int i = 0; i < jcbo.getItemCount(); i++) {
        jcbo.selectItem(i);
        jcbo.waitItemSelected(i);
    }
}
 
Example 6
Source File: StyleRuleEditorOperator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void setComboBox(String elementName, int comboBox){
    JComboBoxOperator operator = new JComboBoxOperator(this, comboBox);
    int i = 0;
    while (!operator.isEnabled()&&(i<10)){
        try{
            Thread.sleep(1000);
        }catch(InterruptedException interupt){
            throw new AssertionError(interupt);
        }
        i++;
    }
    if (!operator.isEnabled()) throw new AssertionError("COMBO BOX IS NOT ENABLED IN 10s");
    operator.selectItem(elementName);
}
 
Example 7
Source File: testBrowserAndIDE.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void ExecuteInConsole() {
    startTest();

    // Set new execution type
    new JMenuBarOperator(MainWindowOperator.getDefault()).pushMenuNoBlock("File|Project Properties");
    JDialogOperator jdProperties = new JDialogOperator("Project Properties - ");
    JTreeOperator jtSections = new JTreeOperator(jdProperties, 0);
    jtSections.selectPath(jtSections.findPath("Run Configuration"));
    Sleep(500);

    try {
        Dumper.dumpAll("c:\\dump.txt");
    } catch (IOException ex) {
    }

    JComboBoxOperator jcType = new JComboBoxOperator(jdProperties, 0);
    jcType.selectItem("Script (run in command line)");
    JButtonOperator jbOk = new JButtonOperator(jdProperties, "OK");
    jbOk.push();
    jdProperties.waitClosed();

    // Test execution
    Sleep(5000);
    new JMenuBarOperator(MainWindowOperator.getDefault()).pushMenuNoBlock("Run|Run");
    Sleep(5000);

    // Get output
    OutputTabOperator oto = new OutputTabOperator(" - index.php");
    String sContent = oto.getText().replaceAll("[ \t\r\n]", "");
    System.out.println(">>>" + sContent + "<<<");

    endTest();
}
 
Example 8
Source File: TestFontSettings.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testChangeFontColor(){
    FontPaneOperator fontOper = initializeFontChanging();
    JComboBoxOperator operator = fontOper.fontColor();
    int size = getSize(operator);
    assertFalse("SOME ITEMS", size == 0);
    operator.selectItem("green");
    waitUpdate();
    assertTrue(getRootRuleText().contains("color: green"));
    //        JColorChooserOperator chooser = fontOper.showColorChooser();
    //        chooser.setColor(Color.RED);
    //        waitUpdate();
    //        assertTrue(getRootRuleText().contains("color: red"));
}
 
Example 9
Source File: WizardUtils.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Finds Java EE Version combo box in wizard and sets it to requested version.
 * @param op wizard operator
 * @param version sub string of requested Java EE version
 * @return same wizard operator instance
 */
public static NewJavaProjectNameLocationStepOperator setJ2eeSpecVersion(
        NewJavaProjectNameLocationStepOperator op, String version) {
    op.next();
    // "Java EE Version"
    String javaEEVersionLabel = Bundle.getStringTrimmed("org.netbeans.modules.javaee.project.api.ant.ui.wizard.Bundle", "LBL_NWP1_J2EESpecLevel_Label");
    JLabelOperator lblJavaEEVersion = new JLabelOperator(op, javaEEVersionLabel);
    JComboBoxOperator cboVersion = new JComboBoxOperator((JComboBox)lblJavaEEVersion.getLabelFor());
    cboVersion.selectItem(version);
    return op;
}
 
Example 10
Source File: MoveTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void performMove(String fileName, String pkgName, String newPkg, boolean performInEditor, MoveTest.TargetDestination target) {
    if (performInEditor) {
        openSourceFile(pkgName, fileName);
        EditorOperator editor = new EditorOperator(fileName);
        editor.setCaretPosition(1, 1);
        new RefactorMoveAction().performPopup(editor);
    } else {
        SourcePackagesNode src = new SourcePackagesNode(testProjectRootNode);
        Node node = new Node(src, pkgName + TREE_SEPARATOR + fileName);
        node.select();
        new RefactorMoveAction().performPopup(node);
    }
    MoveClassDialogOperator mo = new MoveClassDialogOperator();
    JComboBoxOperator location = mo.getLocationCombo();
    switch (target) {
        case SOURCE:
            location.selectItem(0);
            break;
        case TESTS:
            location.selectItem(1);
            break;
    }
    mo.getPackageCombo().clearText();
    mo.getPackageCombo().typeText(newPkg);
    mo.preview();
    dumpRefactoringResults();
}
 
Example 11
Source File: SwitchConfigurationTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public ComponentOperator open() {
    JComboBoxOperator combo = new JComboBoxOperator(propertiesWindow);
    combo.selectItem(1); // NotDefaultConfiguration
    propertiesWindow.ok();
    return null;
    //return MIDletEditorOperator.findMIDletEditorOperator(midletName);
}
 
Example 12
Source File: NavigatorSchemaViewModeTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void initialize() {
    processNode = new EPUtilities().getProcessFilesNode("TravelReservationService");
    Node doc1 = new Node(processNode,"OTA_TravelItinerary_1.xsd");
    doc1.select();
    
    JComboBoxOperator combo = new JComboBoxOperator(new TopComponentOperator("Navigator")); // NOI18N
    combo.selectItem("Schema View"); // NOI18N
}
 
Example 13
Source File: DTDActionsTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void setSwingBrowser() {
    OptionsOperator optionsOper = OptionsOperator.invoke();
    optionsOper.selectGeneral();
    // "Web Browser:"
    String webBrowserLabel = Bundle.getStringTrimmed(OPTIONS_GENERAL_BUNDLE, "CTL_Web_Browser");
    JLabelOperator jloWebBrowser = new JLabelOperator(optionsOper, webBrowserLabel);
    JComboBoxOperator combo = new JComboBoxOperator((JComboBox)jloWebBrowser.getLabelFor());
    combo.selectItem("Swing HTML Browser");
    optionsOper.ok();
}
 
Example 14
Source File: InspectAndTransformOperator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void setSingleInspection(int id){
    JComboBoxOperator combo = new JComboBoxOperator(this, 0);
    combo.selectItem(id);
}
 
Example 15
Source File: PullUpOperator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void setDestinationSupertype(String s){
    JComboBoxOperator combo = new JComboBoxOperator(this);
    combo.selectItem(s);
}
 
Example 16
Source File: EncapsulateFieldOperator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void setInsertPoint(String s){
    JComboBoxOperator combo = new JComboBoxOperator(this, 4);
    combo.selectItem(s);
}
 
Example 17
Source File: EncapsulateFieldOperator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void setSortBy(String s){
    JComboBoxOperator combo = new JComboBoxOperator(this, 2);
    combo.selectItem(s);
}
 
Example 18
Source File: EncapsulateFieldOperator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void setJavadoc(String s){
    JComboBoxOperator combo = new JComboBoxOperator(this, 1);
    combo.selectItem(s);
}
 
Example 19
Source File: EncapsulateFieldOperator.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void setFieldsVisibility(String s){
    JComboBoxOperator combo = new JComboBoxOperator(this, 0);
    combo.selectItem(s);
}
 
Example 20
Source File: AutomaticInternationalizationTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Tests component code with properties Automatic Internationalization =
 * true
 */
public void testAutomaticInternationalizationEnabled() {
    //testAutomaticInternationalization(true);
    OptionsForFormOperator.invoke();
    //add timeout
    waitNoEvent(1000);
    log("Option dialog was opened");

    OptionsForFormOperator options = new OptionsForFormOperator();


    //add timeout
    waitNoEvent(1000);

    options.selectJava();
    //add timeout
    waitNoEvent(1000);
    JTabbedPaneOperator jtpo = new JTabbedPaneOperator(options);
    jtpo.selectPage("GUI Builder");
    waitNoEvent(1000);
    JComboBoxOperator jcbo = new JComboBoxOperator(options, 3);

    jcbo.selectItem("On");
    options.ok();
    //add timeout
    waitNoEvent(2000);
    log("AutomaticResource Management was set");

    name = createJFrameFile();
    FormDesignerOperator designer = new FormDesignerOperator(name);
    designer.source();
    designer.design();


    ComponentInspectorOperator inspector = new ComponentInspectorOperator();
    inspector.freezeNavigatorAndRun(r);

    inspector = new ComponentInspectorOperator();
    Property prop = new Property(inspector.properties(), "text"); // NOI18N
    prop.setValue("Lancia Lybra");
    log("text component of button was set");


    findInCode("jButton1.setText(bundle.getString(\"MyJFrame", designer);

    designer.design();
    //removeFile(name);

}