Package com.vaadin.testbench

Examples of com.vaadin.testbench.TestBenchElement


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

        TestBenchElement cell = $(TableElement.class).first().getCell(3, 0);
        cell.click();

        TestBenchElement button = $(ButtonElement.class).first();
        button.focus();

        int buttonLocation = button.getLocation().getY();

        button.click();

        int newButtonLocation = button.getLocation().getY();

        assertThat(
                "Button location has changed after table refresh, window has scrolled and it shouldn't have",
                newButtonLocation, is(buttonLocation));
View Full Code Here


        openTestURL();
    }

    @Test
    public void windowScrollTest() throws IOException, InterruptedException {
        TestBenchElement panelScrollable = (TestBenchElement) getDriver()
                .findElement(By.className("v-panel-content"));
        Dimension panelScrollableSize = panelScrollable.getSize();

        WebElement verticalLayout = panelScrollable.findElement(By
                .className("v-verticallayout"));
        Dimension verticalLayoutSize = verticalLayout.getSize();

        panelScrollable.scroll(verticalLayoutSize.height);

        WebElement button = verticalLayout
                .findElement(By.className("v-button"));

        button.click();
View Full Code Here

        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);
View Full Code Here

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

        TestBenchElement tab = (TestBenchElement) getDriver().findElement(
                By.className("v-tabsheet-tabitemcell"));
        tab.click(10, 10);

        Point oldLocation = tab.getLocation();

        tab.sendKeys(Keys.SPACE);

        Point newLocation = tab.getLocation();

        Assert.assertEquals(oldLocation, newLocation);
    }
View Full Code Here

     */
    private boolean scrollRight() {
        List<WebElement> scrollElements = getDriver().findElements(
                By.className("v-tabsheet-scrollerNext"));
        if (!scrollElements.isEmpty()) {
            TestBenchElement rightScrollElement = (TestBenchElement) scrollElements
                    .get(0);
            rightScrollElement.click(5, 5);
            return true;
        } else {
            return false;
        }
    }
View Full Code Here

        sendKeys(5, Keys.SPACE);
        assertSheet(5);
        compareScreen("skip-disabled-to-tab5");

        TestBenchElement addTabButton = (TestBenchElement) getDriver()
                .findElements(By.className("v-button")).get(0);

        click(addTabButton);

        click(5);
View Full Code Here

     * Provide the tab at specified index.
     */
    private TestBenchElement tab(int index) {
        By by = By.className("v-tabsheet-tabitemcell");

        TestBenchElement element = (TestBenchElement) getDriver().findElements(
                by).get(index - 1);

        String expected = "Tab " + index;
        Assert.assertEquals(expected,
                element.getText().substring(0, expected.length()));

        return element;
    }
View Full Code Here

        assertSelection(3, 1);

    }

    private void assertSelection(int expectedIndex, int wrongIndex) {
        TestBenchElement tabExpected = tab(expectedIndex);
        String attributeClassExpected = tabExpected.getAttribute("class");

        Assert.assertTrue("Tab " + expectedIndex + " should be selected.",
                attributeClassExpected
                        .contains("v-tabsheet-tabitemcell-selected"));

        TestBenchElement tabWrong = tab(wrongIndex);
        String attributeClassWrong = tabWrong.getAttribute("class");

        Assert.assertTrue("Tab " + wrongIndex
                + " should be selected when click on Tab 4",
                !attributeClassWrong
                        .contains("v-tabsheet-tabitemcell-selected"));
View Full Code Here

     * Provide the tab at specified index.
     */
    private TestBenchElement tab(int index) {
        By by = By.className("v-tabsheet-tabitemcell");

        TestBenchElement element = (TestBenchElement) getDriver().findElements(
                by).get(index - 1);

        String expected = "Tab " + index;
        Assert.assertEquals(expected,
                element.getText().substring(0, expected.length()));

        return element;
    }
View Full Code Here

        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();
        checkTooltipNotPresent();
View Full Code Here

TOP

Related Classes of com.vaadin.testbench.TestBenchElement

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.