Package com.vaadin.testbench.elements

Examples of com.vaadin.testbench.elements.TableElement


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

        checkTooltipNotPresent();

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

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

        // move somewhere without a description
        checkboxes.get(2).showTooltip();
        checkTooltipNotPresent();

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

        // move somewhere without a description
        checkboxes.get(2).showTooltip();
        checkTooltipNotPresent();

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

        // move somewhere without a description
        checkboxes.get(2).showTooltip();
        checkTooltipNotPresent();

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

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

        // move somewhere without a description
        checkboxes.get(2).showTooltip();
        checkTooltipNotPresent();

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

        // move somewhere without a description
        new Actions(getDriver()).moveToElement(checkboxes.get(2)).perform();
        sleep(1000);
        checkTooltipNotPresent();

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

        // move somewhere without a description
        checkboxes.get(2).showTooltip();
        checkTooltipNotPresent();

        // 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 = table.getCell(1, 0);
        cell_1_0.showTooltip();
        checkTooltip("Row description item 1");

        // move somewhere without a description
        checkboxes.get(2).showTooltip();
        checkTooltipNotPresent();

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

        // move somewhere without a description
        checkboxes.get(2).showTooltip();
        checkTooltipNotPresent();

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

        // move somewhere without a description
        checkboxes.get(2).showTooltip();
        checkTooltipNotPresent();

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

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

        // move somewhere without a description
        checkboxes.get(2).showTooltip();
        checkTooltipNotPresent();

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

        // move somewhere without a description
        checkboxes.get(2).showTooltip();
        checkTooltipNotPresent();

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

        // move somewhere without a description
        checkboxes.get(2).showTooltip();
View Full Code Here


    @Test
    public void testPosition() throws Exception {
        openTestURL();

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

        TestBenchElement cell_3_0 = table.getCell(3, 0);

        // move to the center of the cell
        new Actions(getDriver()).moveToElement(cell_3_0).perform();
        sleep(1000);

        // ensure the tooltip is present
        checkTooltip("Cell description item 3, Text");
        clearTooltip();

        // move outside the cell
        new Actions(getDriver()).moveToElement(checkboxes.get(2)).perform();

        // move to the corner of the cell
        new Actions(getDriver()).moveToElement(cell_3_0, 0, 0).perform();
        sleep(1000);

        // ensure the tooltip is present
        checkTooltip("Cell description item 3, Text");
        clearTooltip();

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

        TestBenchElement cell_1_1 = table.getCell(1, 1);

        // move to the center of the cell
        new Actions(getDriver()).moveToElement(cell_1_1).perform();
        sleep(1000);

        // ensure the tooltip is present
        checkTooltip("Button 1 description");
        clearTooltip();

        // move to the corner of the element, outside of the button
        new Actions(getDriver()).moveToElement(cell_1_1, 0, 0).perform();
        sleep(1000);

        // ensure the tooltip is present
        checkTooltip("Row description item 1");
        clearTooltip();

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

        TestBenchElement cell_4_2 = table.getCell(4, 2);

        // move to the center of the cell
        new Actions(getDriver()).moveToElement(cell_4_2).perform();
        sleep(1000);
View Full Code Here

    public void testRowHeights() throws IOException {
        openTestURL();

        compareScreen("initial");

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

        rows.get(0).findElements(By.className("v-button")).get(1).click();
        rows.get(1).findElements(By.className("v-button")).get(1).click();
View Full Code Here

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

        TableElement table = $(TableElement.class).first();
        List<ButtonElement> buttons = $(ButtonElement.class).all();

        WebElement textField = table.findElement(By.className("v-textfield"));

        // click the button for decreasing size
        buttons.get(1).click();

        assertEquals(60, textField.getSize().width);
View Full Code Here

        return getTable().findElement(By.className("v-table-body"))
                    .findElements(By.tagName("tr"));
    }

    private void selectRow(int row) {
        TableElement table = getTable();

        table.getCell(row, 2).click();
    }
View Full Code Here

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

        TableElement table = $(TableElement.class).first();

        // check original value
        TestBenchElement cell_1_0 = table.getCell(1, 0);
        assertEquals(
                "original value not found, wrong cell or contents (1st column of the 2nd row expected)",
                "Teppo", cell_1_0.getText());

        // double-click to edit cell contents
        cell_1_0.click();
        new Actions(getDriver()).doubleClick(cell_1_0).build().perform();
        sleep(100);

        // fetch the updated cell
        WebElement textField = table.getCell(1, 0).findElement(
                By.className("v-textfield"));
        assertEquals(
                "original value not found, wrong cell or contents (1st column of the 2nd row expected)",
                "Teppo", textField.getAttribute("value"));

        // update value
        textField.clear();
        textField.sendKeys("baa");

        // click on another row
        table.getCell(0, 1).click();

        // check the value got updated correctly
        assertEquals(
                "updated value not found, wrong cell or contents (1st column of the 2nd row expected)",
                "baa", table.getCell(1, 0).getText());

        // check that selection got updated correctly
        List<WebElement> selected = table.findElement(
                By.className("v-table-body")).findElements(
                By.className("v-selected"));
        assertEquals(1, selected.size());

        WebElement content = selected.get(0).findElement(
View Full Code Here

    @Test
    public void testTableSortingIndicatorIsVisibleAfterServersideSort() {
        openTestURL();

        ButtonElement button = $(ButtonElement.class).caption("Sort").first();
        TableElement table = $(TableElement.class).first();

        Assert.assertFalse("Descending indicator was prematurely visible",
                getHeaderClasses(table).contains(TABLE_HEADER_DESC_INDICATOR));
        Assert.assertFalse("Ascending indicator was prematurely visible",
                getHeaderClasses(table).contains(TABLE_HEADER_ASC_INDICATOR));

        button.click();
        Assert.assertTrue("Indicator did not become visible",
                getHeaderClasses(table).contains(TABLE_HEADER_DESC_INDICATOR));
        Assert.assertFalse("Ascending sort indicator was wrongly visible",
                getHeaderClasses(table).contains(TABLE_HEADER_ASC_INDICATOR));

        table.getHeaderCell(0).click();
        Assert.assertFalse("Table sort indicator didn't change",
                getHeaderClasses(table).contains(TABLE_HEADER_DESC_INDICATOR));
        Assert.assertTrue("Ascending sort indicator didn't become visible",
                getHeaderClasses(table).contains(TABLE_HEADER_ASC_INDICATOR));
View Full Code Here

TOP

Related Classes of com.vaadin.testbench.elements.TableElement

Copyright © 2018 www.massapicom. 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.