Examples of TreeTableElement


Examples of com.vaadin.testbench.elements.TreeTableElement

    @Test
    public void testExpanding() throws IOException {
        openTestURL();

        TreeTableElement treeTable = $(TreeTableElement.class).first();
        List<WebElement> rows = treeTable.findElement(
                By.className("v-table-body")).findElements(By.tagName("tr"));
        assertEquals("unexpected row count", 4, rows.size());
        assertEquals("unexpected contents", "root1", treeTable.getCell(0, 0)
                .getText());
        assertEquals("unexpected contents", "root2", treeTable.getCell(1, 0)
                .getText());
        assertEquals("unexpected contents", "root3", treeTable.getCell(2, 0)
                .getText());
        assertEquals("unexpected contents", "END", treeTable.getCell(3, 0)
                .getText());

        // expand first row, should have 10 children
        treeTable.getCell(0, 0)
                .findElement(By.className("v-treetable-treespacer")).click();

        treeTable = $(TreeTableElement.class).first();
        rows = treeTable.findElement(By.className("v-table-body"))
                .findElements(By.tagName("tr"));
        assertEquals("unexpected row count", 14, rows.size());

        // expand root3, should have 200 children
        assertEquals("unexpected contents", "root3", treeTable.getCell(12, 0)
                .getText());
        treeTable.getCell(12, 0)
                .findElement(By.className("v-treetable-treespacer")).click();

        // expand root2, should have 200 children
        assertEquals("unexpected contents", "root2", treeTable.getCell(11, 0)
                .getText());
        treeTable.getCell(11, 0)
                .findElement(By.className("v-treetable-treespacer")).click();

        treeTable = $(TreeTableElement.class).first();
        rows = treeTable.findElement(By.className("v-table-body"))
                .findElements(By.tagName("tr"));
        assertEquals("unexpected row count", 414, rows.size());

        // scroll all the way to the bottom
        WebElement ui = findElement(By.className("v-ui"));
View Full Code Here

Examples of com.vaadin.testbench.elements.TreeTableElement

    @Test
    public void testNotification() throws InterruptedException {
        openTestURL();

        TreeTableElement treeTable = $(TreeTableElement.class).first();
        treeTable.getCell(1, 0)
                .findElement(By.className("v-treetable-treespacer")).click();
        sleep(100);

        WebElement link = treeTable.getCell(2, 1).findElement(
                By.className("v-link"));
        assertEquals("3", link.getText());
    }
View Full Code Here

Examples of com.vaadin.testbench.elements.TreeTableElement

    @Test
    public void testNotification() throws InterruptedException {
        openTestURL();

        TreeTableElement treeTable = $(TreeTableElement.class).first();
        List<WebElement> rows = treeTable.findElement(
                By.className("v-table-body")).findElements(By.tagName("tr"));

        WebElement treeSpacer = rows.get(0).findElement(
                By.className("v-treetable-treespacer"));
        treeSpacer.click();

        sleep(100);

        rows = treeTable.findElement(By.className("v-table-body"))
                .findElements(By.tagName("tr"));
        WebElement button = rows.get(2).findElement(By.className("v-button"));
        button.click();

        List<WebElement> notifications = findElements(By
View Full Code Here

Examples of com.vaadin.testbench.elements.TreeTableElement

    public void testDescriptions() throws Exception {
        openTestURL();

        checkTooltipNotPresent();

        TreeTableElement treeTable = $(TreeTableElement.class).first();
        List<CheckBoxElement> checkboxes = $(CheckBoxElement.class).all();
        assertEquals(3, checkboxes.size());

        // check text description
        TestBenchElement cell_1_0 = treeTable.getCell(1, 0);
        checkTooltip(cell_1_0, "Cell description item 1, Text");

        // move somewhere without a description
        checkTooltip(checkboxes.get(2), null);

        // check button description
        TestBenchElement cell_1_1 = treeTable.getCell(1, 1);
        checkTooltip(cell_1_1, "Button 1 description");

        // move somewhere without a description
        checkTooltip(checkboxes.get(2), null);

        // check textfield's description
        TestBenchElement cell_1_2 = treeTable.getCell(1, 2);
        checkTooltip(cell_1_2, "Textfield's own description");

        // move somewhere without a description
        checkTooltip(checkboxes.get(2), null);

        // uncheck component tooltips
        checkboxes.get(0).findElement(By.tagName("input")).click();

        // check text description
        cell_1_0 = treeTable.getCell(1, 0);
        checkTooltip(cell_1_0, "Cell description item 1, Text");

        // move somewhere without a description
        checkTooltip(checkboxes.get(2), null);

        // check button description
        cell_1_1 = treeTable.getCell(1, 1);
        checkTooltip(cell_1_1, "Cell description item 1, Component");

        // move somewhere without a description
        checkTooltip(checkboxes.get(2), null);

        // check textfield's description
        cell_1_2 = treeTable.getCell(1, 2);
        checkTooltip(cell_1_2, "Cell description item 1, Generated component");

        // move somewhere without a description
        checkTooltip(checkboxes.get(2), null);

        // check component tooltips
        checkboxes.get(0).findElement(By.tagName("input")).click();
        // uncheck cell tooltips
        checkboxes.get(1).findElement(By.tagName("input")).click();

        // check text description
        cell_1_0 = treeTable.getCell(1, 0);
        checkTooltip(cell_1_0, "Row description item 1");

        // move somewhere without a description
        checkTooltip(checkboxes.get(2), null);

        // check button description
        cell_1_1 = treeTable.getCell(1, 1);
        checkTooltip(cell_1_1, "Button 1 description");

        // move somewhere without a description
        checkTooltip(checkboxes.get(2), null);

        // check textfield's description
        cell_1_2 = treeTable.getCell(1, 2);
        checkTooltip(cell_1_2, "Textfield's own description");

        // move somewhere without a description
        checkTooltip(checkboxes.get(2), null);

        // uncheck component tooltips
        checkboxes.get(0).findElement(By.tagName("input")).click();

        // check text description
        cell_1_0 = treeTable.getCell(1, 0);
        checkTooltip(cell_1_0, "Row description item 1");

        // move somewhere without a description
        checkTooltip(checkboxes.get(2), null);

        // check button description
        cell_1_1 = treeTable.getCell(1, 1);
        checkTooltip(cell_1_1, "Row description item 1");

        // move somewhere without a description
        checkTooltip(checkboxes.get(2), null);

        // check textfield's description
        cell_1_2 = treeTable.getCell(1, 2);
        checkTooltip(cell_1_2, "Row description item 1");

        // move somewhere without a description
        checkTooltip(checkboxes.get(2), null);
    }
View Full Code Here

Examples of com.vaadin.testbench.elements.TreeTableElement

    @Test
    public void testLongScroll() throws IOException, InterruptedException {
        openTestURL();

        TreeTableElement treeTable = $(TreeTableElement.class).first();
        List<WebElement> rows = treeTable.findElement(
                By.className("v-table-body")).findElements(By.tagName("tr"));
        assertEquals("unexpected row count", 4, rows.size());

        // expand the first root element
        treeTable.getCell(0, 0)
                .findElement(By.className("v-treetable-treespacer")).click();
        treeTable = $(TreeTableElement.class).first();

        // wait for the scrollposition element to disappear
        waitUntilNot(ExpectedConditions.visibilityOfElementLocated(By
                .className("v-table-scrollposition")));

        rows = treeTable.findElement(By.className("v-table-body"))
                .findElements(By.tagName("tr"));
        assertEquals("unexpected cached row count", 46, rows.size());

        // TODO: replace these with just treeTable.scroll(int) when #13826 has
        // been fixed
        TestBenchElementCommands scrollable = testBenchElement(treeTable
                .findElement(By.className("v-scrollable")));

        // scroll far enough down to drop the first row from the cache
        // but not far enough to reach the last row
        scrollable.scroll(1692);

        // wait for the scrollposition element to disappear
        waitUntilNot(ExpectedConditions.visibilityOfElementLocated(By
                .className("v-table-scrollposition")));

        assertEquals("elements found where there should be none", 0, treeTable
                .findElements(By.vaadin("#row[0]/col[0]")).size());
        assertEquals("elements found where there should be none", 0, treeTable
                .findElements(By.vaadin("#row[203]/col[0]")).size());

        // scroll 6000 to make sure to actually hit bottom
        scrollable.scroll(6000);

        // wait for the scrollposition element to disappear
        waitUntilNot(ExpectedConditions.visibilityOfElementLocated(By
                .className("v-table-scrollposition")));

        // check the contents
        treeTable = $(TreeTableElement.class).first();
        rows = treeTable.findElement(By.className("v-table-body"))
                .findElements(By.tagName("tr"));
        assertEquals("unexpected cached row count", 45, rows.size());
        assertEquals("unexpected cell contents (final row expected)", "END",
                treeTable.getCell(203, 0).getText());
        assertEquals("unexpected cell contents (first visible row expected)",
                "188", treeTable.getCell(189, 0).getText());
        assertEquals("unexpected cell contents (first cached row expected)",
                "158", treeTable.getCell(159, 0).getText());

        assertEquals("elements found where there should be none", 0, treeTable
                .findElements(By.vaadin("#row[158]/col[0]")).size());
        assertEquals("elements found where there should be none", 0, treeTable
                .findElements(By.vaadin("#row[204]/col[0]")).size());

        // check the actual visibility
        compareScreen("bottom");
    }
View Full Code Here

Examples of com.vaadin.testbench.elements.TreeTableElement

    @Test
    public void testNegativeArraySize() throws IOException,
            InterruptedException {
        openTestURL();

        TreeTableElement treeTable = $(TreeTableElement.class).first();
        List<WebElement> rows = treeTable.findElement(
                By.className("v-table-body")).findElements(By.tagName("tr"));
        assertEquals("unexpected row count", 4, rows.size());

        // expand the first root element
        treeTable.getCell(0, 0)
                .findElement(By.className("v-treetable-treespacer")).click();

        // wait for the scrollposition element to disappear
        waitUntilNot(ExpectedConditions.visibilityOfElementLocated(By
                .className("v-table-scrollposition")));

        treeTable = $(TreeTableElement.class).first();
        rows = treeTable.findElement(By.className("v-table-body"))
                .findElements(By.tagName("tr"));
        assertEquals("unexpected cached row count", 46, rows.size());

        // TODO: replace these with just treeTable.scroll(int) when #13826 has
        // been fixed
        TestBenchElementCommands scrollable = testBenchElement(treeTable
                .findElement(By.className("v-scrollable")));

        // scroll far enough down to reach the second root item again
        scrollable.scroll(3969);

        // wait for the scrollposition element to disappear
        waitUntilNot(ExpectedConditions.visibilityOfElementLocated(By
                .className("v-table-scrollposition")));

        assertEquals("elements found where there should be none", 0, treeTable
                .findElements(By.vaadin("#row[0]/col[0]")).size());
        assertEquals("unexpected cell contents", "root2",
                treeTable.getCell(201, 0).getText());
        assertEquals("unexpected cell contents", "END",
                treeTable.getCell(203, 0).getText());

        // expand the second root element
        treeTable.getCell(201, 0)
                .findElement(By.className("v-treetable-treespacer")).click();

        // wait for the scrollposition element to disappear
        waitUntilNot(ExpectedConditions.visibilityOfElementLocated(By
                .className("v-table-scrollposition")));

        // ensure the last cached row isn't the final row
        treeTable = $(TreeTableElement.class).first();
        rows = treeTable.findElement(By.className("v-table-body"))
                .findElements(By.tagName("tr"));
        String elementText = rows.get(rows.size() - 1)
                .findElement(By.className("v-table-cell-wrapper")).getText();
        assertFalse("final row found when it should be beyond cache",
                elementText.contains("END"));

        // collapse the second root element
        treeTable.getCell(201, 0)
                .findElement(By.className("v-treetable-treespacer")).click();

        // wait for the scrollposition element to disappear
        waitUntilNot(ExpectedConditions.visibilityOfElementLocated(By
                .className("v-table-scrollposition")));

        // check the contents
        treeTable = $(TreeTableElement.class).first();
        rows = treeTable.findElement(By.className("v-table-body"))
                .findElements(By.tagName("tr"));
        assertEquals("unexpected cached row count", 45, rows.size());
        assertEquals("unexpected cell contents (final row expected)", "END",
                treeTable.getCell(203, 0).getText());
        assertEquals("unexpected cell contents (first visible row expected)",
                "188", treeTable.getCell(189, 0).getText());
        assertEquals("unexpected cell contents (first cached row expected)",
                "158", treeTable.getCell(159, 0).getText());

        assertEquals("elements found where there should be none", 0, treeTable
                .findElements(By.vaadin("#row[158]/col[0]")).size());
        assertEquals("elements found where there should be none", 0, treeTable
                .findElements(By.vaadin("#row[204]/col[0]")).size());

        // check the actual visibility
        compareScreen("bottom");
    }
View Full Code Here

Examples of org.primefaces.cookbook.model.chapter5.TreeTableElement

    private TreeNode[] selectedItems;

    public TreeTableController() {
        root = new DefaultTreeNode("root", null);

        TreeNode node1 = new DefaultTreeNode("node", new TreeTableElement("Node1", "1st Column", "2nd Column"), root);
        TreeNode node2 = new DefaultTreeNode("node", new TreeTableElement("Node2", "1st Column", "2nd Column"), root);

        TreeNode node11 = new DefaultTreeNode("leaf", new TreeTableElement("Node1.1", "1st Column", "2nd Column"), node1);
        TreeNode node12 = new DefaultTreeNode("leaf", new TreeTableElement("Node1.2", "1st Column", "2nd Column"), node1);

        TreeNode node21 = new DefaultTreeNode("node", new TreeTableElement("Node2.1", "1st Column", "2nd Column"), node2);
        TreeNode node211 = new DefaultTreeNode("leaf", new TreeTableElement("Node2.1.1", "1st Column", "2nd Column"), node21);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.