Java Code Examples for org.netbeans.jemmy.operators.JTextFieldOperator#enterText()

The following examples show how to use org.netbeans.jemmy.operators.JTextFieldOperator#enterText() . 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: OutputTabOperatorTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Test of find method.
 */
public void testFind() {
    outputTabOperator.find();
    // "Find"
    String findTitle = Bundle.getString("org.netbeans.core.output2.Bundle", "LBL_Find_Title");
    NbDialogOperator findDialog = new NbDialogOperator(findTitle);
    // assuming somthing with 'a' is printed in output
    JTextFieldOperator jtfo = new JTextFieldOperator(findDialog);
    jtfo.enterText("a");   // NOI18N
    try {
        // need to wait find action is finished
        findDialog.waitClosed();
    } catch (JemmyException e) {
        // sometimes it fails on Solaris => try it once more in Robot mode
        log("Dialog not closed first time. Trying once more.");
        // "Find"
        String findButtonLabel = Bundle.getStringTrimmed("org.netbeans.core.output2.Bundle", "BTN_Find");
        JButtonOperator findButtonOper = new JButtonOperator(findDialog, findButtonLabel);
        findButtonOper.getProperties().setDispatchingModel(JemmyProperties.ROBOT_MODEL_MASK);
        findButtonOper.push();
        findDialog.waitClosed();
    }
    new EventTool().waitNoEvent(1000);
}
 
Example 2
Source File: GeneralPHP.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void setPHPIndentation(int initialIndentation, int contIndentation, int arrayDeclarationIndentation) {
    JDialogOperator window = selectPHPFromEditorOptions(1, getPlatform());

    //categories - check if they are all present
    JComboBoxOperator category = new JComboBoxOperator(window, 1);
    category.selectItem("Tabs And Indents");

    JTextFieldOperator initialIndentTextField = new JTextFieldOperator(window, 1);
    initialIndentTextField.clearText();
    initialIndentTextField.enterText(
            String.valueOf(initialIndentation));

    JTextFieldOperator contIndentTextField = new JTextFieldOperator(window, 2);
    contIndentTextField.clearText();
    contIndentTextField.enterText(
            String.valueOf(contIndentation));

    JTextFieldOperator arrayDeclarationIndentTextField = new JTextFieldOperator(window, 1);
    arrayDeclarationIndentTextField.clearText();
    arrayDeclarationIndentTextField.enterText(
            String.valueOf(arrayDeclarationIndentation));


}
 
Example 3
Source File: SplitPaneDemoTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void changeMinimumSizes(JFrameOperator frame, JSplitPaneOperator splitPane, int amount) throws Exception {
    for (String label : new String[]{FIRST_COMPONENT_MIN_SIZE, SECOND_COMPONENT_MIN_SIZE}) {
        JTextFieldOperator size = new JTextFieldOperator(getLabeledContainerOperator(frame, label));
        size.enterText(Integer.toString(amount));
        size.pressKey(KeyEvent.VK_ENTER);
    }
    checkDividerMoves(frame, splitPane, false);
    checkDividerMoves(frame, splitPane, true);
}
 
Example 4
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 5
Source File: Autoupdate.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void GeneralChecks( )
{
  startTest( );

  // Open
  new JMenuBarOperator(MainWindowOperator.getDefault()).pushMenuNoBlock("Tools|Plugins");

  JDialogOperator jdPlugins = new JDialogOperator( "Plugins" );
  //try{ Dumper.dumpAll( "c:\\dump.txt" ); } catch( IOException ex ) { }

  // Wait for a while because tab selection might change.
  Sleep( 2000 );

  // Check tabs
  JTabbedPaneOperator jtTabs = new JTabbedPaneOperator( jdPlugins, 0 );
  String[] asTabs =
  {
    "Updates",
    "Available Plugins",
    "Downloaded",
    "Installed",
    "Settings"
  };

  int iCount = jtTabs.getTabCount( );
  if( iCount != asTabs.length )
    fail( "Invalid number of tabs: " + iCount + ", expected: " + asTabs.length );
  for( int iIndex = 0; iIndex < asTabs.length; iIndex++ )
  {
    String sTitle = jtTabs.getTitleAt( iIndex );
    if( !sTitle.startsWith( asTabs[ iIndex ] ) )
      fail( "Invalid tab at index " + iIndex + ": \"" + sTitle + "\"" );
  }

  // Check buttons
  new JButtonOperator( jdPlugins, "Reload Catalog" );
  new JButtonOperator( jdPlugins, "Uninstall" );
  new JButtonOperator( jdPlugins, "Deactivate" );
  new JButtonOperator( jdPlugins, "Help" );

  // Check there is label
  new JLabelOperator( jdPlugins, "Search:" );

  // Check there is table operator
  new JTableOperator( jdPlugins, 0 );

  // Search text field
  JTextFieldOperator jtSearch = new JTextFieldOperator( jdPlugins, 0 );
  // Check does this field affect selection
  String sSelected = jtTabs.getTitleAt( jtTabs.getSelectedIndex( ) );
  System.out.println( "===" + sSelected );
  jtSearch.enterText( "java" );
  Sleep( 2000 );
  sSelected = jtTabs.getTitleAt( jtTabs.getSelectedIndex( ) );
  System.out.println( "===" + sSelected );
  if( !sSelected.matches( "Installed [(][0-9]+/[0-9]+[)]" ) )
    fail( "Invalid result of filtering." );
  jtSearch.enterText( "" );

  // Close by button
  JButtonOperator jbClose = new JButtonOperator( jdPlugins, "Close" );
  jbClose.push( );
  jdPlugins.waitClosed( );

  endTest( );
}
 
Example 6
Source File: SplitPaneDemoTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void changeDividerSize(JFrameOperator frame, JSplitPaneOperator splitPane, int amount) throws Exception {
    JTextFieldOperator size = new JTextFieldOperator(getLabeledContainerOperator(frame, DIVIDER_SIZE));
    size.enterText(Integer.toString(amount));
    waitDividerSize(splitPane, amount);
}