Package net.sf.swtbot.wait

Examples of net.sf.swtbot.wait.DefaultCondition


     * @throws TimeoutException
     */
    public static void asyncClick( final SWTEclipseBot bot, final SWTBotButton button, final ICondition waitCondition )
        throws TimeoutException
    {
        bot.waitUntil( new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return button.isEnabled();
            }
View Full Code Here


            {
                entry.expand();
            }
        } );

        bot.waitUntil( new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                if ( nextName != null )
                {
View Full Code Here

        // click "Check Network Parameter" button
        SWTBotButton checkButton = bot.button( "Check Network Parameter" );
        checkButton.click();
        bot.sleep( 1000 );
        bot.waitUntil( new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.activeShell().getText().equals( "Check Network Parameter" ) && bot.button( "OK" ) != null;
            }
View Full Code Here

        // click "Check Network Parameter" button
        SWTBotButton checkButton = bot.button( "Check Network Parameter" );
        checkButton.click();
        bot.sleep( 1000 );
        bot.waitUntil( new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.activeShell().getText().equals( "Error" ) && bot.button( "OK" ) != null;
            }
View Full Code Here

    {
        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
        SWTBotUtils.selectEntry( bot, browserTree, true, "DIT", "Root DSE", "ou=system" );

        // open "New Entry" wizard
        SWTBotUtils.asyncClick( bot, browserTree.contextMenu( "New Entry..." ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.shell( "New Entry" ) != null;
            }


            public String getFailureMessage()
            {
                return "Could not find dialog 'New Entry'";
            }
        } );

        // select entry creation method
        bot.radio( "Create entry from scratch" ).click();
        bot.button( "Next >" ).click();

        // select object classes
        bot.table( 0 ).select( "organization" );
        bot.button( "Add" ).click();
        bot.button( "Next >" ).click();

        // specify DN
        SWTBotCombo typeCombo = bot.comboBoxWithLabel( "RDN:" );
        typeCombo.setText( "o" );
        SWTBotText valueText = bot.text( "" );
        valueText.setText( "testCreateOrganizationEntry" );
        SWTBotUtils.asyncClick( bot, bot.button( "Next >" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.tree( 0 ) != null;
            }


            public String getFailureMessage()
            {
                return "Could not find widget";
            }
        } );

        // click finish to create the entry
        SWTBotUtils.asyncClick( bot, bot.button( "Finish" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return browserTree.selection().get( 0 ).get( 0 ).startsWith( "o=testCreateOrganizationEntry" );
            }
View Full Code Here

    {
        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
        SWTBotUtils.selectEntry( bot, browserTree, true, "DIT", "Root DSE", "ou=system" );

        // open "New Entry" wizard
        SWTBotUtils.asyncClick( bot, browserTree.contextMenu( "New Entry..." ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.shell( "New Entry" ) != null;
            }


            public String getFailureMessage()
            {
                return "Could not find dialog 'New Entry'";
            }
        } );

        // select entry creation method
        bot.radio( "Create entry from scratch" ).click();
        bot.button( "Next >" ).click();

        // select object classes
        bot.table( 0 ).select( "inetOrgPerson" );
        bot.button( "Add" ).click();
        bot.button( "Next >" ).click();

        // specify DN
        SWTBotCombo typeCombo = bot.comboBoxWithLabel( "RDN:" );
        typeCombo.setText( "cn" );
        SWTBotText valueText = bot.text( "" );
        valueText.setText( "testCreatePersonEntry" );
        SWTBotUtils.asyncClick( bot, bot.button( "Next >" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.tree( 0 ) != null;
            }


            public String getFailureMessage()
            {
                return "Could not find widget";
            }
        } );

        // enter sn value
        SWTBotTree tree = bot.tree( 0 );
        tree.select( "sn" );
        bot.text( "" ).setText( "test" );
        // click to finish editing of sn
        SWTBotTreeItem snNode = tree.getTreeItem( "sn" );
        snNode.click();

        // click finish to create the entry
        SWTBotUtils.asyncClick( bot, bot.button( "Finish" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return browserTree.selection().get( 0 ).get( 0 ).startsWith( "cn=testCreatePersonEntry" );
            }
View Full Code Here

    {
        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
        SWTBotUtils.selectEntry( bot, browserTree, true, "DIT", "Root DSE", "ou=system" );

        // open "New Entry" wizard
        SWTBotUtils.asyncClick( bot, browserTree.contextMenu( "New Entry..." ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.shell( "New Entry" ) != null;
            }


            public String getFailureMessage()
            {
                return "Could not find dialog 'New Entry'";
            }
        } );

        // select entry creation method
        bot.radio( "Create entry from scratch" ).click();
        bot.button( "Next >" ).click();

        // select object classes
        bot.table( 0 ).select( "organization" );
        bot.button( "Add" ).click();
        bot.button( "Next >" ).click();

        // specify DN
        SWTBotCombo typeCombo = bot.comboBoxWithLabel( "RDN:" );
        typeCombo.setText( "O" );
        SWTBotText valueText = bot.text( "" );
        valueText.setText( "testCreateOrganizationEntry" );
        SWTBotUtils.asyncClick( bot, bot.button( "Next >" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.tree( 0 ) != null;
            }


            public String getFailureMessage()
            {
                return "Could not find widget";
            }
        } );

        // click finish to create the entry
        SWTBotUtils.asyncClick( bot, bot.button( "Finish" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return browserTree.selection().get( 0 ).get( 0 ).startsWith( "O=testCreateOrganizationEntry" );
            }


            public String getFailureMessage()
            {
                return "Could not find 'O=testCreateOrganizationEntry'";
            }
        } );

        // Now create a second entry under the previously created entry
        // to ensure that the selected parent is also upper case.

        // open "New Entry" wizard
        SWTBotUtils.asyncClick( bot, browserTree.contextMenu( "New Entry..." ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.shell( "New Entry" ) != null;
            }


            public String getFailureMessage()
            {
                return "Could not find dialog 'New Entry'";
            }
        } );

        // select entry creation method
        bot.radio( "Create entry from scratch" ).click();
        bot.button( "Next >" ).click();

        // select object classes
        bot.table( 0 ).select( "organization" );
        bot.button( "Add" ).click();
        bot.button( "Next >" ).click();

        // specify DN
        typeCombo = bot.comboBoxWithLabel( "RDN:" );
        typeCombo.setText( "O" );
        valueText = bot.text( "" );
        valueText.setText( "testCreateOrganizationEntry2" );

        // check preview text
        SWTBotText previewText = bot.text( "O=testCreateOrganizationEntry2,O=testCreateOrganizationEntry,ou=system" );
        assertEquals( "O=testCreateOrganizationEntry2,O=testCreateOrganizationEntry,ou=system", previewText.getText() );

        SWTBotUtils.asyncClick( bot, bot.button( "Next >" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.tree( 0 ) != null;
            }


            public String getFailureMessage()
            {
                return "Could not find widget";
            }
        } );

        // click finish to create the entry
        SWTBotUtils.asyncClick( bot, bot.button( "Finish" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return browserTree.selection().get( 0 ).get( 0 ).startsWith( "O=testCreateOrganizationEntry2" );
            }
View Full Code Here

    {
        final SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
        SWTBotUtils.selectEntry( bot, browserTree, true, "DIT", "Root DSE", "ou=system" );

        // open "New Entry" wizard
        SWTBotUtils.asyncClick( bot, browserTree.contextMenu( "New Entry..." ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.shell( "New Entry" ) != null;
            }


            public String getFailureMessage()
            {
                return "Could not find dialog 'New Entry'";
            }
        } );

        // select entry creation method
        bot.radio( "Create entry from scratch" ).click();
        bot.button( "Next >" ).click();

        // select object classes
        bot.table( 0 ).select( "krb5Principal" );
        bot.button( "Add" ).click();
        bot.table( 0 ).select( "person" );
        bot.button( "Add" ).click();
        bot.button( "Next >" ).click();

        // specify DN
        SWTBotCombo typeCombo = bot.comboBoxWithLabel( "RDN:" );
        typeCombo.setText( "krb5PrincipalName" );
        SWTBotText valueText = bot.text( "" );
        valueText.setText( "kadmin/changepw@DOMAIN" );
        SWTBotUtils.asyncClick( bot, bot.button( "Next >" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.tree( 0 ) != null;
            }


            public String getFailureMessage()
            {
                return "Could not find entry editor";
            }
        } );

        SWTBotTree tree = bot.tree( 0 );
        SWTBotTreeItem krbNode = tree.getTreeItem( "krb5PrincipalName" );

        // enter cn value
        tree.select( "cn" );
        bot.text( "" ).setText( "test" );
        // click to finish editing of cn
        krbNode.click();

        // enter sn value
        tree.select( "sn" );
        bot.text( "" ).setText( "test" );
        // click to finish editing of sn
        krbNode.click();

        // click finish to create the entry
        SWTBotUtils.asyncClick( bot, bot.button( "Finish" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return browserTree.selection().get( 0 ).get( 0 )
                    .startsWith( "krb5PrincipalName=kadmin/changepw@DOMAIN" );
View Full Code Here

        final SWTBotTree entryEditorTree = SWTBotUtils.getEntryEditorTree( bot );

        // add description attribute
        entryEditorTree.contextMenu( "New Attribute..." ).click();
        bot.comboBoxWithLabel( "Attribute type:" ).setText( "description" );
        SWTBotUtils.asyncClick( bot, bot.button( "Finish" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.text( "" ) != null;
            }


            public String getFailureMessage()
            {
                return "Could not find empty description attribute";
            }
        } );
        bot.text( "" ).setText( "This is the 1st description." );
        SWTBotUtils.asyncClick( bot, entryEditorTree.getTreeItem( "objectClass" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return entryEditorTree.cell( 6, 0 ).equals( "description" )
                    && entryEditorTree.cell( 6, 1 ).equals( "This is the 1st description." );
            }


            public String getFailureMessage()
            {
                return "Could not find attribute 'description:This is the 1st description.'";
            }
        } );

        // add second value
        entryEditorTree.getTreeItem( "description" ).click();
        SWTBotUtils.asyncClick( bot, entryEditorTree.contextMenu( "New Value" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.text( "" ) != null;
            }


            public String getFailureMessage()
            {
                return "Could not find empty description attribute";
            }
        } );
        bot.text( "" ).setText( "This is the 2nd description." );
        SWTBotUtils.asyncClick( bot, entryEditorTree.getTreeItem( "objectClass" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return entryEditorTree.cell( 7, 0 ).equals( "description" )
                    && entryEditorTree.cell( 7, 1 ).equals( "This is the 2nd description." );
            }


            public String getFailureMessage()
            {
                return "Could not find attribute 'description:This is the 2nd description.'";
            }
        } );

        // edit second value
        entryEditorTree.select( 7 );
        SWTBotUtils.asyncClick( bot, entryEditorTree.contextMenu( "Edit Value" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.text( "This is the 2nd description." ) != null;
            }


            public String getFailureMessage()
            {
                return "Could not find description 'This is the 2nd description.'";
            }
        } );
        bot.text( "This is the 2nd description." ).setText( "This is the 3rd description." );
        SWTBotUtils.asyncClick( bot, entryEditorTree.getTreeItem( "objectClass" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return entryEditorTree.cell( 7, 0 ).equals( "description" )
                    && entryEditorTree.cell( 7, 1 ).equals( "This is the 3rd description." );
            }


            public String getFailureMessage()
            {
                return "Could not find attribute 'description:This is the 3rd description.'";
            }
        } );

        // delete second value
        entryEditorTree.select( 7 );
        entryEditorTree.contextMenu( "Delete Value" ).click();
        SWTBotUtils.asyncClick( bot, bot.button( "OK" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return !entryEditorTree.cell( 7, 0 ).equals( "description" )
                    && entryEditorTree.cell( 6, 0 ).equals( "description" )
                    && entryEditorTree.cell( 6, 1 ).equals( "This is the 1st description." );
            }


            public String getFailureMessage()
            {
                return "Attribute 'description' is still there.";
            }
        } );

        // edit 1st value
        entryEditorTree.select( 6 );
        SWTBotUtils.asyncClick( bot, entryEditorTree.contextMenu( "Edit Value" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.text( "This is the 1st description." ) != null;
            }


            public String getFailureMessage()
            {
                return "Could not find description 'This is the 1st description.'";
            }
        } );
        bot.text( "This is the 1st description." ).setText( "This is the final description." );
        SWTBotUtils.asyncClick( bot, entryEditorTree.getTreeItem( "objectClass" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return entryEditorTree.cell( 6, 0 ).equals( "description" )
                    && entryEditorTree.cell( 6, 1 ).equals( "This is the final description." );
            }


            public String getFailureMessage()
            {
                return "Could not find attribute 'description:This is the final description.'";
            }
        } );

        // delete 1st value/attribute
        entryEditorTree.select( 6 );
        entryEditorTree.contextMenu( "Delete Attribute" ).click();
        SWTBotUtils.asyncClick( bot, bot.button( "OK" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return !entryEditorTree.cell( 6, 0 ).equals( "description" );
            }
View Full Code Here


    private void createAndDeleteEntry( final SWTBotTree browserTree, final String name ) throws Exception
    {
        SWTBotUtils.selectEntry( bot, browserTree, true, "DIT", "Root DSE", "ou=system" );
        SWTBotUtils.asyncClick( bot, browserTree.contextMenu( "New Entry..." ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.shell( "New Entry" ) != null;
            }


            public String getFailureMessage()
            {
                return "Could not find dialog 'New Entry'";
            }
        } );

        bot.radio( "Create entry from scratch" ).click();
        bot.button( "Next >" ).click();

        bot.table( 0 ).select( "organization" );
        bot.button( "Add" ).click();
        bot.button( "Next >" ).click();

        SWTBotCombo typeCombo = bot.comboBoxWithLabel( "RDN:" );
        typeCombo.setText( "o" );
        SWTBotText valueText = bot.text( "" );
        valueText.setText( name );
        SWTBotUtils.asyncClick( bot, bot.button( "Next >" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.button( "Finish" ).isEnabled();
            }


            public String getFailureMessage()
            {
                return "Finish button is not enabled";
            }
        } );

        // click finish to create the entry
        SWTBotUtils.asyncClick( bot, bot.button( "Finish" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return browserTree.selection().get( 0 ).get( 0 ).startsWith( "o=" + name );
            }


            public String getFailureMessage()
            {
                return "Could not select 'o=" + name + "'";
            }
        } );

        // delete the entry
        SWTBotUtils.selectEntry( bot, browserTree, false, "DIT", "Root DSE", "ou=system", "o=" + name );
        SWTBotUtils.asyncClick( bot, browserTree.contextMenu( "Delete Entry" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return bot.shell( "Delete Entry" ) != null;
            }


            public String getFailureMessage()
            {
                return "Could not find dialog 'New Entry'";
            }
        } );
        SWTBotUtils.asyncClick( bot, bot.button( "OK" ), new DefaultCondition()
        {
            public boolean test() throws Exception
            {
                return browserTree.selection().get( 0 ).get( 0 ).startsWith( "ou=system" );
            }
View Full Code Here

TOP

Related Classes of net.sf.swtbot.wait.DefaultCondition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.