Search in sources :

Example 1 with DocumentTreeElement

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

the class AllDocsTest method treeViewTab.

/**
 * Validate the tree view.
 */
@Test
public void treeViewTab() throws Exception {
    // Create a tree structure.
    String spaceName = getTestClassName();
    getUtil().createPage(spaceName, "WebHome", null, null);
    getUtil().createPageWithAttachment(Arrays.asList(spaceName, "A", "B"), "C", null, "Child Page", null, null, "file.txt", getClass().getResourceAsStream("/file.txt"), TestUtils.SUPER_ADMIN_CREDENTIALS);
    DocumentTreeElement tree = AllDocsPage.gotoPage().clickTreeTab();
    TreeNodeElement root = tree.getDocumentNode(spaceName, "WebHome");
    assertEquals(spaceName, root.getLabel());
    assertFalse(tree.hasDocument(spaceName, "A", "WebHome"));
    root.open().waitForIt();
    TreeNodeElement alice = tree.getDocumentNode(spaceName, "A", "WebHome");
    assertEquals("A", alice.getLabel());
    assertFalse(tree.hasDocument(spaceName, "A", "B", "WebHome"));
    alice.open().waitForIt();
    TreeNodeElement bob = tree.getDocumentNode(spaceName, "A", "B", "WebHome");
    assertEquals("B", bob.getLabel());
    assertFalse(tree.hasDocument(spaceName, "A", "B", "C"));
    bob.open().waitForIt();
    TreeNodeElement child = tree.getDocumentNode(spaceName, "A", "B", "C");
    assertEquals("Child Page", child.getLabel());
    assertFalse(tree.hasAttachment(spaceName, "A", "B", "C", "file.txt"));
    // Open the Attachments node.
    child.open().waitForIt().getChildren().get(0).open().waitForIt();
    TreeNodeElement file = tree.getAttachmentNode(spaceName, "A", "B", "C", "file.txt");
    assertEquals("file.txt", file.getLabel());
}
Also used : TreeNodeElement(org.xwiki.tree.test.po.TreeNodeElement) DocumentTreeElement(org.xwiki.index.tree.test.po.DocumentTreeElement) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 2 with DocumentTreeElement

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

the class AllDocsTest method treeViewTabWithSpecialCharactersInEntityNames.

/**
 * @see "XWIKI-5187: XWiki Explorer doesn't support very well spaces and pages with special characters in their
 *      names"
 */
@Test
public void treeViewTabWithSpecialCharactersInEntityNames() {
    // Create a tree structure.
    String spaceName = getTestMethodName() + ".0";
    getUtil().createPage(Arrays.asList(spaceName, "Level.1", "Level{[(2)]}", "Level@3"), "End", null, null);
    DocumentTreeElement tree = AllDocsPage.gotoPage().clickTreeTab();
    tree.openToDocument(spaceName, "Level.1", "Level{[(2)]}", "Level@3", "End");
    assertTrue(tree.hasDocument(spaceName, "Level.1", "WebHome"));
    assertTrue(tree.hasDocument(spaceName, "Level.1", "Level{[(2)]}", "WebHome"));
    assertTrue(tree.hasDocument(spaceName, "Level.1", "Level{[(2)]}", "Level@3", "WebHome"));
}
Also used : DocumentTreeElement(org.xwiki.index.tree.test.po.DocumentTreeElement) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Aggregations

Test (org.junit.Test)2 DocumentTreeElement (org.xwiki.index.tree.test.po.DocumentTreeElement)2 AbstractTest (org.xwiki.test.ui.AbstractTest)2 TreeNodeElement (org.xwiki.tree.test.po.TreeNodeElement)1