aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/components/abstractfield/ConfigurableAbstractFieldTest.java
blob: b61b69b0dea0d81dcc4c983028dce81c1b4d10d7 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.vaadin.tests.components.abstractfield;

import org.junit.Test;

import com.vaadin.testbench.By;
import com.vaadin.tests.tb3.SingleBrowserTest;

public abstract class ConfigurableAbstractFieldTest extends SingleBrowserTest {

    private static final org.openqa.selenium.By REQUIRED_BY = By
            .className("v-required");
    private static final org.openqa.selenium.By ERROR_INDICATOR_BY = By
            .className("v-errorindicator");

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

        assertNoRequiredIndicator();
        selectMenuPath("Component", "State", "Required");
        assertRequiredIndicator();
        selectMenuPath("Component", "State", "Required");
        assertNoRequiredIndicator();
    }

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

        assertNoErrorIndicator();
        selectMenuPath("Component", "State", "Error indicator");
        assertErrorIndicator();
        selectMenuPath("Component", "State", "Error indicator");
        assertNoErrorIndicator();
    }

    private void assertRequiredIndicator() {
        assertElementPresent(REQUIRED_BY);
    }

    private void assertNoRequiredIndicator() {
        assertElementNotPresent(REQUIRED_BY);
    }

    private void assertErrorIndicator() {
        assertElementPresent(ERROR_INDICATOR_BY);
    }

    private void assertNoErrorIndicator() {
        assertElementNotPresent(ERROR_INDICATOR_BY);
    }
}