aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/tooltip/ValidatorCaptionTooltipTest.java
blob: 300dbc871f814b8696dabe5ff0bac4baff8fcf51 (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
package com.vaadin.tests.tooltip;

import org.junit.Test;

import com.vaadin.testbench.elements.TextFieldElement;
import com.vaadin.tests.tb3.TooltipTest;

/**
 * Test to see if validators create error tooltips correctly.
 *
 * @author Vaadin Ltd
 */
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);
    }

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