1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.administration.test.ui

File AdministrationTest.java

 

Code metrics

0
32
1
1
99
48
1
0.03
32
1
1

Classes

Class Line # Actions
AdministrationTest 35 32 0% 1 0
1.0100%
 

Contributing tests

This file is covered by 1 test. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.administration.test.ui;
21   
22    import org.junit.*;
23    import org.openqa.selenium.By;
24    import org.xwiki.administration.test.po.AdministrablePage;
25    import org.xwiki.administration.test.po.AdministrationPage;
26    import org.xwiki.test.ui.AbstractTest;
27    import org.xwiki.test.ui.SuperAdminAuthenticationRule;
28   
29    /**
30    * Verify the overall Administration application features.
31    *
32    * @version $Id: 7964bac2981d5966b3780d4e154fe65079cab58b $
33    * @since 4.3M1
34    */
 
35    public class AdministrationTest extends AbstractTest
36    {
37    @Rule
38    public SuperAdminAuthenticationRule authenticationRule = new SuperAdminAuthenticationRule(getUtil());
39   
40    /**
41    * This method makes the following tests :
42    *
43    * <ul>
44    * <li>Login as global admin.</li>
45    * <li>Validate presence of default sections for global and space sections.</li>
46    * <li>Validate presence of application administration sections at global level only.</li>
47    * </ul>
48    */
 
49  1 toggle @Test
50    public void verifyGlobalAndSpaceSections()
51    {
52    // Navigate to a (non existent for test performance reasons) page in view mode.
53  1 getUtil().gotoPage("NonExistentSpace", "NonExistentPage");
54   
55    // Verify that pages have an Admin menu and navigate to the admin UI.
56  1 AdministrablePage page = new AdministrablePage();
57  1 AdministrationPage administrationPage = page.clickAdministerWiki();
58   
59    // TODO: Move these tests in their own modules, i.e. the modules that brought the Admin UI extension
60  1 Assert.assertTrue(administrationPage.hasSection("Editing"));
61  1 Assert.assertTrue(administrationPage.hasSection("Localization"));
62  1 Assert.assertTrue(administrationPage.hasSection("Presentation"));
63  1 Assert.assertTrue(administrationPage.hasSection("Elements"));
64  1 Assert.assertTrue(administrationPage.hasSection("Registration"));
65  1 Assert.assertTrue(administrationPage.hasSection("Users"));
66  1 Assert.assertTrue(administrationPage.hasSection("Groups"));
67  1 Assert.assertTrue(administrationPage.hasSection("Rights"));
68  1 Assert.assertTrue(administrationPage.hasSection("Registration"));
69  1 Assert.assertTrue(administrationPage.hasSection("Import"));
70  1 Assert.assertTrue(administrationPage.hasSection("Export"));
71  1 Assert.assertTrue(administrationPage.hasSection("Templates"));
72   
73    // Select XWiki space administration.
74  1 AdministrationPage spaceAdministrationPage = administrationPage.selectSpaceToAdminister("XWiki");
75   
76    // Since clicking on "XWiki" in the Select box will reload the page asynchronously we need to wait for the new
77    // page to be available. For this we wait for the heading to be changed to "Administration:XWiki".
78  1 getDriver().waitUntilElementIsVisible(By.id("HAdministration:XWiki"));
79    // Also wait till the page is fully loaded to be extra sure...
80  1 spaceAdministrationPage.waitUntilPageIsLoaded();
81   
82  1 Assert.assertTrue(spaceAdministrationPage.hasSection("Presentation"));
83  1 Assert.assertTrue(spaceAdministrationPage.hasSection("Elements"));
84  1 Assert.assertTrue(spaceAdministrationPage.hasSection("PageAndChildrenRights"));
85  1 Assert.assertTrue(spaceAdministrationPage.hasSection("PageRights"));
86   
87    // All those sections should not be present
88  1 Assert.assertTrue(spaceAdministrationPage.hasNotSection("Editing"));
89  1 Assert.assertTrue(spaceAdministrationPage.hasNotSection("Localization"));
90  1 Assert.assertTrue(spaceAdministrationPage.hasNotSection("Registration"));
91  1 Assert.assertTrue(spaceAdministrationPage.hasNotSection("Users"));
92  1 Assert.assertTrue(spaceAdministrationPage.hasNotSection("Groups"));
93  1 Assert.assertTrue(spaceAdministrationPage.hasNotSection("Rights"));
94  1 Assert.assertTrue(spaceAdministrationPage.hasNotSection("Registration"));
95  1 Assert.assertTrue(spaceAdministrationPage.hasNotSection("Import"));
96  1 Assert.assertTrue(spaceAdministrationPage.hasNotSection("Export"));
97  1 Assert.assertTrue(spaceAdministrationPage.hasNotSection("Templates"));
98    }
99    }