Search in sources :

Example 1 with DocumentsMacroPage

use of org.xwiki.index.test.po.DocumentsMacroPage in project xwiki-platform by xwiki.

the class DocumentsMacroTest method testDocumentsMacro.

/**
 * 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"));
}
Also used : LiveTableElement(org.xwiki.test.ui.po.LiveTableElement) DocumentsMacroPage(org.xwiki.index.test.po.DocumentsMacroPage) Test(org.junit.Test) AbstractGuestTest(org.xwiki.test.ui.AbstractGuestTest)

Aggregations

Test (org.junit.Test)1 DocumentsMacroPage (org.xwiki.index.test.po.DocumentsMacroPage)1 AbstractGuestTest (org.xwiki.test.ui.AbstractGuestTest)1 LiveTableElement (org.xwiki.test.ui.po.LiveTableElement)1