directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1681830 - in /directory/studio/trunk/tests/test.integration.ui: ./ src/main/java/org/apache/directory/studio/test/integration/ui/ src/main/java/org/apache/directory/studio/test/integration/ui/bots/ src/main/java/org/apache/directory/studio...
Date Tue, 26 May 2015 19:49:08 GMT
Author: seelmann
Date: Tue May 26 19:49:08 2015
New Revision: 1681830

URL: http://svn.apache.org/r1681830
Log:
DIRSTUDIO-1010: Tests to verify visible and hidden views, wizards, preference pages

Added:
    directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RcpAppTest.java
    directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ShowViewsBot.java
    directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/TreeBot.java
Modified:
    directory/studio/trunk/tests/test.integration.ui/pom.xml
    directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ExportWizardBot.java
    directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ImportWizardBot.java
    directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewWizardBot.java
    directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/PreferencesBot.java
    directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
    directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/WizardBot.java

Modified: directory/studio/trunk/tests/test.integration.ui/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/pom.xml?rev=1681830&r1=1681829&r2=1681830&view=diff
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/pom.xml (original)
+++ directory/studio/trunk/tests/test.integration.ui/pom.xml Tue May 26 19:49:08 2015
@@ -80,6 +80,11 @@
               </requirement>
               <requirement>
                 <type>eclipse-feature</type>
+                <id>org.eclipse.platform</id>
+                <versionRange>0.0.0</versionRange>
+              </requirement>
+              <requirement>
+                <type>eclipse-feature</type>
                 <id>org.apache.directory.studio.rcp.feature</id>
                 <versionRange>0.0.0</versionRange>
               </requirement>

