org.netbeans.jemmy.operators.JLabelOperator Java Examples

The following examples show how to use org.netbeans.jemmy.operators.JLabelOperator. 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: 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 #2
Source File: OptionsForFormOperator.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Selects a category with given name.
 * @param name name of category to be selected
 */
public void selectCategory(final String name) {
    new EventTool().waitNoEvent(300);  // prevent clicking on category button when panel not initialized
    final StringComparator comparator = this.getComparator();
    new JLabelOperator(this, new ComponentChooser() {
        public boolean checkComponent(Component comp) {
            if(comp.getClass().getName().equals("org.netbeans.modules.options.OptionsPanel$CategoryButton")||// NOI18N
                    comp.getClass().getName().equals("org.netbeans.modules.options.OptionsPanel$NimbusCategoryButton")) { // NOI18N
                if(((JLabel)comp).getText() != null) {
                    return comparator.equals(((JLabel)comp).getText(), name);
                }
            }
            return false;
        }
        public String getDescription() {
            return "OptionsPanel$CategoryButton with text "+name; // NOI18N
        }
    }).clickMouse(2);
}
 
Example #3
Source File: PluginsOperatorTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Sets proxy for network connection. */
public void testSetProxy() {
    OptionsOperator optionsOper = OptionsOperator.invoke();
    optionsOper.selectGeneral();
    // "Manual Proxy Setting"
    String hTTPProxyLabel = Bundle.getStringTrimmed(
            "org.netbeans.core.ui.options.general.Bundle", "CTL_Use_HTTP_Proxy");
    new JRadioButtonOperator(optionsOper, hTTPProxyLabel).push();
    // "HTTP Proxy:"
    String proxyHostLabel = Bundle.getStringTrimmed(
            "org.netbeans.core.ui.options.general.Bundle", "CTL_Proxy_Host");
    JLabelOperator jloHost = new JLabelOperator(optionsOper, proxyHostLabel);
    new JTextFieldOperator((JTextField) jloHost.getLabelFor()).typeText("emea-proxy.uk.oracle.com"); // NOI18N
    // "Port:"
    String proxyPortLabel = Bundle.getStringTrimmed(
            "org.netbeans.core.ui.options.general.Bundle", "CTL_Proxy_Port");
    JLabelOperator jloPort = new JLabelOperator(optionsOper, proxyPortLabel);
    new JTextFieldOperator((JTextField) jloPort.getLabelFor()).setText("80"); // NOI18N
    optionsOper.ok();
}
 
Example #4
Source File: OptionsOperator.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Selects a category with given name.
 * @param name name of category to be selected
 */
public void selectCategory(final String name) {
    new EventTool().waitNoEvent(300);  // prevent clicking on category button when panel not initialized
    final StringComparator comparator = this.getComparator();
    new JLabelOperator(this, new ComponentChooser() {
        public boolean checkComponent(Component comp) {
            if(comp.getClass().getName().equals("org.netbeans.modules.options.OptionsPanel$CategoryButton")||// NOI18N
                    comp.getClass().getName().equals("org.netbeans.modules.options.OptionsPanel$NimbusCategoryButton")) { // NOI18N
                if(((JLabel)comp).getText() != null) {
                    return comparator.equals(((JLabel)comp).getText(), name);
                }
            }
            return false;
        }
        public String getDescription() {
            return "OptionsPanel$CategoryButton with text "+name; // NOI18N
        }
    }).clickMouse();
}
 
Example #5
Source File: OptionsOperator.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Waits for the Options window opened
 */
public OptionsOperator() {
    super(waitJDialog(optionsSubchooser));
    // wait until settings are loaded
    // "Loading Settings ..."
    String loadingLabel = Bundle.getString("org.netbeans.modules.options.Bundle", "CTL_Loading_Options");
    long waitTimeout = this.getTimeouts().getTimeout("ComponentOperator.WaitComponentTimeout");
    try {
        this.getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", 5000);
        new JLabelOperator(this, loadingLabel).waitComponentShowing(false);
    } catch (TimeoutExpiredException e) {
        // ignore - options already loaded
    } finally {
        // set previous timeout
        this.getTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", waitTimeout);
    }
}
 
