Skip to content
Snippets Groups Projects
Commit 01383d2b authored by Vincent Massol's avatar Vincent Massol
Browse files

[Misc] Move some admin tests to docker-based tests

parent 88ab51ec
No related merge requests found
......@@ -41,4 +41,12 @@
<module>xwiki-platform-administration-test-pageobjects</module>
<module>xwiki-platform-administration-test-tests</module>
</modules>
<profiles>
<profile>
<id>docker</id>
<modules>
<module>xwiki-platform-administration-test-docker</module>
</modules>
</profile>
</profiles>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-administration-test</artifactId>
<version>11.2-SNAPSHOT</version>
</parent>
<artifactId>xwiki-platform-administration-test-docker</artifactId>
<name>XWiki Platform - Administration - Tests - Functional Docker Tests</name>
<!-- TODO: Move to use "functional-test" in the future when http://jira.codehaus.org/browse/MNG-1911 is fixed,
see https://jira.xwiki.org/browse/XWIKI-7683 -->
<packaging>jar</packaging>
<description>XWiki Platform - Administration - Tests - Functional Tests in Docker</description>
<properties>
<!-- Functional tests are allowed to output content to the console -->
<xwiki.surefire.captureconsole.skip>true</xwiki.surefire.captureconsole.skip>
<!-- START: Required to fix conflicts resolution between XWiki & TestContainers -->
<!-- selenium-server requires Guava 25.0-jre+ but XWiki uses Guava 20.0, see xwiki-commons top level POM for more
details as to why we cannot use a more recent version. Thus we need to force a more recent version of Guava
here. Note that the version needs to be checked when we change the version of selenium-java -->
<guava.version>25.0-jre</guava.version>
<!-- END: Required to fix conflicts resolution between XWiki & TestContainers -->
</properties>
<dependencies>
<!-- ================================
Dependencies for tested features
================================ -->
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-administration-ui</artifactId>
<version>${project.version}</version>
<type>xar</type>
</dependency>
<!-- We have to bundle an implementation for the refactoring API because some tests need to delete pages. -->
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-refactoring-default</artifactId>
<version>${project.version}</version>
</dependency>
<!-- ================================
Test only dependencies
================================ -->
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-test-docker</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-administration-test-pageobjects</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<!-- We currently need to depend on mail-ui in the test because it contains the Mail.SendMailConfigClass. We can
not have administration-ui depend on mail-ui, because mail-ui already depends on administration-ui which would
create a loop. mail-ui ust needs the configurable class stuff from administration-ui, so when that gets
refactored out, we can fix the dependency directly in administration-ui and not have anything here specific to
mail. -->
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-mail-ui</artifactId>
<version>${project.version}</version>
<type>xar</type>
</dependency>
<dependency>
<groupId>com.icegreen</groupId>
<artifactId>greenmail</artifactId>
<version>1.5.8</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<testSourceDirectory>src/test/it</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<includes>
<include>**/AllIT.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>clover</id>
<!-- Add the Clover JAR to the WAR so that it's available at runtime when XWiki executes.
It's needed because instrumented jars in the WAR will call Clover APIs at runtime when they execute. -->
<dependencies>
<dependency>
<groupId>org.openclover</groupId>
<artifactId>clover</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemProperties combine.children="append">
<!-- Tell the Docker-based test to activate the Clover profile so that the Clover JAR is added to
WEB-INF/lib -->
<property>
<name>xwiki.test.ui.profiles</name>
<value>clover</value>
</property>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
......@@ -22,14 +22,14 @@
import java.util.Arrays;
import java.util.function.Consumer;
import org.junit.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.xwiki.administration.test.po.AdministrablePage;
import org.xwiki.administration.test.po.AdministrationPage;
import org.xwiki.test.ui.AbstractTest;
import org.xwiki.test.ui.SuperAdminAuthenticationRule;
import org.xwiki.test.docker.junit5.UITest;
import org.xwiki.test.ui.TestUtils;
import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Verify the overall Administration application features.
......@@ -37,11 +37,9 @@
* @version $Id$
* @since 4.3M1
*/
public class AdministrationIT extends AbstractTest
@UITest
public class AdministrationIT
{
@Rule
public SuperAdminAuthenticationRule authenticationRule = new SuperAdminAuthenticationRule(getUtil());
/**
* This method makes the following tests :
*
......@@ -51,10 +49,12 @@ public class AdministrationIT extends AbstractTest
* </ul>
*/
@Test
public void verifyGlobalAndSpaceSections()
public void verifyGlobalAndSpaceSections(TestUtils setup)
{
setup.loginAsSuperAdmin();
// Navigate to a (non existent for test performance reasons) page in view mode.
getUtil().gotoPage("NonExistentSpace", "NonExistentPage");
setup.gotoPage("NonExistentSpace", "NonExistentPage");
// Verify that pages have an Admin menu and navigate to the admin UI.
AdministrablePage page = new AdministrablePage();
......@@ -67,14 +67,14 @@ public void verifyGlobalAndSpaceSections()
Arrays.asList("Users", "Groups", "Rights", "Registration", "Themes", "Presentation", "Templates",
"Localization", "Import", "Export", "Editing", "emailSend", "emailStatus", "emailGeneral", "analytics")
.stream().forEach(new Consumer<String>()
{
@Override
public void accept(String sectionId)
{
@Override
public void accept(String sectionId)
{
assertTrue(String.format("Menu section [%s] is missing.", sectionId),
administrationPage.hasSection(sectionId));
}
});
assertTrue(administrationPage.hasSection(sectionId),
String.format("Menu section [%s] is missing.", sectionId));
}
});
// These are page-only sections.
assertTrue(administrationPage.hasNotSection("PageAndChildrenRights"));
......@@ -93,15 +93,15 @@ public void accept(String sectionId)
// All these sections should not be present (they provide global configuration).
Arrays.asList("Users", "Groups", "Rights", "Registration", "Templates", "Localization", "Import", "Export",
"Editing", "emailSend", "emailStatus", "emailGeneral", "analytics")
"Editing", "emailSend", "emailStatus", "emailGeneral", "analytics")
.stream().forEach(new Consumer<String>()
{
@Override
public void accept(String sectionId)
{
@Override
public void accept(String sectionId)
{
assertTrue(String.format("Menu section [%s] shouldn't be present.", sectionId),
administrationPage.hasNotSection(sectionId));
}
});
assertTrue(administrationPage.hasNotSection(sectionId),
String.format("Menu section [%s] shouldn't be present.", sectionId));
}
});
}
}
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.xwiki.administration.test.ui;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.xwiki.test.docker.junit5.UITest;
/**
* All UI tests for the Administration feature.
*
* @version $Id$
* @since 11.2RC1
*/
@UITest
public class AllIT
{
@Nested
@DisplayName("Overall Administration")
class NestedAdministrationIT extends AdministrationIT
{
}
}
......@@ -28,9 +28,9 @@
<version>11.2-SNAPSHOT</version>
</parent>
<artifactId>xwiki-platform-administration-test-pageobjects</artifactId>
<name>XWiki Platform - Administration - Page Objects</name>
<name>XWiki Platform - Administration - Tests - Page Objects</name>
<packaging>jar</packaging>
<description>XWiki Platform - Administration - Page Objects</description>
<description>XWiki Platform - Administration - Tests - Page Objects</description>
<properties>
<!-- None of the classes is valid -->
<xwiki.checkstyle.skip>true</xwiki.checkstyle.skip>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment