From af6b5abe06a8bfcfd6546e654ccf3931da31e6d9 Mon Sep 17 00:00:00 2001 From: Manuel Leduc Date: Fri, 2 Feb 2024 10:11:06 +0100 Subject: [PATCH] XWIKI-19041: Replace the Livetable from DocumentsMacro with a Live Data macro (#2775) --- .../xwiki/index/test/ui/docker/AllDocsIT.java | 136 ++++---- .../org/xwiki/index/test/ui/docker/AllIT.java | 12 + .../test/ui/docker/DocumentsMacroIT.java | 72 +++++ .../xwiki/index/test/ui/docker}/SpacesIT.java | 43 ++- ...ocsLivetable.java => AllDocsLiveData.java} | 35 ++- .../org/xwiki/index/test/po/AllDocsPage.java | 12 +- .../index/test/po/DocumentsMacroPage.java | 8 +- .../xwiki/index/test/po/SpaceIndexPage.java | 8 +- .../xwiki/index/test/ui/DocumentsMacroIT.java | 61 ---- .../src/main/resources/Main/SpaceIndex.xml | 69 +++- .../main/resources/XWiki/DocumentsMacro.xml | 297 ++++++++++++++---- .../livedata/test/po/TableLayoutElement.java | 22 +- .../it/org/xwiki/mail/test/ui/MailIT.java | 4 +- .../MailStatusAdministrationSectionPage.java | 14 +- 14 files changed, 549 insertions(+), 244 deletions(-) create mode 100644 xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-docker/src/test/it/org/xwiki/index/test/ui/docker/DocumentsMacroIT.java rename xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/{xwiki-platform-index-test-tests/src/test/it/org/xwiki/index/test/ui => xwiki-platform-index-test-docker/src/test/it/org/xwiki/index/test/ui/docker}/SpacesIT.java (69%) rename xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/{AllDocsLivetable.java => AllDocsLiveData.java} (58%) delete mode 100644 xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-tests/src/test/it/org/xwiki/index/test/ui/DocumentsMacroIT.java diff --git a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-docker/src/test/it/org/xwiki/index/test/ui/docker/AllDocsIT.java b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-docker/src/test/it/org/xwiki/index/test/ui/docker/AllDocsIT.java index 28ffc4f5a38d..e4b9c524492a 100644 --- a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-docker/src/test/it/org/xwiki/index/test/ui/docker/AllDocsIT.java +++ b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-docker/src/test/it/org/xwiki/index/test/ui/docker/AllDocsIT.java @@ -22,9 +22,10 @@ import java.io.ByteArrayInputStream; import java.util.Arrays; +import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; -import org.xwiki.index.test.po.AllDocsLivetable; +import org.xwiki.index.test.po.AllDocsLiveData; import org.xwiki.index.test.po.AllDocsPage; import org.xwiki.livedata.test.po.TableLayoutElement; import org.xwiki.model.reference.DocumentReference; @@ -52,7 +53,20 @@ @UITest class AllDocsIT { + private static final String LOCATION_COLUMN_LABEL = "Location"; + + private static final String TYPE_COLUMN_LABEL = "Type"; + + private static final String NAME_COLUMN_LABEL = "Name"; + + private static final String SIZE_COLUMN_LABEL = "Size"; + + private static final String DATE_COLUMN_LABEL = "Date"; + + private static final String AUTHOR_COLUMN_LABEL = "Author"; + @Test + @Order(1) void verifyAllDocs(TestUtils setup, TestInfo testInfo, TestReference testReference) { // Fixture @@ -62,7 +76,7 @@ void verifyAllDocs(TestUtils setup, TestInfo testInfo, TestReference testReferen // tests validateActionsAndGuest(setup); - validateFilterDoc(setup, testReference); + validateFilterDoc(testReference); validateCopyLink(setup, testInfo, testReference); validateRenameLink(setup, testInfo, testReference); validateDeleteLink(setup, testReference); @@ -75,6 +89,7 @@ void verifyAllDocs(TestUtils setup, TestInfo testInfo, TestReference testReferen * This test is against XWiki Enterprise XE-701 https://jira.xwiki.org/browse/XE-701 (fixed in 2.5M1). */ @Test + @Order(2) void attachmentsTabFilteringAndSorting(TestUtils setup, TestReference testReference) throws Exception { // Create 2 pages with attachments so that this test filter returns only one. @@ -89,48 +104,48 @@ void attachmentsTabFilteringAndSorting(TestUtils setup, TestReference testRefere TableLayoutElement liveData = docsPage.clickAttachmentsTab().getTableLayout(); // Here we test if all the Columns are displayed. - assertTrue(liveData.hasColumn("Type"), "No Type column found"); - assertTrue(liveData.hasColumn("Name"), "No Name column found"); - assertTrue(liveData.hasColumn("Location"), "No Location column found"); - assertTrue(liveData.hasColumn("Size"), "No Size column found"); - assertTrue(liveData.hasColumn("Date"), "No Date column found"); - assertTrue(liveData.hasColumn("Author"), "No Author column found"); + assertTrue(liveData.hasColumn(TYPE_COLUMN_LABEL), "No Type column found"); + assertTrue(liveData.hasColumn(NAME_COLUMN_LABEL), "No Name column found"); + assertTrue(liveData.hasColumn(LOCATION_COLUMN_LABEL), "No Location column found"); + assertTrue(liveData.hasColumn(SIZE_COLUMN_LABEL), "No Size column found"); + assertTrue(liveData.hasColumn(DATE_COLUMN_LABEL), "No Date column found"); + assertTrue(liveData.hasColumn(AUTHOR_COLUMN_LABEL), "No Author column found"); String defaultLocationFilter = className + "."; - liveData.filterColumn("Location", defaultLocationFilter); + liveData.filterColumn(LOCATION_COLUMN_LABEL, defaultLocationFilter); assertEquals(2, liveData.countRows()); // Filter by attachment file name. - liveData.filterColumn("Name", "t1"); + liveData.filterColumn(NAME_COLUMN_LABEL, "t1"); assertEquals(1, liveData.countRows()); - assertEquals("attachment1.txt", liveData.getCell("Name", 1).getText()); + assertEquals("attachment1.txt", liveData.getCell(NAME_COLUMN_LABEL, 1).getText()); // Clear the filter. - liveData.filterColumn("Name", ""); + liveData.filterColumn(NAME_COLUMN_LABEL, ""); // Filter by attachment location. - liveData.filterColumn("Location", defaultLocationFilter + "Oth"); + liveData.filterColumn(LOCATION_COLUMN_LABEL, defaultLocationFilter + "Oth"); assertEquals(1, liveData.countRows()); - assertEquals(className + "OtherPage", liveData.getCell("Location", 1).getText()); + assertEquals(className + "OtherPage", liveData.getCell(LOCATION_COLUMN_LABEL, 1).getText()); // Reset the filter. - liveData.filterColumn("Location", defaultLocationFilter); + liveData.filterColumn(LOCATION_COLUMN_LABEL, defaultLocationFilter); // Sort by attachment file name. The live table should be already sorted by file name ascending. This will // reverse the order. - assertEquals("attachment2.txt", liveData.getCell("Name", 2).getText()); - liveData.sortBy("Name"); + assertEquals("attachment2.txt", liveData.getCell(NAME_COLUMN_LABEL, 2).getText()); + liveData.sortBy(NAME_COLUMN_LABEL); assertEquals(2, liveData.countRows()); - assertEquals("attachment2.txt", liveData.getCell("Name", 1).getText()); + assertEquals("attachment2.txt", liveData.getCell(NAME_COLUMN_LABEL, 1).getText()); // Sort by attachment location. - liveData.sortBy("Location"); - assertEquals(className + "Page", liveData.getCell("Location", 2).getText()); - liveData.sortBy("Location"); + liveData.sortBy(LOCATION_COLUMN_LABEL); + assertEquals(className + "Page", liveData.getCell(LOCATION_COLUMN_LABEL, 2).getText()); + liveData.sortBy(LOCATION_COLUMN_LABEL); assertEquals(2, liveData.countRows()); - assertEquals(className + "Page", liveData.getCell("Location", 1).getText()); + assertEquals(className + "Page", liveData.getCell(LOCATION_COLUMN_LABEL, 1).getText()); } /** @@ -141,15 +156,15 @@ private void validateActionsAndGuest(TestUtils setup) // Create a test user setup.createUserAndLogin("Foobar", "password"); AllDocsPage page = AllDocsPage.gotoPage(); - AllDocsLivetable livetable = page.clickIndexTab(); - assertTrue(livetable.hasColumn("Actions"), "No Actions column found"); + AllDocsLiveData livetable = page.clickIndexTab(); + assertTrue(livetable.getTableLayout().hasColumn("Actions"), "No Actions column found"); // Logs out to be guest to verify that the Action columns is no longer displayed setup.forceGuestUser(); page = AllDocsPage.gotoPage(); livetable = page.clickIndexTab(); - assertFalse(livetable.hasColumn("Actions"), "Actions column shouldn't be visible for guests"); + assertFalse(livetable.getTableLayout().hasColumn("Actions"), "Actions column shouldn't be visible for guests"); setup.loginAsSuperAdmin(); } @@ -157,19 +172,20 @@ private void validateActionsAndGuest(TestUtils setup) /** * Verify filtering works by filtering on the document name */ - private void validateFilterDoc(TestUtils setup, TestReference testReference) + private void validateFilterDoc(TestReference testReference) { String testName = testReference.getLastSpaceReference().getName(); AllDocsPage page = AllDocsPage.gotoPage(); - AllDocsLivetable livetable = page.clickIndexTab(); - livetable.filterColumn(2, testName); + AllDocsLiveData livetable = page.clickIndexTab(); + livetable.filterColumn(LOCATION_COLUMN_LABEL, testName); // We get one result for the page we've created - assertEquals(1, livetable.getRowCount()); - assertTrue(livetable.hasRow("Title", testName)); + TableLayoutElement tableLayout = livetable.getTableLayout(); + assertEquals(1, tableLayout.countRows()); + tableLayout.assertRow("Title", testName); // We get no result for a page created by user barbaz - livetable.filterColumn(4, "barbaz"); - assertEquals(0, livetable.getRowCount()); + livetable.filterColumn("Last Author", "barbaz"); + assertEquals(0, tableLayout.countRows()); } /** @@ -185,11 +201,12 @@ private void validateCopyLink(TestUtils setup, TestInfo testInfo, TestReference setup.deletePage(copyPageReference); AllDocsPage page = AllDocsPage.gotoPage(); - AllDocsLivetable livetable = page.clickIndexTab(); - livetable.filterColumn(2, testName); + AllDocsLiveData livetable = page.clickIndexTab(); + livetable.filterColumn(LOCATION_COLUMN_LABEL, testName); // We get one result for the page we've created - assertEquals(1, livetable.getRowCount()); - assertTrue(livetable.hasRow("Title", testName)); + TableLayoutElement tableLayout = livetable.getTableLayout(); + assertEquals(1, tableLayout.countRows()); + tableLayout.assertRow("Title", testName); // click on the copy action link. livetable.clickAction(1, "copy"); @@ -202,10 +219,11 @@ private void validateCopyLink(TestUtils setup, TestInfo testInfo, TestReference page = AllDocsPage.gotoPage(); livetable = page.clickIndexTab(); - livetable.filterColumn(2, testName); - assertEquals(2, livetable.getRowCount()); - livetable.filterColumn(2, copyPageName); - assertEquals(1, livetable.getRowCount()); + livetable.filterColumn(LOCATION_COLUMN_LABEL, testName); + tableLayout = livetable.getTableLayout(); + assertEquals(2, tableLayout.countRows()); + livetable.filterColumn(LOCATION_COLUMN_LABEL, copyPageName); + assertEquals(1, tableLayout.countRows()); setup.deletePage(copyPageReference); } @@ -219,11 +237,12 @@ private void validateRenameLink(TestUtils setup, TestInfo testInfo, TestReferenc Arrays.asList(testSpace, renamedPageName), "WebHome"); AllDocsPage page = AllDocsPage.gotoPage(); - AllDocsLivetable livetable = page.clickIndexTab(); - livetable.filterColumn(2, testName); + AllDocsLiveData livetable = page.clickIndexTab(); + livetable.filterColumn(LOCATION_COLUMN_LABEL, testName); // We get one result for the page we've created - assertEquals(1, livetable.getRowCount()); - assertTrue(livetable.hasRow("Title", testName)); + TableLayoutElement tableLayout = livetable.getTableLayout(); + assertEquals(1, tableLayout.countRows()); + tableLayout.assertRow("Title", testName); // click on the copy action link. livetable.clickAction(1, "rename"); @@ -236,9 +255,10 @@ private void validateRenameLink(TestUtils setup, TestInfo testInfo, TestReferenc page = AllDocsPage.gotoPage(); livetable = page.clickIndexTab(); - livetable.filterColumn(2, testName); - assertEquals(1, livetable.getRowCount()); - assertEquals(testSpace + renamedPageName, livetable.getCell(1, 2).getText()); + livetable.filterColumn(LOCATION_COLUMN_LABEL, testName); + tableLayout = livetable.getTableLayout(); + assertEquals(1, tableLayout.countRows()); + assertEquals(testSpace + renamedPageName, tableLayout.getCell(LOCATION_COLUMN_LABEL, 1).getText()); setup.deletePage(renamedPageReference); setup.createPage(testReference, "", testReference.getLastSpaceReference().getName()); @@ -249,11 +269,12 @@ private void validateDeleteLink(TestUtils setup, TestReference testReference) String testName = testReference.getLastSpaceReference().getName(); AllDocsPage page = AllDocsPage.gotoPage(); - AllDocsLivetable livetable = page.clickIndexTab(); - livetable.filterColumn(2, testName); + AllDocsLiveData livetable = page.clickIndexTab(); + livetable.filterColumn(LOCATION_COLUMN_LABEL, testName); // We get one result for the page we've created - assertEquals(1, livetable.getRowCount()); - assertTrue(livetable.hasRow("Title", testName)); + TableLayoutElement tableLayout = livetable.getTableLayout(); + assertEquals(1, tableLayout.countRows()); + tableLayout.assertRow("Title", testName); // click on the copy action link. livetable.clickAction(1, "delete"); @@ -262,8 +283,8 @@ private void validateDeleteLink(TestUtils setup, TestReference testReference) deletingPage.waitUntilFinished(); page = AllDocsPage.gotoPage(); livetable = page.clickIndexTab(); - livetable.filterColumn(2, testName); - assertEquals(0, livetable.getRowCount()); + livetable.filterColumn(LOCATION_COLUMN_LABEL, testName); + assertEquals(0, livetable.getTableLayout().countRows()); setup.createPage(testReference, "", testReference.getLastSpaceReference().getName()); } @@ -272,11 +293,12 @@ private void validateRightLink(TestUtils setup, TestReference testReference) String testName = testReference.getLastSpaceReference().getName(); AllDocsPage page = AllDocsPage.gotoPage(); - AllDocsLivetable livetable = page.clickIndexTab(); - livetable.filterColumn(2, testName); + AllDocsLiveData livetable = page.clickIndexTab(); + livetable.filterColumn(LOCATION_COLUMN_LABEL, testName); // We get one result for the page we've created - assertEquals(1, livetable.getRowCount()); - assertTrue(livetable.hasRow("Title", testName)); + TableLayoutElement tableLayout = livetable.getTableLayout(); + assertEquals(1, tableLayout.countRows()); + tableLayout.assertRow("Title", testName); // click on the copy action link. livetable.clickAction(1, "rights"); diff --git a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-docker/src/test/it/org/xwiki/index/test/ui/docker/AllIT.java b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-docker/src/test/it/org/xwiki/index/test/ui/docker/AllIT.java index 16242b269c0c..202cde366e9c 100644 --- a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-docker/src/test/it/org/xwiki/index/test/ui/docker/AllIT.java +++ b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-docker/src/test/it/org/xwiki/index/test/ui/docker/AllIT.java @@ -49,4 +49,16 @@ class NestedDeletedAttachmentsIT extends DeletedAttachmentsIT class NestedOrphanedPagesIT extends OrphanedPagesIT { } + + @Nested + @DisplayName("Documents Macro UI") + class NestedDocumentsMacroIT extends DocumentsMacroIT + { + } + + @Nested + @DisplayName("Spaces UI") + class NestedSpacesIT extends SpacesIT + { + } } diff --git a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-docker/src/test/it/org/xwiki/index/test/ui/docker/DocumentsMacroIT.java b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-docker/src/test/it/org/xwiki/index/test/ui/docker/DocumentsMacroIT.java new file mode 100644 index 000000000000..576edadbd82b --- /dev/null +++ b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-docker/src/test/it/org/xwiki/index/test/ui/docker/DocumentsMacroIT.java @@ -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"); + } +} diff --git a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-tests/src/test/it/org/xwiki/index/test/ui/SpacesIT.java b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-docker/src/test/it/org/xwiki/index/test/ui/docker/SpacesIT.java similarity index 69% rename from xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-tests/src/test/it/org/xwiki/index/test/ui/SpacesIT.java rename to xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-docker/src/test/it/org/xwiki/index/test/ui/docker/SpacesIT.java index 2526dc46996b..c6848474d685 100644 --- a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-tests/src/test/it/org/xwiki/index/test/ui/SpacesIT.java +++ b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-docker/src/test/it/org/xwiki/index/test/ui/docker/SpacesIT.java @@ -17,20 +17,20 @@ * 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; +package org.xwiki.index.test.ui.docker; -import org.junit.Test; +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.test.ui.AbstractTest; -import org.xwiki.test.ui.browser.IgnoreBrowser; -import org.xwiki.test.ui.browser.IgnoreBrowsers; -import org.xwiki.test.ui.po.LiveTableElement; +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.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Tests the Spaces Macro. @@ -38,22 +38,20 @@ * @version $Id$ * @since 7.0RC1 */ -public class SpacesIT extends AbstractTest +@UITest +class SpacesIT { @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 spacesMacro() + @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 = getTestClassName() + ":" + getTestMethodName() + "&"; - String referenceEscapedSpaceName = getTestClassName() + "\\:" + getTestMethodName() + "&"; + String spaceName = setup.serializeReference(testReference.getLastSpaceReference()) + "&"; + String referenceEscapedSpaceName = spaceName.replaceAll("\\.", "\\\\.").replaceAll(":", "\\\\:"); // Make sure the new space's WebHome page doesn't exist. - getUtil().deletePage(spaceName, "WebHome"); + 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(); @@ -63,7 +61,7 @@ public void spacesMacro() // 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 generate metadata in the HTML header + // 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")); @@ -76,11 +74,10 @@ public void spacesMacro() macroPage.getSpacesMacroPane().clickSpaceIndex(referenceEscapedSpaceName); // Assert the content of the space index live table. - LiveTableElement spaceIndexLiveTable = new SpaceIndexPage().getLiveTable(); - spaceIndexLiveTable.waitUntilReady(); - assertEquals(1, spaceIndexLiveTable.getRowCount()); - assertTrue(spaceIndexLiveTable.hasRow("Page", "WebHome")); - assertTrue(spaceIndexLiveTable.hasRow("Space", referenceEscapedSpaceName)); + 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(); diff --git a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/AllDocsLivetable.java b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/AllDocsLiveData.java similarity index 58% rename from xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/AllDocsLivetable.java rename to xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/AllDocsLiveData.java index 96bcde884696..317c57af6851 100644 --- a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/AllDocsLivetable.java +++ b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/AllDocsLiveData.java @@ -19,34 +19,45 @@ */ package org.xwiki.index.test.po; -import org.openqa.selenium.By; -import org.openqa.selenium.WebElement; -import org.xwiki.test.ui.po.LiveTableElement; +import org.xwiki.livedata.test.po.LiveDataElement; /** * Represents the livetable for index all docs. * + * @version $Id$ * @since 11.6RC1 * @since 11.5 - * @version $Id$ */ -public class AllDocsLivetable extends LiveTableElement +public class AllDocsLiveData extends LiveDataElement { - public AllDocsLivetable() + /** + * Default constructor. + */ + public AllDocsLiveData() { super("alldocs"); } - public void filterColumn(int columnNumber, String filterValue) + /** + * 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) { - String columnId = String.format("xwiki-livetable-alldocs-filter-%s", columnNumber); - this.filterColumn(columnId, 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) { - WebElement pageRow = this.getRow(rowNumber); - String xPathLocator = String.format("//a[contains(@class, 'action%s')]", actionName); - pageRow.findElement(By.xpath(xPathLocator)).click(); + getTableLayout().clickAction(rowNumber, actionName); } } diff --git a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/AllDocsPage.java b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/AllDocsPage.java index 4b97aec25c22..d8b3559fbb21 100644 --- a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/AllDocsPage.java +++ b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/AllDocsPage.java @@ -64,14 +64,16 @@ public static String getURL() return getUtil().getURL("Main", "AllDocs"); } - public AllDocsLivetable clickIndexTab() + /** + * Click on the index tab. + * + * @return the Live Data listing all the documents + */ + public AllDocsLiveData clickIndexTab() { this.indexTab.click(); - AllDocsLivetable lt = new AllDocsLivetable(); - lt.waitUntilReady(); - - return lt; + return new AllDocsLiveData(); } public DocumentTreeElement clickTreeTab() diff --git a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/DocumentsMacroPage.java b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/DocumentsMacroPage.java index 5a6e9c6dc635..d884bb71c212 100644 --- a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/DocumentsMacroPage.java +++ b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/DocumentsMacroPage.java @@ -19,7 +19,7 @@ */ package org.xwiki.index.test.po; -import org.xwiki.test.ui.po.LiveTableElement; +import org.xwiki.livedata.test.po.LiveDataElement; import org.xwiki.test.ui.po.ViewPage; /** @@ -36,10 +36,8 @@ public static DocumentsMacroPage gotoPage() return new DocumentsMacroPage(); } - public LiveTableElement getDocumentsExampleLiveTable() + public LiveDataElement getDocumentsExampleLiveTable() { - LiveTableElement lt = new LiveTableElement("example"); - lt.waitUntilReady(); - return lt; + return new LiveDataElement("example"); } } diff --git a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/SpaceIndexPage.java b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/SpaceIndexPage.java index db3627fd0a3c..006e8706a9da 100644 --- a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/SpaceIndexPage.java +++ b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-pageobjects/src/main/java/org/xwiki/index/test/po/SpaceIndexPage.java @@ -21,7 +21,7 @@ import java.util.Collections; -import org.xwiki.test.ui.po.LiveTableElement; +import org.xwiki.livedata.test.po.LiveDataElement; import org.xwiki.test.ui.po.ViewPage; /** @@ -35,7 +35,7 @@ public class SpaceIndexPage extends ViewPage /** * The live table that lists the documents from the space. */ - private LiveTableElement liveTable = new LiveTableElement("spaceindex"); + private final LiveDataElement liveDataElement = new LiveDataElement("spaceindex"); /** * Opens the document index for the specified page. @@ -52,8 +52,8 @@ public static SpaceIndexPage gotoPage(String spaceName) /** * @return the document index live table */ - public LiveTableElement getLiveTable() + public LiveDataElement getLiveData() { - return liveTable; + return this.liveDataElement; } } diff --git a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-tests/src/test/it/org/xwiki/index/test/ui/DocumentsMacroIT.java b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-tests/src/test/it/org/xwiki/index/test/ui/DocumentsMacroIT.java deleted file mode 100644 index 72648faf1637..000000000000 --- a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-test/xwiki-platform-index-test-tests/src/test/it/org/xwiki/index/test/ui/DocumentsMacroIT.java +++ /dev/null @@ -1,61 +0,0 @@ - /* - * 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; - -import org.junit.Assert; -import org.junit.Test; -import org.xwiki.index.test.po.DocumentsMacroPage; -import org.xwiki.test.ui.AbstractGuestTest; -import org.xwiki.test.ui.po.LiveTableElement; - - /** - * Tests for the DocumentsMacro page. - * - * @version $Id$ - * @since 4.2M3 - */ - public class DocumentsMacroIT extends AbstractGuestTest - { - /** - * Verify that the {{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 - public void testDocumentsMacro() throws Exception - { - // 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). - getUtil().createPage("Main", getTestMethodName(), "", "Test Title", "xwiki/2.1", "Main.WebHome"); - - DocumentsMacroPage dmp = DocumentsMacroPage.gotoPage(); - LiveTableElement livetable = dmp.getDocumentsExampleLiveTable(); - - // Verify that we have a Page column - Assert.assertTrue("No Title column found", livetable.hasColumn("Title")); - - // Verify there are several rows displayed - Assert.assertTrue(livetable.getRowCount() > 0); - - // Verify that page titles are displayed by filtering on one page for which we know the title - livetable.filterColumn("xwiki-livetable-example-filter-2", getTestMethodName()); - Assert.assertTrue(livetable.hasRow("Title", "Test Title")); - } - } diff --git a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-ui/src/main/resources/Main/SpaceIndex.xml b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-ui/src/main/resources/Main/SpaceIndex.xml index 167b0e0cecc4..88792c5c4ed6 100644 --- a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-ui/src/main/resources/Main/SpaceIndex.xml +++ b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-ui/src/main/resources/Main/SpaceIndex.xml @@ -37,12 +37,22 @@ xwiki/2.0 true {{velocity}} -#if("$!request.space" != "") #set($space=$request.space) #else #set($space = $doc.space) #end -$services.localization.render('platform.index.spaceIndexDescription', [$space]) +#if("$!request.space" != "") + #set($space=$request.space) +#else + #set($space = $doc.space) +#end ## Since we display the space index, we do not display page titles and locations, but the old columns name and space ## (old behavior consistent with this old macro)... -{{documents space="$space.replaceAll('["~]', '~$0')" id="spaceindex" columns="doc.name, doc.space, doc.date, doc.author"/}} +#set ($description = $services.localization.render('platform.index.spaceIndexDescription', [$space])) +#set ($description = $services.rendering.escape($description, 'xwiki/2.1')) +{{documents + space="$services.rendering.escape($space, 'xwiki/2.1')" + id="spaceindex" + columns="doc.name,doc.space,doc.date,doc.author" + description="$description" +/}} #set($docextras=[]) {{/velocity}} @@ -86,7 +96,7 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) |, 5 0 - action=Action|doc.reference=Document|icon.theme=Icon theme|locale=Language|rendering.defaultsyntax=Default syntax|rendering.restricted=Restricted|rendering.targetsyntax=Target syntax|request.base=Request base URL|request.cookies|request.parameters=Request parameters|request.url=Request URL|request.wiki=Request wiki|user=User|wiki=Wiki + action=Action|doc.reference=Document|doc.revision|icon.theme=Icon theme|locale=Language|rendering.defaultsyntax=Default syntax|rendering.restricted=Restricted|rendering.targetsyntax=Target syntax|request.base=Request base URL|request.cookies|request.headers|request.parameters=Request parameters|request.remoteAddr|request.session|request.url=Request URL|request.wiki=Request wiki|sheet|user=User|wiki=Wiki com.xpn.xwiki.objects.classes.StaticListClass @@ -106,6 +116,7 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) code 10 Macro code + 0 20 40 0 @@ -118,6 +129,7 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) contentDescription 9 Content description (Not applicable for "No content" type) + 0 5 40 0 @@ -186,6 +198,7 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) description 3 Macro description + 0 5 40 0 @@ -377,6 +390,7 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) description 2 Parameter description + 0 5 40 0 @@ -402,13 +416,24 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass @@ -455,6 +480,7 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) description 2 Parameter description + 0 5 40 0 @@ -480,13 +506,24 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass @@ -533,6 +570,7 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) description 2 Parameter description + 0 5 40 0 @@ -558,13 +596,24 @@ $services.localization.render('platform.index.spaceIndexDescription', [$space]) com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass diff --git a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-ui/src/main/resources/XWiki/DocumentsMacro.xml b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-ui/src/main/resources/XWiki/DocumentsMacro.xml index 0f5a6ce0e56b..ef9e0c544e52 100644 --- a/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-ui/src/main/resources/XWiki/DocumentsMacro.xml +++ b/xwiki-platform-core/xwiki-platform-index/xwiki-platform-index-ui/src/main/resources/XWiki/DocumentsMacro.xml @@ -83,7 +83,7 @@ Generates: |, 5 0 - action=Action|doc.reference=Document|icon.theme=Icon theme|locale=Language|rendering.defaultsyntax=Default syntax|rendering.restricted=Restricted|rendering.targetsyntax=Target syntax|request.base=Request base URL|request.cookies|request.parameters=Request parameters|request.url=Request URL|request.wiki=Request wiki|user=User|wiki=Wiki + action=Action|doc.reference=Document|doc.revision|icon.theme=Icon theme|locale=Language|rendering.defaultsyntax=Default syntax|rendering.restricted=Restricted|rendering.targetsyntax=Target syntax|request.base=Request base URL|request.cookies|request.headers|request.parameters=Request parameters|request.remoteAddr|request.session|request.url=Request URL|request.wiki=Request wiki|sheet|user=User|wiki=Wiki com.xpn.xwiki.objects.classes.StaticListClass @@ -103,6 +103,7 @@ Generates: code 10 Macro code + 0 20 40 0 @@ -115,6 +116,7 @@ Generates: contentDescription 9 Content description (Not applicable for "No content" type) + 0 5 40 0 @@ -183,6 +185,7 @@ Generates: description 3 Macro description + 0 5 40 0 @@ -256,65 +259,63 @@ Generates: {{velocity}} -#if ("$!xcontext.macro.params.columns" != "") - #set ($collist = []) +#if ("$!xcontext.macro.params.columns" != "") + #set ($properties = []) #foreach ($colname in $xcontext.macro.params.columns.split(',')) - #set ($discard = $collist.add($colname.trim())) + #set ($discard = $properties.add($colname.trim())) #end #else - #set($collist = ['doc.title', 'doc.location', 'doc.date', 'doc.author']) + #set ($properties = ['doc.title', 'doc.location', 'doc.date', 'doc.author']) #end -#set($colprops = { - 'doc.title' : { 'size' : 30, 'link' : 'view' }, - 'doc.location' : { 'html': true }, - 'doc.fullName' : { 'size' : 30, 'link' : 'view' }, - 'doc.name' : { 'size' : 30, 'link' : 'view' }, - 'doc.space' : { 'link' : 'space' }, - 'doc.author' : { 'link' : 'author' } +#set ($sourceParameters = { + 'translationPrefix' : 'platform.index.' }) -#set($options = { - 'translationPrefix' : 'platform.index.', - 'rowCount' : $xcontext.macro.params.count, - 'description' : 'This table lists documents found on this wiki based on passed criteria. The columns can be sorted and some can be filtered.' -}) -#if ("$!xcontext.macro.params.space" != "") - #set ($extraParams = "&space=$escapetool.url($xcontext.macro.params.space)") -#end -#if ("$!xcontext.macro.params.location" != "") - #set ($extraParams = "$!{extraParams}&location=$escapetool.url($xcontext.macro.params.location)") -#end -#if ("$!xcontext.macro.params.parent" != "") - #set ($extraParams = "$!{extraParams}&parent=$escapetool.url($xcontext.macro.params.parent)") +#if ("$!xcontext.macro.params.space" != "") + #set ($discard = $sourceParameters.put('space', $xcontext.macro.params.space)) #end -#if ("$!extraParams" != "") - #set($discard = $options.put('extraParams', $extraParams)) +#if ("$!xcontext.macro.params.location" != "") + #set ($discard = $sourceParameters.put('location', $xcontext.macro.params.location)) #end -#if(!$isGuest && $xcontext.macro.params.actions == "true") - #set($discard = $collist.add('_actions')) - #set($discard = $colprops.put('_actions', { - 'actions': ['copy', 'rename', 'rights', 'delete'], - 'filterable': false, - 'sortable': false - })) +#if ("$!xcontext.macro.params.parent" != "") + #set ($discard = $sourceParameters.put('parent', $xcontext.macro.params.parent)) #end +#set ($propertyDescriptors = []) #if ("$!services.like" != "") - #set($discard = $collist.add('_likes')) ## We can't make it sortable or filterable right now since it's not stored in DB. - #set($discard = $colprops.put('_likes', { - 'filterable': false, - 'sortable': false - })) + #set ($discard = $propertyDescriptors.add({ 'id': '_likes', 'sortable': false, 'filterable': false })) + #set ($discard = $properties.add('_likes')) #end -#if ($collist.contains('doc.location')) - #set ($discard = $options.put('selectedColumn','doc.location')) +#if(!$isGuest && $xcontext.macro.params.actions == "true") + #set ($discard = $propertyDescriptors.add({ 'id': '_actions', 'displayer': { 'id': 'actions', 'actions': ['copy', 'rename', 'rights', 'delete'] }})) + #set ($discard = $properties.add('_actions')) #end +#set ($liveDataConfig = {'meta': {'propertyDescriptors': $propertyDescriptors}}) #if ("$!xcontext.macro.params.id" != "") - #set ($livetableId = $xcontext.macro.params.id) + #set ($livedataId = $xcontext.macro.params.id) #else ## TODO: Improve this since we could have several livetables on the same page with same ids - #set ($livetableId = "documents-$mathtool.random(1, 1000)") + #set ($livedataId = "documents-$mathtool.random(1, 1000)") +#end + +#set ($livedataId = $services.rendering.escape($livedataId, 'xwiki/2.1')) +#set ($description = '') +#if ("$!xcontext.macro.params.description" != '') + #set ($description = $services.rendering.escape($xcontext.macro.params.description, 'xwiki/2.1')) +#end +#set ($limit = '') +#if ("$!xcontext.macro.params.count" != '') + #set ($limit = $services.rendering.escape($xcontext.macro.params.count, 'xwiki/2.1')) #end -#livetable($livetableId $collist $colprops $options) +#set ($properties = $services.rendering.escape($stringtool.join($properties, ','), 'xwiki/2.1')) +{{liveData + id="$livedataId" + properties="$properties" + source="liveTable" + sourceParameters="$escapetool.url($sourceParameters)" + #if ($description != '')description="$description"#end + #if ($properties.contains('doc.location'))sort="doc.location"#end + #if ($limit != '')limit="$limit"#end +}}$jsontool.serialize($liveDataConfig){{/liveData}} {{/velocity}} @@ -332,7 +333,7 @@ Generates: - Displays a list of documents in a Livetable + Displays a list of documents in a Live Data documents @@ -378,6 +379,7 @@ Generates: description 2 Parameter description + 0 5 40 0 @@ -403,13 +405,24 @@ Generates: com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass @@ -456,6 +469,7 @@ Generates: description 2 Parameter description + 0 5 40 0 @@ -481,13 +495,24 @@ Generates: com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass @@ -534,6 +559,7 @@ Generates: description 2 Parameter description + 0 5 40 0 @@ -559,13 +585,24 @@ Generates: com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass @@ -612,6 +649,7 @@ Generates: description 2 Parameter description + 0 5 40 0 @@ -637,20 +675,31 @@ Generates: com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass - Livetable id + Live Data id 0 @@ -690,6 +739,7 @@ Generates: description 2 Parameter description + 0 5 40 0 @@ -715,13 +765,24 @@ Generates: com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass @@ -768,6 +829,7 @@ Generates: description 2 Parameter description + 0 5 40 0 @@ -793,20 +855,31 @@ Generates: com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass - Specifies the list of columns to display (e.g. "doc.name,doc.space"). If not specified then the default column list of used ("doc.name,doc.space,doc.date,doc.author") + Specifies the list of properties (e.g., "doc.name,doc.space"). If not specified then the default properties list is used ("doc.name,doc.space,doc.date,doc.author") 0 @@ -846,6 +919,7 @@ Generates: description 2 Parameter description + 0 5 40 0 @@ -871,13 +945,24 @@ Generates: com.xpn.xwiki.objects.classes.StringClass + 0 + Unknown 0 + input + allowed + 1 + 0 type 5 + 1 Parameter type - 60 + 0 + | + | + 1 0 - com.xpn.xwiki.objects.classes.StringClass + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass @@ -896,4 +981,94 @@ Generates: + + XWiki.DocumentsMacro + 7 + XWiki.WikiMacroParameterClass + 216587c3-ad5c-45aa-a379-3e016dc72268 + + XWiki.WikiMacroParameterClass + + + + + + + + + 0 + defaultValue + 4 + Parameter default value + 30 + 0 + com.xpn.xwiki.objects.classes.StringClass + + + 0 + description + 2 + Parameter description + 0 + 5 + 40 + 0 + com.xpn.xwiki.objects.classes.TextAreaClass + + + 0 + select + yesno + mandatory + 3 + Parameter mandatory + 0 + com.xpn.xwiki.objects.classes.BooleanClass + + + 0 + name + 1 + Parameter name + 30 + 0 + com.xpn.xwiki.objects.classes.StringClass + + + 0 + Unknown + 0 + input + allowed + 1 + 0 + type + 5 + 1 + Parameter type + 0 + | + | + 1 + 0 + Unknown|Wiki + com.xpn.xwiki.objects.classes.StaticListClass + + + + + + + Provide a description of the list of documents + + + 0 + + + description + + + + + diff --git a/xwiki-platform-core/xwiki-platform-livedata/xwiki-platform-livedata-test/xwiki-platform-livedata-test-pageobjects/src/main/java/org/xwiki/livedata/test/po/TableLayoutElement.java b/xwiki-platform-core/xwiki-platform-livedata/xwiki-platform-livedata-test/xwiki-platform-livedata-test-pageobjects/src/main/java/org/xwiki/livedata/test/po/TableLayoutElement.java index f86fcd2b23b5..40a2823f4c85 100644 --- a/xwiki-platform-core/xwiki-platform-livedata/xwiki-platform-livedata-test/xwiki-platform-livedata-test-pageobjects/src/main/java/org/xwiki/livedata/test/po/TableLayoutElement.java +++ b/xwiki-platform-core/xwiki-platform-livedata/xwiki-platform-livedata-test/xwiki-platform-livedata-test-pageobjects/src/main/java/org/xwiki/livedata/test/po/TableLayoutElement.java @@ -688,8 +688,19 @@ public Set getPaginationSizes() */ public void clickAction(int rowNumber, String actionName) { - getRoot().findElement(By.cssSelector( - String.format("tbody tr:nth-child(%d) [name='%s']", rowNumber, actionName))) + clickAction(rowNumber, By.cssSelector(String.format(".actions-container .action.action_%s", actionName))); + } + + /** + * Clicks on an action based on a row and the provided selector. + * + * @param rowNumber the row number, for instance 3 for the third row + * @param selector the selector to find the action element in the row + */ + public void clickAction(int rowNumber, By selector) + { + getRowElement(rowNumber) + .findElement(selector) .click(); } @@ -732,10 +743,15 @@ public void editAndCancel(String columnLabel, int rowNumber, String fieldName, S */ public WebElement findElementInRow(int rowNumber, By by) { - return getRoot().findElement(By.cssSelector(String.format("tbody tr:nth-child(%d)", rowNumber))) + return getRowElement(rowNumber) .findElement(by); } + private WebElement getRowElement(int rowNumber) + { + return getRoot().findElement(By.cssSelector(String.format("tbody tr:nth-child(%d)", rowNumber))); + } + /** * Return a hamcrest {@link Matcher} on the text of a {@link WebElement}. For instance the {@link Matcher} will * match on the web element containing the following html source {@code

Test

} for the value {@code diff --git a/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-test/xwiki-platform-mail-test-docker/src/test/it/org/xwiki/mail/test/ui/MailIT.java b/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-test/xwiki-platform-mail-test-docker/src/test/it/org/xwiki/mail/test/ui/MailIT.java index 5837853fdff0..ebb6ef4d6e3f 100644 --- a/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-test/xwiki-platform-mail-test-docker/src/test/it/org/xwiki/mail/test/ui/MailIT.java +++ b/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-test/xwiki-platform-mail-test-docker/src/test/it/org/xwiki/mail/test/ui/MailIT.java @@ -264,7 +264,7 @@ private void verifyMailDelete() TableLayoutElement tableLayout = statusPage.getLiveData().getTableLayout(); tableLayout.filterColumn("Status", "send_success"); int count = tableLayout.countRows(); - tableLayout.clickAction(1, "mailsendingaction_delete"); + statusPage.clickAction(1, "mailsendingaction_delete"); // Wait for the success message to be displayed statusPage.waitUntilContent("\\QThe mail has been deleted successfully\\E"); @@ -279,7 +279,7 @@ private void verifyIndividualResend() MailStatusAdministrationSectionPage statusPage = MailStatusAdministrationSectionPage.gotoPage(); TableLayoutElement tableLayout = statusPage.getLiveData().getTableLayout(); tableLayout.filterColumn("Status", "send_error"); - tableLayout.clickAction(1, "mailsendingaction_resend"); + statusPage.clickAction(1, "mailsendingaction_resend"); // Refresh the page and verify the mail to to@doe.com is in send_success state now statusPage = MailStatusAdministrationSectionPage.gotoPage(); diff --git a/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-test/xwiki-platform-mail-test-pageobjects/src/main/java/org/xwiki/mail/test/po/MailStatusAdministrationSectionPage.java b/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-test/xwiki-platform-mail-test-pageobjects/src/main/java/org/xwiki/mail/test/po/MailStatusAdministrationSectionPage.java index 14957f727464..1cb9d1d07c5c 100644 --- a/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-test/xwiki-platform-mail-test-pageobjects/src/main/java/org/xwiki/mail/test/po/MailStatusAdministrationSectionPage.java +++ b/xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-test/xwiki-platform-mail-test-pageobjects/src/main/java/org/xwiki/mail/test/po/MailStatusAdministrationSectionPage.java @@ -19,12 +19,13 @@ */ package org.xwiki.mail.test.po; +import org.openqa.selenium.By; import org.xwiki.administration.test.po.AdministrationSectionPage; import org.xwiki.livedata.test.po.LiveDataElement; /** * Represents the actions possible on the Mail Status Administration Page. - * + * * @version $Id$ * @since 6.4RC1 */ @@ -48,4 +49,15 @@ public LiveDataElement getLiveData() { return new LiveDataElement("sendmailstatus"); } + + /** + * Click on a mail action. + * + * @param rowNumber the row number in which to call the actions (start at 1 for the first row) + * @param actionName the name of the action (e.g., {@code mailsendingaction_resend}) + */ + public void clickAction(int rowNumber, String actionName) + { + getLiveData().getTableLayout().clickAction(rowNumber, By.cssSelector(String.format("[name='%s']", actionName))); + } }