Example #6
Source File: UseDatabaseTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected void addMethod() throws IOException {
    EditorOperator editor = EditorWindowOperator.getEditor(beanName + "Bean.java");
    editor.select("private javax.ejb.SessionContext context;");

    GenerateCodeOperator.openDialog(editorPopup, editor);
    NbDialogOperator chooseDatabaseOper = new NbDialogOperator(dialogTitle);
    new JButtonOperator(chooseDatabaseOper, "Add...").pushNoBlock();
    NbDialogOperator addReferenceOper = new NbDialogOperator("Add Data Source Reference");
    new JTextFieldOperator((JTextField) new JLabelOperator(addReferenceOper, "Reference Name:").getLabelFor()).typeText(name);
    new JButtonOperator(addReferenceOper, "Add...").pushNoBlock();
    NbDialogOperator createDataSourceOper = new NbDialogOperator("Create Data Source");
    new JTextFieldOperator((JTextField) new JLabelOperator(createDataSourceOper, "JNDI Name:").getLabelFor()).typeText(name);
    new JComboBoxOperator(createDataSourceOper).selectItem("/sample");
    createDataSourceOper.ok();
    addReferenceOper.ok();
    chooseDatabaseOper.ok();
    editor.txtEditorPane().waitText(toSearchInEditor);
    if (saveFile) {
        editor.save();
    }
    compareFiles();
}
 
Example #7
Source File: FoDSearchInOptionsTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private JLabelOperator getJLabelOperator(final String category) {
    return new JLabelOperator(optionsOperator, new ComponentChooser() {
        @Override
        public boolean checkComponent(Component comp) {
            if (comp.getClass().getName().equals("org.netbeans.modules.options.OptionsPanel$CategoryButton") ||// NOI18N
                    comp.getClass().getName().equals("org.netbeans.modules.options.OptionsPanel$NimbusCategoryButton")) { // NOI18N
                if (((JLabel) comp).getText() != null) {
                    return stringComparator.equals(((JLabel) comp).getText(), category);
                }
            }
            return false;
        }

        @Override
        public String getDescription() {
            return "OptionsPanel$CategoryButton with text " + category; // NOI18N
        }
    });
}
 
Example #8
Source File: WebProjectValidation.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void testCreateTLD() {
    NewFileWizardOperator newFileWizard = NewFileWizardOperator.invoke();
    // prevent NPE when initializing tooltip (path selection)
    new EventTool().waitNoEvent(1000);
    newFileWizard.selectProject(PROJECT_NAME);
    newFileWizard.selectCategory("Web");
    newFileWizard.selectFileType("Tag Library Descriptor");
    newFileWizard.next();
    NewJavaFileNameLocationStepOperator nameAndLocationOper = new NewJavaFileNameLocationStepOperator();
    nameAndLocationOper.setObjectName("MyTags");
    nameAndLocationOper.cboLocation().selectItem("Web Pages");
    JLabelOperator jle = new JLabelOperator(nameAndLocationOper, "Folder");
    JTextFieldOperator folder = new JTextFieldOperator((JTextField) jle.getLabelFor());
    folder.setText("WEB-INF/tlds");
    nameAndLocationOper.finish();
    Node node = new Node(new WebPagesNode(PROJECT_NAME), "WEB-INF|tlds|MyTags.tld");
    // check class is opened in Editor and then close it
    new EditorOperator("MyTags.tld").close();
}
 
Example #9
Source File: SearchInOptionsTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private JLabelOperator getJLabelOperator(final String category) {
    return new JLabelOperator(optionsOperator, new ComponentChooser() {
        @Override
        public boolean checkComponent(Component comp) {
            if (comp.getClass().getName().equals("org.netbeans.modules.options.OptionsPanel$CategoryButton") ||// NOI18N
                    comp.getClass().getName().equals("org.netbeans.modules.options.OptionsPanel$NimbusCategoryButton")) { // NOI18N
                if (((JLabel) comp).getText() != null) {
                    return stringComparator.equals(((JLabel) comp).getText(), category);
                }
            }
            return false;
        }

        @Override
        public String getDescription() {
            return "OptionsPanel$CategoryButton with text " + category; // NOI18N
        }
    });
}
 
Example #10
Source File: Utils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static void watchProgressBar(TestData data, JFrameOperator frame, String label) {
    new JLabelOperator(frame, label); //dirty hack
    JProgressBarOperator progressBar = new JProgressBarOperator(frame);

    long waitingTime;
    for (waitingTime = 0; waitingTime < Utils.MAX_INSTALATION_WAIT; waitingTime += Utils.DELAY) {
        int val = ((JProgressBar) progressBar.getSource()).getValue();
        if (val >= 100) {
            break;
        }
        Utils.waitSecond(data, 5);
    }

    if (waitingTime >= Utils.MAX_INSTALATION_WAIT) {
        TestCase.fail("Installation timeout");
    }
}
 