Added: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RcpAppTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RcpAppTest.java?rev=1681830&view=auto
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RcpAppTest.java
(added)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RcpAppTest.java
Tue May 26 19:49:08 2015
@@ -0,0 +1,341 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+
+package org.apache.directory.studio.test.integration.ui;
+
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.studio.test.integration.ui.bots.ExportWizardBot;
+import org.apache.directory.studio.test.integration.ui.bots.ImportWizardBot;
+import org.apache.directory.studio.test.integration.ui.bots.NewWizardBot;
+import org.apache.directory.studio.test.integration.ui.bots.PreferencesBot;
+import org.apache.directory.studio.test.integration.ui.bots.ShowViewsBot;
+import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
+import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * General tests of the Studio RCP application: layout of perspectives, visible menu items,
etc.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
+public class RcpAppTest extends AbstractLdapTestUnit
+{
+    private SWTWorkbenchBot bot;
+    private StudioBot studioBot;
+
+
+    @Before
+    public void setUp() throws Exception
+    {
+        bot = new SWTWorkbenchBot();
+        studioBot = new StudioBot();
+        studioBot.resetLdapPerspective();
+    }
+
+
+    @After
+    public void tearDown() throws Exception
+    {
+    }
+
+
+    /**
+     * Verify views in LDAP perspective.
+     */
+    @Test
+    public void testLdapPerspectiveViews() throws Exception
+    {
+        studioBot.resetLdapPerspective();
+
+        assertNotNull( bot.viewByTitle( "LDAP Browser" ) );
+        assertNotNull( bot.viewByTitle( "LDAP Servers" ) );
+        assertNotNull( bot.viewByTitle( "Connections" ) );
+        assertNotNull( bot.viewByTitle( "Outline" ) );
+        assertNotNull( bot.viewByTitle( "Progress" ) );
+        assertNotNull( bot.viewByTitle( "Modification Logs" ) );
+        assertNotNull( bot.viewByTitle( "Search Logs" ) );
+        assertNotNull( bot.viewByTitle( "Error Log" ) );
+    }
+
+
+    /**
+     * Verify views in Schema Editor perspective.
+     */
+    @Test
+    public void testSchemaEditorPerspectiveViews() throws Exception
+    {
+        studioBot.resetSchemaPerspective();
+
+        assertNotNull( bot.viewByTitle( "Schema" ) );
+        assertNotNull( bot.viewByTitle( "Hierarchy" ) );
+        assertNotNull( bot.viewByTitle( "Projects" ) );
+        assertNotNull( bot.viewByTitle( "Problems" ) );
+        assertNotNull( bot.viewByTitle( "Search" ) );
+    }
+
+
+    /**
+     * Verify visible items in 'Show Views' dialog.
+     */
+    @Test
+    public void testVisibleItemsInOpenViewsDialog() throws Exception
+    {
+        ShowViewsBot showViews = studioBot.openShowViews();
+
+        assertTrue( showViews.existsView( "General", "Console" ) );
+        assertTrue( showViews.existsView( "General", "Console" ) );
+        assertTrue( showViews.existsView( "General", "Error Log" ) );
+        assertTrue( showViews.existsView( "General", "Outline" ) );
+        assertTrue( showViews.existsView( "General", "Progress" ) );
+        assertTrue( showViews.existsView( "Help", "Help" ) );
+        assertTrue( showViews.existsView( "LDAP Browser", "Connections" ) );
+        assertTrue( showViews.existsView( "LDAP Browser", "LDAP Browser" ) );
+        assertTrue( showViews.existsView( "LDAP Browser", "Modification Logs" ) );
+        assertTrue( showViews.existsView( "LDAP Browser", "Search Logs" ) );
+        assertTrue( showViews.existsView( "LDAP Servers", "LDAP Servers" ) );
+        assertTrue( showViews.existsView( "Schema Editor", "Hierarchy" ) );
+        assertTrue( showViews.existsView( "Schema Editor", "Problems" ) );
+        assertTrue( showViews.existsView( "Schema Editor", "Projects" ) );
+        assertTrue( showViews.existsView( "Schema Editor", "Schema" ) );
+        assertTrue( showViews.existsView( "Schema Editor", "Search" ) );
+
+        showViews.clickCancelButton();
+    }
+
+
+    /**
+     * Verify hidden items in 'Show Views' dialog. Many unwanted views are contributed 
+     * by org.eclipse.* plugins, we configured to hide them in rcp/plugin.xml. 
+     */
+    @Test
+    public void testHiddenItemsInOpenViewsDialog() throws Exception
+    {
+        ShowViewsBot showViews = studioBot.openShowViews();
+
+        assertFalse( showViews.existsView( "General", "Bookmarks" ) );
+        assertFalse( showViews.existsView( "General", "Problems" ) );
+        assertFalse( showViews.existsView( "General", "Navigator" ) );
+        assertFalse( showViews.existsView( "General", "Project Explorer" ) );
+        assertFalse( showViews.existsView( "General", "Properties" ) );
+
+        showViews.clickCancelButton();
+    }
+
+
+    /**
+     * Verify visible items in 'New' wizard.
+     */
+    @Test
+    public void testVisibleItemsInNewWizard() throws Exception
+    {
+        NewWizardBot newWizard = studioBot.openNewWizard();
+
+        assertTrue( newWizard.existsWizard( "ApacheDS", "ApacheDS 2.0 Configuration File"
) );
+
+        assertTrue( newWizard.existsWizard( "LDAP Browser", "LDAP Connection" ) );
+        assertTrue( newWizard.existsWizard( "LDAP Browser", "LDAP Entry" ) );
+        assertTrue( newWizard.existsWizard( "LDAP Browser", "LDAP Search" ) );
+        assertTrue( newWizard.existsWizard( "LDAP Browser", "LDAP Bookmark" ) );
+        assertTrue( newWizard.existsWizard( "LDAP Browser", "LDIF File" ) );
+
+        assertTrue( newWizard.existsWizard( "Schema Editor", "New Schema Project" ) );
+        assertTrue( newWizard.existsWizard( "Schema Editor", "New Schema" ) );
+        assertTrue( newWizard.existsWizard( "Schema Editor", "New Object Class" ) );
+        assertTrue( newWizard.existsWizard( "Schema Editor", "New Attribute Type" ) );
+
+        newWizard.clickCancelButton();
+    }
+
+
+    /**
+     * Verify hidden items in 'New' wizard. Many unwanted wizards are contributed 
+     * by org.eclipse.* plugins, we configured to hide them in rcp/plugin.xml. 
+     */
+    @Test
+    public void testHiddenItemsInNewWizard() throws Exception
+    {
+        NewWizardBot newWizard = studioBot.openNewWizard();
+
+        assertFalse( newWizard.existsWizard( "General", "File" ) );
+        assertFalse( newWizard.existsWizard( "General", "Folder" ) );
+        assertFalse( newWizard.existsWizard( "General", "Project" ) );
+
+        newWizard.clickCancelButton();
+    }
+
+
+    /**
+     * Verify visible items in 'Export' wizard.
+     */
+    @Test
+    public void testVisibleItemsInExportWizard() throws Exception
+    {
+        ExportWizardBot exportWizard = studioBot.openExportWizard();
+
+        assertTrue( exportWizard.existsWizard( "LDAP Browser", "LDAP to CSV" ) );
+        assertTrue( exportWizard.existsWizard( "LDAP Browser", "LDAP to DSML" ) );
+        assertTrue( exportWizard.existsWizard( "LDAP Browser", "LDAP to Excel" ) );
+        assertTrue( exportWizard.existsWizard( "LDAP Browser", "LDAP to LDIF" ) );
+        assertTrue( exportWizard.existsWizard( "LDAP Browser", "LDAP to ODF" ) );
+
+        assertTrue( exportWizard.existsWizard( "Schema Editor", "Schema Projects" ) );
+        assertTrue( exportWizard.existsWizard( "Schema Editor", "Schemas as OpenLDAP files"
) );
+        assertTrue( exportWizard.existsWizard( "Schema Editor", "Schemas as XML file(s)"
) );
+        assertTrue( exportWizard.existsWizard( "Schema Editor", "Schemas for ApacheDS" )
);
+
+        exportWizard.clickCancelButton();
+    }
+
+
+    /**
+     * Verify hidden items in 'Export' wizard. Many unwanted wizards are contributed 
+     * by org.eclipse.* plugins, we configured to hide them in rcp/plugin.xml. 
+     */
+    @Test
+    public void testHiddenItemsInExportWizard() throws Exception
+    {
+        ExportWizardBot exportWizard = studioBot.openExportWizard();
+
+        assertFalse( exportWizard.existsWizard( "General", "Archive File" ) );
+        assertFalse( exportWizard.existsWizard( "General", "Filesystem" ) );
+
+        assertFalse( exportWizard.existsCategory( "Install" ) );
+        assertFalse( exportWizard.existsCategory( "Team" ) );
+        assertFalse( exportWizard.existsCategory( "Java" ) );
+
+        exportWizard.clickCancelButton();
+    }
+
+
+    /**
+     * Verify visible items in 'Import' wizard.
+     */
+    @Test
+    public void testVisibleItemsInImportWizard() throws Exception
+    {
+        ImportWizardBot importWizard = studioBot.openImportWizard();
+
+        assertTrue( importWizard.existsWizard( "LDAP Browser", "DSML into LDAP" ) );
+        assertTrue( importWizard.existsWizard( "LDAP Browser", "LDIF into LDAP" ) );
+
+        assertTrue( importWizard.existsWizard( "Schema Editor", "Core schemas files" ) );
+        assertTrue( importWizard.existsWizard( "Schema Editor", "Schema Projects" ) );
+        assertTrue( importWizard.existsWizard( "Schema Editor", "Schemas from OpenLDAP files"
) );
+        assertTrue( importWizard.existsWizard( "Schema Editor", "Schemas from XML file(s)"
) );
+
+        importWizard.clickCancelButton();
+    }
+
+
+    /**
+     * Verify hidden items in 'Import' wizard. Many unwanted wizards are contributed 
+     * by org.eclipse.* plugins, we configured to hide them in rcp/plugin.xml. 
+     */
+    @Test
+    public void testHiddenItemsInImportWizard() throws Exception
+    {
+        ImportWizardBot importWizard = studioBot.openImportWizard();
+
+        assertFalse( importWizard.existsWizard( "General", "Archive File" ) );
+        assertFalse( importWizard.existsWizard( "General", "Filesystem" ) );
+
+        assertFalse( importWizard.existsCategory( "Install" ) );
+        assertFalse( importWizard.existsCategory( "Team" ) );
+        assertFalse( importWizard.existsCategory( "Java" ) );
+        assertFalse( importWizard.existsCategory( "Maven" ) );
+        assertFalse( importWizard.existsCategory( "Git" ) );
+        assertFalse( importWizard.existsCategory( "CSV" ) );
+
+        importWizard.clickCancelButton();
+    }
+
+
+    /**
+     * Verify visible preference pages.
+     */
+    @Test
+    public void testVisiblePreferencePages() throws Exception
+    {
+        PreferencesBot prefs = studioBot.openPreferences();
+        bot.sleep( 5000 );
+
+        assertTrue( prefs.pageExists( "Apache Directory Studio" ) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "Connections" ) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "Connections", "Certificate
Validation" ) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "Connections", "Passwords
Keystore" ) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "LDAP Browser" ) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "LDAP Browser", "Attributes"
) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "LDAP Browser", "Attributes",
"Binary Attributes" ) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "LDAP Browser", "Entry Editors"
) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "LDAP Browser", "Entry Editors",
"Table Entry Editor" ) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "LDAP Browser", "Search
Result Editor" ) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "LDAP Browser", "Text Formats"
) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "LDAP Browser", "Value Editors"
) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "LDAP Browser", "Views"
) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "LDAP Browser", "Views",
"Browser View" ) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "LDAP Browser", "Views",
"Modification Logs View" ) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "LDAP Browser", "Views",
"Search Logs View" ) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "LDIF Editor" ) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "LDIF Editor", "Content
Assist" ) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "LDIF Editor", "Syntax Coloring"
) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "LDIF Editor", "Templates"
) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "Schema Editor" ) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "Schema Editor", "Hierarchy
View" ) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "Schema Editor", "Schema
View" ) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "Schema Editor", "Search
View" ) );
+        assertTrue( prefs.pageExists( "Apache Directory Studio", "Shutdown" ) );
+
+        assertTrue( prefs.pageExists( "General", "Network Connections" ) );
+        assertTrue( prefs.pageExists( "Help" ) );
+        assertTrue( prefs.pageExists( "Install/Update" ) );
+
+        prefs.clickCancelButton();
+    }
+
+
+    /**
+     * Verify hidden preference pages. Many unwanted prefernce pages are contributed 
+     * by org.eclipse.* plugins, we configured to hide them in rcp/plugin.xml. 
+     */
+    @Test
+    public void testHiddenPreferencePages() throws Exception
+    {
+        PreferencesBot prefs = studioBot.openPreferences();
+
+        assertFalse( prefs.pageExists( "Team" ) );
+        assertFalse( prefs.pageExists( "Maven" ) );
+        assertFalse( prefs.pageExists( "Java" ) );
+
+        prefs.clickCancelButton();
+    }
+
+}

