Welcome to mirror list, hosted at ThFree Co, Russian Federation.

RcpAppTest.java « ui « integration « test « studio « directory « apache « org « java « main « src « test.integration.ui « tests - github.com/apache/directory-studio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b856742aea7a678ce8b3b1aaf7f8f2c977721dda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
/*
 *  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.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

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.junit.jupiter.api.Test;


/**
 * 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$
 */
public class RcpAppTest extends AbstractTestBase
{
    /**
     * 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();

        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", "Appearance" ) );
        assertTrue( prefs.pageExists( "General", "Appearance", "Text Editors" ) );
        assertTrue( prefs.pageExists( "General", "Appearance", "Colors and Fonts" ) );
        assertTrue( prefs.pageExists( "Help" ) );
        assertTrue( prefs.pageExists( "Install/Update" ) );

        prefs.clickCancelButton();
    }


    /**
     * Verify hidden preference pages. Many unwanted preference pages are contributed 
     * by org.eclipse.* plugins, we configured to hide them in rcp/plugin.xml.
     * 
     * Note: This test fails when running from Eclipse IDE and all workspace plugins 
     * are part of the target platform.
     */
    @Test
    public void testHiddenPreferencePages() throws Exception
    {
        PreferencesBot prefs = studioBot.openPreferences();

        assertFalse( prefs.pageExists( "Team" ) );
        assertFalse( prefs.pageExists( "Maven" ) );
        assertFalse( prefs.pageExists( "Java" ) );
        assertFalse( prefs.pageExists( "General", "Quick Search" ) );
        assertFalse( prefs.pageExists( "General", "Network Connections" ) );

        prefs.clickCancelButton();
    }

}