Example #11
Source File: IDEValidation.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Test Options  
 * - open Options window from main menu Tools|Options
 * - select Editor category
 * - select Fonts & Colors category
 * - select Keymap category
 * - select General category
 * - pick Manual Proxy Setting
 * - set Proxy Host to emea-proxy.uk.oracle.com
 * - set Proxy Port to 80
 * - click OK to confirm and close Options window
 */
public void testOptions() {
    OptionsOperator optionsOper = OptionsOperator.invoke();
    optionsOper.selectEditor();
    optionsOper.selectFontAndColors();
    optionsOper.selectKeymap();
    optionsOper.selectGeneral();
    // "Manual Proxy Setting"
    String hTTPProxyLabel = Bundle.getStringTrimmed(
            "org.netbeans.core.ui.options.general.Bundle", "CTL_Use_HTTP_Proxy");
    new JRadioButtonOperator(optionsOper, hTTPProxyLabel).push();
    // "HTTP Proxy:"
    String proxyHostLabel = Bundle.getStringTrimmed(
            "org.netbeans.core.ui.options.general.Bundle", "CTL_Proxy_Host");
    JLabelOperator jloHost = new JLabelOperator(optionsOper, proxyHostLabel);
    new JTextFieldOperator((JTextField) jloHost.getLabelFor()).setText("emea-proxy.uk.oracle.com"); // NOI18N
    // "Port:"
    String proxyPortLabel = Bundle.getStringTrimmed(
            "org.netbeans.core.ui.options.general.Bundle", "CTL_Proxy_Port");
    JLabelOperator jloPort = new JLabelOperator(optionsOper, proxyPortLabel);
    new JTextFieldOperator((JTextField) jloPort.getLabelFor()).setText("80"); // NOI18N
    optionsOper.ok();
}
 
Example #12
Source File: ProjectsTabOperator.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Gets ProjectRootNode. Wait if Opening Projects label is in main window
 * progress bar.
 *
 * @param projectName display name of project
 * @return ProjectsRootNode
 */
public ProjectRootNode getProjectRootNode(String projectName) {
    final String openingProjectsLabel = "Opening Projects";
    Object lblOpening = JLabelOperator.findJLabel(
            (Container) MainWindowOperator.getDefault().getSource(),
            openingProjectsLabel, false, false);
    if (lblOpening != null) {
        JLabelOperator lblOper = new JLabelOperator((JLabel) lblOpening);
        lblOper.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 180000);
        lblOper.waitState(new ComponentChooser() {
            @Override
            public boolean checkComponent(Component comp) {
                String text = ((JLabel) comp).getText();
                return text == null || !text.startsWith(openingProjectsLabel) || !comp.isShowing();
            }

            @Override
            public String getDescription() {
                return openingProjectsLabel + " label disappears";
            }
        });
    }
    return new ProjectRootNode(tree(), projectName);
}
 
Example #13
Source File: ShowDescriptionAreaActionTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** simple test case
 */
public void testPerformPopup() {
    Node node = new Node(new SourcePackagesNode("SampleProject"), "sample1|SampleClass1.java"); // NOI18N
    new PropertiesAction().perform(node);
    PropertySheetOperator pso = new PropertySheetOperator("SampleClass1.java"); // NOI18N
    // check whether description area is shown
    pso.lblDescriptionHeader();
    new ShowDescriptionAreaAction().perform(pso);
    // check whether description area is not shown
    Object label = JLabelOperator.findJLabel((Container) pso.getSource(), ComponentSearcher.getTrueChooser("JLabel")); //NOI18N
    new ShowDescriptionAreaAction().perform(pso);
    // check whether description area is shown
    pso.lblDescriptionHeader();
    pso.close();
    assertNull("Description area not dismissed.", label); // NOI18N
}
 
Example #14
Source File: PerfUtil.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public static void setSwingBrowser() {
    // Set Swing HTML Browser as default browser
    OptionsOperator optionsOper = OptionsOperator.invoke();
    optionsOper.selectGeneral();
    // "Web Browser:"
    String webBrowserLabel = Bundle.getStringTrimmed(
            "org.netbeans.modules.options.general.Bundle",
            "CTL_Web_Browser");
    JLabelOperator jloWebBrowser = new JLabelOperator(optionsOper, webBrowserLabel);
    // "Swing HTML Browser"
    String swingBrowserLabel = Bundle.getString(
            "org.netbeans.core.ui.Bundle",
            "Services/Browsers/SwingBrowser.ser");
    new JComboBoxOperator((JComboBox)jloWebBrowser.getLabelFor()).
            selectItem(swingBrowserLabel);
    optionsOper.ok();
}
 