Modified: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ExportWizardBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ExportWizardBot.java?rev=1681830&r1=1681829&r2=1681830&view=diff
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ExportWizardBot.java
(original)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ExportWizardBot.java
Tue May 26 19:49:08 2015
@@ -34,9 +34,15 @@ public class ExportWizardBot extends Wiz
     private String title;
 
 
+    public ExportWizardBot()
+    {
+        this( "Export" );
+    }
+
+
     public ExportWizardBot( String title )
     {
-        super(title);
+        super( title );
         this.title = title;
     }
 

Modified: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ImportWizardBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ImportWizardBot.java?rev=1681830&r1=1681829&r2=1681830&view=diff
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ImportWizardBot.java
(original)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ImportWizardBot.java
Tue May 26 19:49:08 2015
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.studio.test.integration.ui.bots;
 
+
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
 import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
 
@@ -30,9 +31,15 @@ public class ImportWizardBot extends Wiz
     private String title;
 
 
+    public ImportWizardBot()
+    {
+        this( "Import" );
+    }
+
+
     public ImportWizardBot( String title )
     {
-        super(title);
+        super( title );
         this.title = title;
     }
 

Modified: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewWizardBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewWizardBot.java?rev=1681830&r1=1681829&r2=1681830&view=diff
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewWizardBot.java
(original)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewWizardBot.java
Tue May 26 19:49:08 2015
@@ -34,8 +34,14 @@ public class NewWizardBot extends Wizard
 
     public void selectLdifFile()
     {
+        select( "LDAP Browser", "LDIF File" );
+    }
+
+
+    public void select( String parent, String child )
+    {
         SWTBotTree tree = bot.tree();
-        tree.expandNode( "LDAP Browser" ).select( "LDIF File" );
+        tree.expandNode( parent ).select( child );
     }
 
 }

