aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/components/table/TextFieldValueGoesMissingTest.java
blob: 5ede29fd93d931a88714be0163d657c496c9cd69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.vaadin.tests.components.table;

import static org.junit.Assert.assertEquals;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.interactions.Actions;

import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.TextFieldElement;
import com.vaadin.tests.tb3.MultiBrowserTest;

/**
 * Tests that a text field's value isn't cleared after a label in the same
 * layout is changed.
 *
 * @since 7.3
 * @author Vaadin Ltd
 */
public class TextFieldValueGoesMissingTest extends MultiBrowserTest {

    /* This test was rewritten from a TB2 test. */
    @Test
    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();

        assertEquals("test", textfield.getValue());
    }
}