Package com.vaadin.testbench.elements

Examples of com.vaadin.testbench.elements.ButtonElement


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

        ButtonElement decreaseSize = $(ButtonElement.class).caption(
                "Decrease size").first();
        decreaseSize.click(); // decreasing container size from 50 to 40
        decreaseSize.click(); // decreasing container size from 40 to 30

        TableElement table = $(TableElement.class).first();
        // TableElement scroll not working properly, so we need to do this.
        // http://dev.vaadin.com/ticket/13826
        testBenchElement(table.findElement(By.className("v-scrollable")))
View Full Code Here


        // Set breakoint and look memory consuption in Profiler
        // Mozilla Firefox doesn't provide memory usage profiler, use chrome.

        openTestURL();

        ButtonElement btnAdd = $(ButtonElement.class).get(0);

        for (int i = 0; i < ITERATIONS; i++) {
            btnAdd.click();
            ButtonElement btnDel = $(ButtonElement.class).get(1);
            TableElement tbl = $(TableElement.class).get(0);
            Random rand = new Random();
            int scrollValue = rand.nextInt(1500);
            scrollTable(tbl, scrollValue);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            btnDel.click();
        }
        // Set breakoint and look memory consuption in Profiler
        btnAdd = $(ButtonElement.class).get(0);
    }
View Full Code Here

                .first();
        int buttonWidth = nativeButton.getSize().getWidth();

        assertButtonWidth(buttonWidth, containerWidth);

        ButtonElement button = vLayout.$(ButtonElement.class).first();
        buttonWidth = button.getSize().getWidth();
        assertButtonWidth(buttonWidth, containerWidth);

        // check button widths in table, also make sure that there is some
        // spacing between the table edges and buttons
        List<WebElement> rows = findElements(By
View Full Code Here

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

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

        // initialise contents
        button.click();
        sleep(500);

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

        // check that the final row is the one intended
        WebElement finalRow = rows.get(rows.size() - 1);
        WebElement label = finalRow.findElement(By.className("v-label"));
        assertEquals(TableRowScrolledBottom.part1 + 100
                + TableRowScrolledBottom.part2, label.getText());

        // add more rows
        button.click();
        sleep(500);

        rows = table.findElement(By.className("v-table-body")).findElements(
                By.tagName("tr"));
View Full Code Here

        List<ButtonElement> buttons = $(ButtonElement.class).all();
        assertFalse(buttons.isEmpty());

        // open alert dialog
        ButtonElement button = buttons.get(0);
        button.click();

        // ensure dialog opened
        waitForElementPresent(By.className("v-window"));
        WindowElement window = $(WindowElement.class).first();

        // ensure correct attributes
        assertEquals("alertdialog", window.getAttribute("role"));

        WebElement header = window.findElement(By.className("v-window-header"));
        assertEquals(header.getAttribute("id"),
                window.getAttribute("aria-labelledby"));

        WebElement label = window.findElement(By.className("v-label"));
        assertEquals(label.getAttribute("id"),
                window.getAttribute("aria-describedby"));

        List<WebElement> wButtons = window.findElements(By
                .className("v-button"));
        assertEquals("button", wButtons.get(0).getAttribute("role"));
        assertEquals("button", wButtons.get(1).getAttribute("role"));

        // close dialog
        wButtons.get(0).click();

        // ensure dialog closed
        List<WindowElement> windows = $(WindowElement.class).all();
        assertTrue(windows.isEmpty());

        // check additional description (second checkbox on the page)
        List<CheckBoxElement> checkBoxes = $(CheckBoxElement.class).all();
        WebElement input = checkBoxes.get(1).findElement(By.tagName("input"));
        // ensure that not checked yet
        assertEquals(null, input.getAttribute("checked"));
        input.click();
        // ensure that checked now
        assertEquals("true", input.getAttribute("checked"));

        // open alert dialog
        button = $(ButtonElement.class).first();
        button.click();

        waitForElementPresent(By.className("v-window"));

        // ensure correct attributes
        window = $(WindowElement.class).first();
        List<WebElement> labels = window.findElements(By.className("v-label"));
        assertEquals(labels.get(0).getAttribute("id") + " "
                + labels.get(1).getAttribute("id"),
                window.getAttribute("aria-describedby"));

        // close dialog
        wButtons = window.findElements(By.className("v-button"));
        wButtons.get(0).click();

        // ensure dialog closed
        windows = $(WindowElement.class).all();
        assertTrue(windows.isEmpty());

        // add prefix and postfix
        List<TextFieldElement> textFields = $(TextFieldElement.class).all();
        textFields.get(0).sendKeys("Important");
        textFields.get(1).sendKeys(" - do ASAP");

        // open alert dialog
        button = $(ButtonElement.class).first();
        button.click();

        waitForElementPresent(By.className("v-window"));

        // ensure the assistive spans have been added to the header
        window = $(WindowElement.class).first();
View Full Code Here

        mouse.mouseMove(buttonCoordinates, 0, 0);
    }

    private org.openqa.selenium.Dimension getButtonDimensions() {
        ButtonElement buttonElement = getButtonElement();

        return buttonElement.getWrappedElement().getSize();
    }
View Full Code Here

        eventCoordinates = getSecondLabelValue();
        Assert.assertNotEquals("0,0", eventCoordinates);
    }

    private void clickFirstButton() {
        ButtonElement button = $(ButtonElement.class).first();
        button.click();
    }
View Full Code Here

        ButtonElement button = $(ButtonElement.class).first();
        button.click();
    }

    private void clickSecondButton() {
        ButtonElement button = $(ButtonElement.class).get(1);
        button.click();
    }
View Full Code Here

                new ImageComparison(), new ReferenceNameGenerator());
        js.executeScript("arguments[0].scrollTop = " + 30, actualElement);
    }

    private String getCurrentPageFirstItemIndex() throws InterruptedException {
        ButtonElement updateLabelButton = $(ButtonElement.class).get(4);
        LabelElement label = $(LabelElement.class).get(1);
        updateLabelButton.click();
        sleep(200);
        return label.getText();
    }
View Full Code Here

        sleep(200);
        return label.getText();
    }

    private void addRow() {
        ButtonElement button = $(ButtonElement.class).get(0);
        button.click();
    }
View Full Code Here

TOP

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

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.