-
-
Notifications
You must be signed in to change notification settings - Fork 554
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7ce05d
commit 1cf6ee4
Showing
3 changed files
with
222 additions
and
0 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
...atform-index-test-docker/src/test/it/org/xwiki/index/test/ui/docker/DocumentsMacroIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* 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.index.test.ui.docker; | ||
|
||
import org.junit.jupiter.api.Order; | ||
import org.junit.jupiter.api.Test; | ||
import org.xwiki.index.test.po.DocumentsMacroPage; | ||
import org.xwiki.livedata.test.po.TableLayoutElement; | ||
import org.xwiki.model.reference.DocumentReference; | ||
import org.xwiki.model.reference.SpaceReference; | ||
import org.xwiki.test.docker.junit5.TestReference; | ||
import org.xwiki.test.docker.junit5.UITest; | ||
import org.xwiki.test.ui.TestUtils; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
/** | ||
* Tests for the DocumentsMacro page. | ||
* | ||
* @version $Id$ | ||
* @since 4.2M3 | ||
*/ | ||
@UITest | ||
class DocumentsMacroIT | ||
{ | ||
/** | ||
* Verify that the {@code {{documents/}}} macro works by going to the page defining this wiki macro since it | ||
* contains an example usage and we can verify it displays the expected result. | ||
*/ | ||
@Test | ||
@Order(1) | ||
void documentsMacro(TestUtils setup, TestReference testReference) | ||
{ | ||
// Create a dummy page in the Main space and having Main.WebHome as its parent so that it appears in the | ||
// Documents Macro livetable (since the example lists pages in the Main space having Main.WebHome as their | ||
// parent). | ||
String testMethodName = testReference.getLastSpaceReference().getName(); | ||
DocumentReference documentReference = new DocumentReference(testMethodName, | ||
new SpaceReference("Main", testReference.getWikiReference())); | ||
setup.createPage(documentReference, "", "Test Title", "xwiki/2.1", "Main.WebHome"); | ||
|
||
DocumentsMacroPage dmp = DocumentsMacroPage.gotoPage(); | ||
TableLayoutElement tableLayout = dmp.getDocumentsExampleLiveTable().getTableLayout(); | ||
|
||
// Verify that we have a Page column | ||
assertTrue(tableLayout.hasColumn("Title"), "No Title column found"); | ||
|
||
// Verify there are several rows displayed | ||
assertTrue(tableLayout.countRows() > 0); | ||
|
||
// Verify that page titles are displayed by filtering on one page for which we know the title | ||
tableLayout.filterColumn("Location", testMethodName); | ||
tableLayout.assertRow("Title", "Test Title"); | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
...xwiki-platform-index-test-docker/src/test/it/org/xwiki/index/test/ui/docker/SpacesIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
* 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.index.test.ui.docker; | ||
|
||
import org.junit.jupiter.api.Order; | ||
import org.junit.jupiter.api.Test; | ||
import org.xwiki.index.test.po.SpaceIndexPage; | ||
import org.xwiki.index.test.po.SpacesMacroPage; | ||
import org.xwiki.livedata.test.po.LiveDataElement; | ||
import org.xwiki.test.docker.junit5.TestReference; | ||
import org.xwiki.test.docker.junit5.UITest; | ||
import org.xwiki.test.ui.TestUtils; | ||
import org.xwiki.test.ui.po.ViewPage; | ||
import org.xwiki.test.ui.po.editor.WikiEditPage; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
/** | ||
* Tests the Spaces Macro. | ||
* | ||
* @version $Id$ | ||
* @since 7.0RC1 | ||
*/ | ||
@UITest | ||
class SpacesIT | ||
{ | ||
@Test | ||
@Order(1) | ||
void spacesMacro(TestUtils setup, TestReference testReference) | ||
{ | ||
// Create a page with special characters in space name | ||
// See XE-1228: Broken links displayed in the Spaces widget if a space name contains a colon | ||
// See XE-1298: Spaces macro doesn't list spaces that contain a colon in their name | ||
String spaceName = setup.serializeReference(testReference.getLastSpaceReference()) + "&"; | ||
String referenceEscapedSpaceName = spaceName.replaceAll("\\.", "\\\\.").replaceAll(":", "\\\\:"); | ||
// Make sure the new space's WebHome page doesn't exist. | ||
setup.deletePage(spaceName, "WebHome"); | ||
|
||
// Create the new space using the UI and verify it leads to the space home page being edited. | ||
SpacesMacroPage macroPage = SpacesMacroPage.gotoPage(); | ||
macroPage.getSpacesMacroPane().createSpace(spaceName).clickCreate(); | ||
WikiEditPage editPage = new WikiEditPage(); | ||
|
||
// Verify that space creation uses the space name as the space home page's title | ||
assertEquals(spaceName, editPage.getDocumentTitle()); | ||
|
||
// Verify that the space created is correct by looking at the generated metadata in the HTML header | ||
// (they contain the space reference amongst other data). | ||
// Note: the value will be escaped since it is the space reference, not the space name. | ||
assertEquals(referenceEscapedSpaceName, editPage.getMetaDataValue("space")); | ||
|
||
// Go back to the Spaces Macro page and verify that the link to space index works | ||
// First, save the space's home page | ||
editPage.clickSaveAndContinue(); | ||
|
||
macroPage = SpacesMacroPage.gotoPage(); | ||
macroPage.getSpacesMacroPane().clickSpaceIndex(referenceEscapedSpaceName); | ||
|
||
// Assert the content of the space index live table. | ||
LiveDataElement spaceIndexLiveTable = new SpaceIndexPage().getLiveData(); | ||
assertEquals(1, spaceIndexLiveTable.getTableLayout().countRows()); | ||
spaceIndexLiveTable.getTableLayout().assertRow("Page", "WebHome"); | ||
spaceIndexLiveTable.getTableLayout().assertRow("Space", referenceEscapedSpaceName); | ||
|
||
// Go back to the Spaces Macro page and this time verify that the link to the space home page works | ||
macroPage = SpacesMacroPage.gotoPage(); | ||
ViewPage spaceHomePage = macroPage.getSpacesMacroPane().clickSpaceHome(referenceEscapedSpaceName); | ||
assertEquals(spaceName, spaceHomePage.getDocumentTitle()); | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...latform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/AllDocsLiveData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* 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.index.test.po; | ||
|
||
import org.xwiki.livedata.test.po.LiveDataElement; | ||
|
||
/** | ||
* Represents the livetable for index all docs. | ||
* | ||
* @version $Id$ | ||
* @since 11.6RC1 | ||
* @since 11.5 | ||
*/ | ||
public class AllDocsLiveData extends LiveDataElement | ||
{ | ||
/** | ||
* Default constructor. | ||
*/ | ||
public AllDocsLiveData() | ||
{ | ||
super("alldocs"); | ||
} | ||
|
||
/** | ||
* Filter a column using the provided value. | ||
* | ||
* @param columnLabel the label of the column to filter | ||
* @param filterValue the value to use to filter | ||
*/ | ||
public void filterColumn(String columnLabel, String filterValue) | ||
{ | ||
// TODO: replace column number with the column label. | ||
getTableLayout().filterColumn(columnLabel, filterValue); | ||
} | ||
|
||
/** | ||
* Click on a Live Data action. | ||
* | ||
* @param rowNumber the number of the row of the action (start at 1 for the first row) | ||
* @param actionName the name of the action to click (e.g., 'copy') | ||
*/ | ||
public void clickAction(int rowNumber, String actionName) | ||
{ | ||
getTableLayout().clickAction(rowNumber, actionName); | ||
} | ||
} |