Package com.vaadin.testbench.elements

Examples of com.vaadin.testbench.elements.TextFieldElement


     * Tests that backspace in textfield does work
     */
    @Test
    public void testWithFocusOnInput() throws Exception {

        TextFieldElement textField = getTextField();

        // Try to delete characters in a text field.
        textField.sendKeys("textt");
        textField.sendKeys(BACK_SPACE);
        assertEquals("text", textField.getValue());
        checkButtonsCount();
    }
View Full Code Here


    /**
     * Tests that backspace action in the bottom component is prevented
     */
    @Test
    public void testWithFocusOnBottom() throws Exception {
        TextFieldElement textField = getTextField();

        // tab in last field set focus on bottom component
        textField.sendKeys(TAB);

        // Try to send back actions to the browser.
        new Actions(getDriver()).sendKeys(BACK_SPACE).perform();

        checkButtonsCount();
View Full Code Here

public class ValidatorCaptionTooltipTest extends TooltipTest {
    @Test
    public void validatorWithError() throws Exception {
        openTestURL();

        TextFieldElement field = $(TextFieldElement.class).get(0);
        String fieldValue = field.getAttribute("value");
        String expected = "Valid value is between 0 and 100. " + fieldValue
                + " is not.";
        checkTooltip(field, expected);
    }
View Full Code Here

    }

    @Test
    public void validatorWithoutError() throws Exception {
        openTestURL();
        TextFieldElement field = $(TextFieldElement.class).get(1);
        checkTooltip(field, null);
    }
View Full Code Here

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

        waitForElementVisible(By.className("v-textfield"));

        TextFieldElement textfield = $(TextFieldElement.class).first();
        textfield.focus();
        textfield.sendKeys("test");

        $(ButtonElement.class).first().click();

        new Actions(getDriver()).contextClick(textfield).perform();

        Assert.assertEquals("test", textfield.getValue());
    }
View Full Code Here

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

        TextFieldElement textField = $(TextFieldElement.class).first();
        assertThat(textField.getValue(), is("1,024,000"));

        $(ButtonElement.class).caption("Change Locale").first().click();
        assertThat(textField.getValue(), is("1.024.000"));
    }
View Full Code Here

        openTestURL();

        VerticalLayoutElement mainLayout = $(VerticalLayoutElement.class)
                .first();

        TextFieldElement textField = $(TextFieldElement.class).first();
        // Enter in mainlayout -> should trigger shortcut
        sendEnter(mainLayout);
        assertLastLogRowIs("1. Log button was clicked");

        // Enter in textfield -> should trigger shortcut
View Full Code Here

     */
    @Test
    public void notificationTest() throws Exception {
        openTestURL();

        TextFieldElement prefix = $(TextFieldElement.class).first();
        TextFieldElement postfix = $(TextFieldElement.class).get(1);
        NativeSelectElement type = $(NativeSelectElement.class).first();
        ButtonElement show = $(ButtonElement.class).first();

        prefix.clear();
        prefix.sendKeys("Prefix:");

        postfix.clear();
        postfix.sendKeys("- press ESC to close");

        type.selectByText(NotificationRole.ALERT.toString());

        show.click();
        waitForElementPresent(By.className("v-Notification"));

        NotificationElement notification = $(NotificationElement.class).first();

        String text = notification.getAttribute("role");
        Assert.assertTrue("Expected attribute 'role' to equal 'alert', found "
                + text, text.equals("alert"));

        text = getHiddenText(notification.findElements(
                By.className("v-assistive-device-only")).get(0));
        Assert.assertTrue("Expected 'Prefix:', found " + text,
                text.equals("Prefix:"));

        text = getHiddenText(notification.findElements(
                By.className("v-assistive-device-only")).get(1));
        Assert.assertTrue("Expected '- press ESC to close', found " + text,
                text.equals("- press ESC to close"));

        try {
            notification.closeNotification();
        } catch (Exception e) {
        }

        type.selectByText("STATUS");

        show.click();
        waitForElementPresent(By.className("v-Notification"));

        notification = $(NotificationElement.class).first();

        text = notification.getAttribute("role");
        Assert.assertTrue("Expected attribute 'role' to equal 'status', found "
                + text, text.equals("status"));

        try {
            notification.closeNotification();
        } catch (Exception e) {
        }

        prefix.clear();
        postfix.clear();

        show.click();
        waitForElementPresent(By.className("v-Notification"));

        WebElement element;
View Full Code Here

TOP

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

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.