Example #15
Source File: PerfIDEValidation.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Test Options  
 * - open Options window from main menu Tools|Options
 * - select Editor category
 * - select Fonts & Colors category
 * - select Keymap category
 * - select General category
 * - pick Manual Proxy Setting
 * - set Proxy Host to emea-proxy.uk.oracle.com
 * - set Proxy Port to 80
 * - click OK to confirm and close Options window
 */
public void testOptions() {
    OptionsOperator optionsOper = OptionsOperator.invoke();
    optionsOper.selectEditor();
    optionsOper.selectFontAndColors();
    optionsOper.selectKeymap();
    optionsOper.selectGeneral();
    // "Manual Proxy Setting"
    String hTTPProxyLabel = Bundle.getStringTrimmed(
            "org.netbeans.core.ui.options.general.Bundle", "CTL_Use_HTTP_Proxy");
    new JRadioButtonOperator(optionsOper, hTTPProxyLabel).push();
    // "HTTP Proxy:"
    String proxyHostLabel = Bundle.getStringTrimmed(
            "org.netbeans.core.ui.options.general.Bundle", "CTL_Proxy_Host");
    JLabelOperator jloHost = new JLabelOperator(optionsOper, proxyHostLabel);
    new JTextFieldOperator((JTextField) jloHost.getLabelFor()).setText("www-proxy.uk.oracle.com"); // NOI18N
    // "Port:"
    String proxyPortLabel = Bundle.getStringTrimmed(
            "org.netbeans.core.ui.options.general.Bundle", "CTL_Proxy_Port");
    JLabelOperator jloPort = new JLabelOperator(optionsOper, proxyPortLabel);
    new JTextFieldOperator((JTextField) jloPort.getLabelFor()).setText("80"); // NOI18N
    optionsOper.ok();
}
 
Example #16
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 #17
Source File: IndentCasesTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static void setIndent(int number){
    OptionsOperator options = OptionsOperator.invoke();
    options.selectEditor();
    new JTabbedPaneOperator(options).selectPage("Formatting");
    JLabelOperator label = new JLabelOperator(options, "Number");
    JSpinner spinner = (JSpinner) label.getLabelFor();
    JSpinnerOperator spinnerOp = new JSpinnerOperator(spinner);
    spinnerOp.getNumberSpinner().scrollToValue(number);
    options.ok();
}
 
Example #18
Source File: WizardOperatorTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Test of back method. Go to next panel, then back and check if
 * first panel is shown. */
public void testBack() {
    WizardOperator wo = new WizardOperator(TEST_WIZARD_TITLE);
    wo.next();
    wo.back();
    String text = new JLabelOperator(wo, TEST_WIZARD_LABEL).getText();
    assertEquals("Back not detected correctly.", TEST_WIZARD_LABEL + "0", text);
}
 
Example #19
Source File: Utils.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static boolean checkMissingServer(String projectName) {
    // check missing target server dialog is shown    
    // "Open Project"
    String openProjectTitle = Bundle.getString("org.netbeans.modules.j2ee.common.ui.Bundle", "MSG_Broken_Server_Title");
    boolean needToSetServer = false;
    if (JDialogOperator.findJDialog(openProjectTitle, true, true) != null) {
        new NbDialogOperator(openProjectTitle).close();
        needToSetServer = true;
    }
    // open project properties
    ProjectsTabOperator.invoke().getProjectRootNode(projectName).properties();
    // "Project Properties"
    String projectPropertiesTitle = Bundle.getStringTrimmed("org.netbeans.modules.web.project.ui.customizer.Bundle", "LBL_Customizer_Title");
    NbDialogOperator propertiesDialogOper = new NbDialogOperator(projectPropertiesTitle);
    // select "Run" category
    new Node(new JTreeOperator(propertiesDialogOper), "Run").select();
    if (needToSetServer) {
        // set default server
        JComboBox comboBox = (JComboBox) new JLabelOperator(propertiesDialogOper, "Server").getLabelFor();
        new JComboBoxOperator(comboBox).setSelectedIndex(0);
    }
    // confirm properties dialog
    propertiesDialogOper.ok();
    // if setting default server, it scans server jars; otherwise it continues immediatelly
    WatchProjects.waitScanFinished();
    return needToSetServer;
}
 
Example #20
Source File: DialogDemoTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void initialCheckWithLabel(JFrameOperator frame, JDialogOperator jdo) {
    JLabelOperator label = new JLabelOperator(jdo);
    assertFalse("JFrame is not iconified", isIconified(frame));
    assertEquals("Only one JDialog is present", 1,
            countWindows(jDialogClassChooser));
    assertEquals(LABEL_CONTENT, label.getText());
}
 
