Skip to content
Snippets Groups Projects
Commit 9c9b2474 authored by Manuel Leduc's avatar Manuel Leduc
Browse files

[Misc] Migrate remaining annotation functional tests to docker

parent d3848a1c
No related branches found
No related tags found
No related merge requests found
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
</properties> </properties>
<modules> <modules>
<module>xwiki-platform-annotation-test-pageobjects</module> <module>xwiki-platform-annotation-test-pageobjects</module>
<module>xwiki-platform-annotation-test-tests</module>
</modules> </modules>
<profiles> <profiles>
<profile> <profile>
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
import java.util.Locale; import java.util.Locale;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.xwiki.annotation.test.po.AnnotatableViewPage; import org.xwiki.annotation.test.po.AnnotatableViewPage;
import org.xwiki.model.reference.LocalDocumentReference; import org.xwiki.model.reference.LocalDocumentReference;
...@@ -29,26 +29,58 @@ ...@@ -29,26 +29,58 @@
import org.xwiki.test.docker.junit5.UITest; import org.xwiki.test.docker.junit5.UITest;
import org.xwiki.test.integration.junit.LogCaptureConfiguration; import org.xwiki.test.integration.junit.LogCaptureConfiguration;
import org.xwiki.test.ui.TestUtils; import org.xwiki.test.ui.TestUtils;
import org.xwiki.test.ui.po.CommentsTab;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
/** /**
* @version $Id$ * @version $Id$
* @since 11.3RC1 * @since 11.3RC1
*/ */
@UITest @UITest
public class AnnotationsIT class AnnotationsIT
{ {
@BeforeAll private static final String CONTENT = "It's an easy-to-edit website that will help you work better together. "
public void setup(TestUtils setup) + "This Wiki is made of pages sorted by spaces. You're currently in the Main space, looking at its home page "
+ "(WebHome).";
private static final String ANNOTATED_TEXT_1 = "work better together";
private static final String ANNOTATION_TEXT_1 = "XWiki motto";
private static final String ANNOTATED_TEXT_2 = "WebHome";
private static final String ANNOTATION_TEXT_2 = "Every Space has it's own webhome";
private static final String ANNOTATED_TEXT_3 = "Main space";
private static final String ANNOTATION_TEXT_3 = "Each XWiki instance has a Main space";
private static final String ANNOTATED_TEXT_4 = "easy-to-edit website";
private static final String ANNOTATION_TEXT_4 = "Yes, we have our WYSIWYG";
private static final String USER_NAME = "UserAnnotation";
private static final String USER_PASS = "pass";
@BeforeEach
void setUp(TestUtils setup, TestReference testReference)
{ {
setup.loginAsSuperAdmin(); setup.loginAsSuperAdmin();
setup.deletePage(testReference);
setup.createUser(USER_NAME, USER_PASS, "", "");
setup.login(USER_NAME, USER_PASS);
} }
@Test @Test
public void addAnnotationTranslation(TestUtils setup, TestReference testReference, void addAnnotationTranslation(TestUtils setup, TestReference testReference,
LogCaptureConfiguration logCaptureConfiguration) throws Exception LogCaptureConfiguration logCaptureConfiguration) throws Exception
{ {
setup.loginAsSuperAdmin();
setup.setWikiPreference("multilingual", "true"); setup.setWikiPreference("multilingual", "true");
setup.setWikiPreference("languages", "en,fr"); setup.setWikiPreference("languages", "en,fr");
...@@ -81,4 +113,59 @@ public void addAnnotationTranslation(TestUtils setup, TestReference testReferenc ...@@ -81,4 +113,59 @@ public void addAnnotationTranslation(TestUtils setup, TestReference testReferenc
"Failed to read resource [iscroll/" "Failed to read resource [iscroll/"
); );
} }
@Test
void addAndDeleteAnnotations(TestUtils setup, TestReference testReference)
{
AnnotatableViewPage annotatableViewPage =
new AnnotatableViewPage(setup.createPage(testReference, CONTENT, null));
CommentsTab commentsTab = annotatableViewPage.getWrappedViewPage().openCommentsDocExtraPane();
annotatableViewPage.addAnnotation(ANNOTATED_TEXT_1, ANNOTATION_TEXT_1);
annotatableViewPage.addAnnotation(ANNOTATED_TEXT_2, ANNOTATION_TEXT_2);
annotatableViewPage.addAnnotation(ANNOTATED_TEXT_3, ANNOTATION_TEXT_3);
annotatableViewPage.addAnnotation(ANNOTATED_TEXT_4, ANNOTATION_TEXT_4);
int commentId = annotatableViewPage.getCommentId(annotatableViewPage.getAnnotationIdByText(ANNOTATED_TEXT_1));
assertTrue(commentsTab.hasEditButtonForCommentByID(commentId));
assertTrue(commentsTab.hasDeleteButtonForCommentByID(commentId));
assertEquals(ANNOTATION_TEXT_1, annotatableViewPage.getAnnotationContentByText(ANNOTATED_TEXT_1));
commentId = annotatableViewPage.getCommentId(annotatableViewPage.getAnnotationIdByText(ANNOTATED_TEXT_2));
assertTrue(commentsTab.hasEditButtonForCommentByID(commentId));
assertTrue(commentsTab.hasDeleteButtonForCommentByID(commentId));
assertEquals(ANNOTATION_TEXT_2, annotatableViewPage.getAnnotationContentByText(ANNOTATED_TEXT_2));
commentId = annotatableViewPage.getCommentId(annotatableViewPage.getAnnotationIdByText(ANNOTATED_TEXT_3));
assertTrue(commentsTab.hasEditButtonForCommentByID(commentId));
assertTrue(commentsTab.hasDeleteButtonForCommentByID(commentId));
assertEquals(ANNOTATION_TEXT_3, annotatableViewPage.getAnnotationContentByText(ANNOTATED_TEXT_3));
commentId = annotatableViewPage.getCommentId(annotatableViewPage.getAnnotationIdByText(ANNOTATED_TEXT_4));
assertTrue(commentsTab.hasEditButtonForCommentByID(commentId));
assertTrue(commentsTab.hasDeleteButtonForCommentByID(commentId));
assertEquals(ANNOTATION_TEXT_4, annotatableViewPage.getAnnotationContentByText(ANNOTATED_TEXT_4));
// It seems that there are some issues refreshing content while this tab is not open. This might be a bug in the
// Annotations Application
annotatableViewPage.showAnnotationsPane();
annotatableViewPage.deleteAnnotationByText(ANNOTATED_TEXT_1);
annotatableViewPage.deleteAnnotationByText(ANNOTATED_TEXT_2);
annotatableViewPage.deleteAnnotationByText(ANNOTATED_TEXT_3);
annotatableViewPage.deleteAnnotationByText(ANNOTATED_TEXT_4);
}
/**
* This test creates a XWiki 1.0 syntax page, and tries to add annotations to it, and checks if the warning messages
* are shown This test is against XAANNOTATIONS-17
*/
@Test
void annotationsShouldNotBeShownInXWiki10Syntax(TestUtils setup, TestReference testReference)
{
AnnotatableViewPage annotatableViewPage = new AnnotatableViewPage(
setup.createPage(testReference, "Some content", "AnnotationsTest in XWiki 1.0 Syntax", "xwiki/1.0"));
annotatableViewPage.showAnnotationsPane();
// Annotations are disabled in 1.0 Pages. This element should no be here
assertTrue(annotatableViewPage.checkIfAnnotationsAreDisabled());
annotatableViewPage.simulateCTRL_M();
annotatableViewPage.waitforAnnotationWarningNotification();
}
} }
<?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-annotation-test</artifactId>
<version>15.5-SNAPSHOT</version>
</parent>
<artifactId>xwiki-platform-annotation-test-tests</artifactId>
<name>XWiki Platform - Annotations - Tests - Functional 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 - Annotations - Functional Tests</description>
<properties>
<xwikiCfgSuperadminPassword>pass</xwikiCfgSuperadminPassword>
<!-- Functional tests are allowed to output content to the console -->
<xwiki.surefire.captureconsole.skip>true</xwiki.surefire.captureconsole.skip>
</properties>
<dependencies>
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-annotation-ui</artifactId>
<version>${project.version}</version>
<type>xar</type>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-test-ui</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-annotation-test-pageobjects</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<!-- Make sure we have the Logback SLF4J binding for client side logging for our tests and make sure other logging
systems go through SLF4J -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<testSourceDirectory>src/test/it</testSourceDirectory>
<plugins>
<!-- TODO: Remove when the http://jira.codehaus.org/browse/MNG-1911 is fixed, see also
https://jira.xwiki.org/browse/XWIKI-7683 -->
<plugin>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-tool-packager-plugin</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<phase>generate-test-resources</phase>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</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>
<!-- Add the Clover JAR to the Packager plugin runtime classpath since the Packager plugin uses java classes
that have been instrumented with Clover (XWiki oldcore for example) -->
<plugin>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-tool-packager-plugin</artifactId>
<version>${project.version}</version>
<dependencies>
<dependency>
<groupId>org.openclover</groupId>
<artifactId>clover</artifactId>
<version>${clover.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
/*
* 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.annotation.test.ui;
import org.junit.Before;
import org.junit.Test;
import org.xwiki.annotation.test.po.AnnotatableViewPage;
import org.xwiki.test.ui.AbstractTest;
import org.xwiki.test.ui.browser.IgnoreBrowser;
import org.xwiki.test.ui.browser.IgnoreBrowsers;
import org.xwiki.test.ui.po.CommentsTab;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* Annotation Test.
*
* @version $Id$
* @since 2.7RC1
*/
public class AnnotationsTest extends AbstractTest
{
private static final String CONTENT = "It's an easy-to-edit website that will help you work better together. "
+ "This Wiki is made of pages sorted by spaces. You're currently in the Main space, looking at its home page "
+ "(WebHome).";
private static final String ANNOTATED_TEXT_1 = "work better together";
private static final String ANNOTATION_TEXT_1 = "XWiki motto";
private static final String ANNOTATED_TEXT_2 = "WebHome";
private static final String ANNOTATION_TEXT_2 = "Every Space has it's own webhome";
private static final String ANNOTATED_TEXT_3 = "Main space";
private static final String ANNOTATION_TEXT_3 = "Each XWiki instance has a Main space";
private static final String ANNOTATED_TEXT_4 = "easy-to-edit website";
private static final String ANNOTATION_TEXT_4 = "Yes, we have our WYSIWYG";
private static final String USER_NAME = "UserAnnotation";
private static final String USER_PASS = "pass";
@Before
public void setUp()
{
getUtil().loginAsSuperAdmin();
getUtil().deletePage(getTestClassName(), getTestMethodName());
getUtil().createUser(USER_NAME, USER_PASS, "", "");
getUtil().login(USER_NAME, USER_PASS);
}
@Test
@IgnoreBrowsers({
@IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"),
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177")
})
public void addAndDeleteAnnotations()
{
AnnotatableViewPage annotatableViewPage = new AnnotatableViewPage(
getUtil().createPage(getTestClassName(), getTestMethodName(), CONTENT, null));
CommentsTab commentsTab = annotatableViewPage.getWrappedViewPage().openCommentsDocExtraPane();
annotatableViewPage.addAnnotation(ANNOTATED_TEXT_1, ANNOTATION_TEXT_1);
annotatableViewPage.addAnnotation(ANNOTATED_TEXT_2, ANNOTATION_TEXT_2);
annotatableViewPage.addAnnotation(ANNOTATED_TEXT_3, ANNOTATION_TEXT_3);
annotatableViewPage.addAnnotation(ANNOTATED_TEXT_4, ANNOTATION_TEXT_4);
int commentId = annotatableViewPage.getCommentId(annotatableViewPage.getAnnotationIdByText(ANNOTATED_TEXT_1));
assertTrue(commentsTab.hasEditButtonForCommentByID(commentId));
assertTrue(commentsTab.hasDeleteButtonForCommentByID(commentId));
assertEquals(ANNOTATION_TEXT_1, annotatableViewPage.getAnnotationContentByText(ANNOTATED_TEXT_1));
commentId = annotatableViewPage.getCommentId(annotatableViewPage.getAnnotationIdByText(ANNOTATED_TEXT_2));
assertTrue(commentsTab.hasEditButtonForCommentByID(commentId));
assertTrue(commentsTab.hasDeleteButtonForCommentByID(commentId));
assertEquals(ANNOTATION_TEXT_2, annotatableViewPage.getAnnotationContentByText(ANNOTATED_TEXT_2));
commentId = annotatableViewPage.getCommentId(annotatableViewPage.getAnnotationIdByText(ANNOTATED_TEXT_3));
assertTrue(commentsTab.hasEditButtonForCommentByID(commentId));
assertTrue(commentsTab.hasDeleteButtonForCommentByID(commentId));
assertEquals(ANNOTATION_TEXT_3, annotatableViewPage.getAnnotationContentByText(ANNOTATED_TEXT_3));
commentId = annotatableViewPage.getCommentId(annotatableViewPage.getAnnotationIdByText(ANNOTATED_TEXT_4));
assertTrue(commentsTab.hasEditButtonForCommentByID(commentId));
assertTrue(commentsTab.hasDeleteButtonForCommentByID(commentId));
assertEquals(ANNOTATION_TEXT_4, annotatableViewPage.getAnnotationContentByText(ANNOTATED_TEXT_4));
// It seems that there are some issues refreshing content while this tab is not open. This might be a bug in the
// Annotations Application
annotatableViewPage.showAnnotationsPane();
annotatableViewPage.deleteAnnotationByText(ANNOTATED_TEXT_1);
annotatableViewPage.deleteAnnotationByText(ANNOTATED_TEXT_2);
annotatableViewPage.deleteAnnotationByText(ANNOTATED_TEXT_3);
annotatableViewPage.deleteAnnotationByText(ANNOTATED_TEXT_4);
}
/**
* This test creates a XWiki 1.0 syntax page, and tries to add annotations to it, and checks if the warning messages
* are shown This test is against XAANNOTATIONS-17
*/
@Test
@IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177")
public void annotationsShouldNotBeShownInXWiki10Syntax()
{
AnnotatableViewPage annotatableViewPage = new AnnotatableViewPage(
getUtil().createPage(getTestClassName(), getTestMethodName(), "Some content",
"AnnotationsTest in XWiki 1.0 Syntax", "xwiki/1.0"));
annotatableViewPage.showAnnotationsPane();
// Annotations are disabled in 1.0 Pages. This element should no be here
assertTrue(annotatableViewPage.checkIfAnnotationsAreDisabled());
annotatableViewPage.simulateCTRL_M();
annotatableViewPage.waitforAnnotationWarningNotification();
}
}
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