Modified: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/PreferencesBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/PreferencesBot.java?rev=1681830&r1=1681829&r2=1681830&view=diff
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/PreferencesBot.java
(original)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/PreferencesBot.java
Tue May 26 19:49:08 2015
@@ -19,6 +19,8 @@
  */
 package org.apache.directory.studio.test.integration.ui.bots;
 
+import org.apache.directory.studio.test.integration.ui.bots.utils.TreeBot;
+
 
 public class PreferencesBot extends DialogBot
 {
@@ -48,4 +50,11 @@ public class PreferencesBot extends Dial
         return new CertificateValidationPreferencePageBot();
     }
 
+
+    public boolean pageExists( String... path )
+    {
+        TreeBot treeBot = new TreeBot( bot.tree() );
+        return treeBot.exists( path );
+    }
+
 }

Added: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ShowViewsBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ShowViewsBot.java?rev=1681830&view=auto
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ShowViewsBot.java
(added)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ShowViewsBot.java
Tue May 26 19:49:08 2015
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.test.integration.ui.bots;
+
+
+import org.apache.directory.studio.test.integration.ui.bots.utils.TreeBot;
+
+
+public class ShowViewsBot extends DialogBot
+{
+
+    public void clickCancelButton()
+    {
+        super.clickButton( "Cancel" );
+    }
+
+
+    public boolean existsCategory( String category )
+    {
+        TreeBot treeBot = new TreeBot( bot.tree() );
+        return treeBot.exists( category );
+    }
+
+
+    public boolean existsView( String category, String view )
+    {
+        TreeBot treeBot = new TreeBot( bot.tree() );
+        return treeBot.exists( category, view );
+    }
+}

Modified: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java?rev=1681830&r1=1681829&r2=1681830&view=diff
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
(original)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
Tue May 26 19:49:08 2015
@@ -60,7 +60,7 @@ public class StudioBot
     {
         return new ModificationLogsViewBot();
     }
-    
+
 
     public ApacheDSServersViewBot getApacheDSServersViewBot()
     {
@@ -82,6 +82,18 @@ public class StudioBot
 
     public void resetLdapPerspective()
     {
+        resetPerspective( "org.apache.directory.studio.ldapbrowser.ui.perspective.BrowserPerspective"
);
+    }
+
+
+    public void resetSchemaPerspective()
+    {
+        resetPerspective( "org.apache.directory.studio.schemaeditor.perspective" );
+    }
+
+
+    private void resetPerspective( final String perspectiveId )
+    {
         UIThreadRunnable.syncExec( new VoidResult()
         {
             public void run()
@@ -112,8 +124,7 @@ public class StudioBot
                     }
 
                     // open LDAP perspective
-                    workbench.showPerspective(
-                        "org.apache.directory.studio.ldapbrowser.ui.perspective.BrowserPerspective",
window );
+                    workbench.showPerspective( perspectiveId, window );
 
                     // close "LDAP Browser view" as it sometimes does not respond, will be
re-opened by the following reset
                     for ( IViewReference viewref : page.getViewReferences() )
@@ -139,7 +150,6 @@ public class StudioBot
                 }
             }
         } );
