use of org.xwiki.tree.test.po.TreeNodeElement in project xwiki-platform by xwiki.
the class VfsTest method testVfsMacro.
@Test
public void testVfsMacro() throws Exception {
// Delete pages that we create in the test
getUtil().rest().deletePage(getTestClassName(), getTestMethodName());
// Scenario:
// - Attach a zip to a wiki page
// - Use the VFS Tree Macro to display the content of that zip
// - Click on a tree node to display the content of a file inside the zip
getUtil().attachFile(getTestClassName(), getTestMethodName(), "test.zip", createZipInputStream(), false);
String content = "{{vfsTree root=\"attach:test.zip\"/}}";
ViewPage vp = getUtil().createPage(getTestClassName(), getTestMethodName(), content, "VFS Test");
// Get hold of the Tree and expand the directory node and the click on the first children node
TreeElement tree = new TreeElement(getDriver().findElement(By.cssSelector(".xtree")));
tree.waitForIt();
TreeNodeElement node = tree.getNode("//directory");
node = node.open();
node.waitForIt();
node.getChildren().get(0).select();
assertEquals("content2", getDriver().findElement(By.tagName("body")).getText());
}
use of org.xwiki.tree.test.po.TreeNodeElement 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());
}
Aggregations