Example #21
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 #22
Source File: MeasureEntityBeanActionTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void prepare() {
    new ActionNoBlock(null, popup_menu).perform(beanNode);
    dialog = new NbDialogOperator(title);
    JLabelOperator lblOper = new JLabelOperator(dialog, "Name");
    name += CommonUtilities.getTimeIndex();
    new JTextFieldOperator((JTextField) lblOper.getLabelFor()).setText(name);
}
 
Example #23
Source File: MeasureSessionBeanActionTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void prepare() {
    Node beanNode = new Node(new ProjectsTabOperator().getProjectRootNode("TestApplication-ejb"), "Enterprise Beans|TestSessionSB");
    new ActionNoBlock(null, "Add|Business Method...").perform(beanNode);
    dialog = new NbDialogOperator("Business Method...");
    JLabelOperator lblOper = new JLabelOperator(dialog, "Name");
    name = "testBusinessMethod" + CommonUtilities.getTimeIndex();
    new JTextFieldOperator((JTextField) lblOper.getLabelFor()).setText(name);
}
 
Example #24
Source File: TextFieldDemoTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void dateTextField(JFrameOperator jfo) throws Exception {
    JTextFieldOperator jtfo = new JTextFieldOperator(jfo,
            new ByClassChooser(JFormattedTextField.class));
    ContainerOperator<?> containerOperator = new ContainerOperator<>(jtfo.getParent());
    JButtonOperator jbo = new JButtonOperator(containerOperator, GO);
    JLabelOperator dowLabel = new JLabelOperator(containerOperator);
    Calendar calendar = Calendar.getInstance(Locale.ENGLISH);

    // Check default date Day of the Week
    jbo.push();
    dowLabel.waitText(calendar.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.ENGLISH));

    // Check Custom Day of the Week
    calendar.set(2012, 9, 11); // Represents "Oct 11, 2012"
    Date date = calendar.getTime();
    String dateString = jtfo.getQueueTool().invokeAndWait(
            new QueueTool.QueueAction<String>("Formatting the value using JFormattedTextField formatter") {

        @Override
        public String launch() throws Exception {
            return ((JFormattedTextField) jtfo.getSource()).getFormatter().valueToString(date);
        }
    });
    System.out.println("dateString = " + dateString);
    jtfo.enterText(dateString);

    jbo.push();
    dowLabel.waitText("Thursday");
}
 
Example #25
Source File: ProfilerValidationTest.java    From visualvm with GNU General Public License v2.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 #26
Source File: WizardOperatorTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Test of next method. Go to next panel and check if second panel
 * is shown. */
public void testNext() {
    WizardOperator wo = new WizardOperator(TEST_WIZARD_TITLE);
    wo.next();
    String text = new JLabelOperator(wo, TEST_WIZARD_LABEL).getText();
    assertEquals("Next not detected correctly.", TEST_WIZARD_LABEL + "1", text);
}
 
Example #27
Source File: CreateNBProjectTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public ComponentOperator open() {
    if (project_type.equalsIgnoreCase("moduleProject")) {
        wizard_location.next();
        next = new NbDialogOperator("New Module");
        new JTextFieldOperator((JTextField) new JLabelOperator(next, "Code Name Base").getLabelFor()).setText("test");
    }
    wizard_location.finish();
    new ProjectsTabOperator().getProjectRootNode(project_name);
    return null;
}
 
Example #28
Source File: WizardsTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Test new project wizard using generic WizardOperator. */
public void testGenericWizards() {
    // open new project wizard
    NewProjectWizardOperator npwo = NewProjectWizardOperator.invoke();
    npwo.selectCategory("Java Web");
    npwo.selectProject("Web Application");
    npwo.next();
    // create operator for next page
    WizardOperator wo = new WizardOperator("Web Application");
    JTextFieldOperator txtName = new JTextFieldOperator((JTextField) new JLabelOperator(wo, "Project Name:").getLabelFor());
    txtName.clearText();
    txtName.typeText("MyApp");
    wo.cancel();
}
 
Example #29
Source File: PropertySheetOperatorTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Test of showDescriptionArea method */
public void testShowDescriptionArea() {
    pso.showDescriptionArea();
    // try to find description header label
    Object label = pso.findSubComponent(new JLabelOperator.JLabelFinder());
    assertNull("Description area was not hidden.", label);
    pso.showDescriptionArea();
    // try to find description header label
    label = pso.findSubComponent(new JLabelOperator.JLabelFinder());
    assertNotNull("Description area was not shown.", label);
}
 
Example #30
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( );
}