-
     }
 
 
@@ -171,4 +181,25 @@ public class StudioBot
         }
         return new NewWizardBot();
     }
+
+
+    public ExportWizardBot openExportWizard()
+    {
+        new SWTBot().menu( "File" ).menu( "Export..." ).click();
+        return new ExportWizardBot();
+    }
+
+
+    public ImportWizardBot openImportWizard()
+    {
+        new SWTBot().menu( "File" ).menu( "Import..." ).click();
+        return new ImportWizardBot();
+    }
+
+
+    public ShowViewsBot openShowViews()
+    {
+        new SWTBot().menu( "Window" ).menu( "Show View" ).menu( "Other..." ).click();
+        return new ShowViewsBot();
+    }
 }

Modified: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/WizardBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/WizardBot.java?rev=1681830&r1=1681829&r2=1681830&view=diff
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/WizardBot.java
(original)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/WizardBot.java
Tue May 26 19:49:08 2015
@@ -20,6 +20,7 @@
 package org.apache.directory.studio.test.integration.ui.bots;
 
 
+import org.apache.directory.studio.test.integration.ui.bots.utils.TreeBot;
 import org.eclipse.swtbot.swt.finder.waits.Conditions;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
 
@@ -105,4 +106,18 @@ public abstract class WizardBot extends
         clickButton( "Cancel" );
     }
 
+
+    public boolean existsCategory( String category )
+    {
+        TreeBot treeBot = new TreeBot( bot.tree() );
+        return treeBot.exists( category );
+    }
+
+
+    public boolean existsWizard( String category, String wizard )
+    {
+        TreeBot treeBot = new TreeBot( bot.tree() );
+        return treeBot.exists( category, wizard );
+    }
+
 }

Added: directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/TreeBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/TreeBot.java?rev=1681830&view=auto
==============================================================================
--- directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/TreeBot.java
(added)
+++ directory/studio/trunk/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/TreeBot.java
Tue May 26 19:49:08 2015
@@ -0,0 +1,73 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.test.integration.ui.bots.utils;
+
+
+import java.util.Arrays;
+import java.util.LinkedList;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+
+
+public class TreeBot
+{
+    private SWTBotTree tree;
+
+
+    public TreeBot( SWTBotTree tree )
+    {
+        this.tree = tree;
+    }
+
+
+    public boolean exists( String... nodes )
+    {
+        SWTBotTreeItem[] items = tree.getAllItems();
+        return exists( items, new LinkedList<String>( Arrays.asList( nodes ) ) );
+    }
+
+
+    private boolean exists( SWTBotTreeItem[] items, LinkedList<String> nodes )
+    {
+        for ( SWTBotTreeItem item : items )
+        {
+            if ( item.getText().equals( nodes.getFirst() ) )
+            {
+                if ( nodes.size() == 1 )
+                {
+                    return true;
+                }
+                else
+                {
+                    if ( !item.isExpanded() )
+                    {
+                        item.expand();
+                    }
+                    nodes.removeFirst();
+                    SWTBotTreeItem[] children = item.getItems();
+                    return exists( children, nodes );
+                }
+            }
+        }
+
+        return false;
+    }
+}



Mime
View raw message