Search in sources :

Example 1 with TreeElement

use of org.xwiki.tree.test.po.TreeElement 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());
}
Also used : TreeNodeElement(org.xwiki.tree.test.po.TreeNodeElement) ViewPage(org.xwiki.test.ui.po.ViewPage) TreeElement(org.xwiki.tree.test.po.TreeElement) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Aggregations

Test (org.junit.Test)1 AbstractTest (org.xwiki.test.ui.AbstractTest)1 ViewPage (org.xwiki.test.ui.po.ViewPage)1 TreeElement (org.xwiki.tree.test.po.TreeElement)1 TreeNodeElement (org.xwiki.tree.test.po.TreeNodeElement)1