aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/components/datefield/DateFieldNavigationKeyBoardTest.java
blob: d92b3ac2dc60cdd364b2195235ff82d02ea8f674 (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
package com.vaadin.tests.components.datefield;

import static org.junit.Assert.assertNotEquals;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;

import com.vaadin.tests.tb3.MultiBrowserTest;

public class DateFieldNavigationKeyBoardTest extends MultiBrowserTest {
    @Test
    public void testNavigation() {
        openTestURL();
        // Opening pop-up
        findElement(By.className("v-datefield-button")).click();
        waitForElementVisible(By.className("v-datefield-calendarpanel"));
        waitForElementPresent(
                By.className("v-datefield-calendarpanel-day-focused"));
        // Focused element in the calendarPanel
        WebElement focused = findElement(
                By.className("v-datefield-calendarpanel-day-focused"));
        // Value in it
        String dayValue = focused.getText();
        findElement(By.className("v-datefield-calendarpanel"))
                .sendKeys(Keys.ARROW_LEFT);
        assertNotEquals(dayValue,
                findElement(
                        By.className("v-datefield-calendarpanel-day-focused"))
                                .getText());
    }
}