aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/components/textfield/CompatibilityTextFieldShortcutTest.java
blob: 5c5d27727251143af90cc16891cc2add55ed0edb (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
package com.vaadin.tests.components.textfield;

import static org.junit.Assert.assertEquals;

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

import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.NotificationElement;
import com.vaadin.tests.tb3.SingleBrowserTest;

public class CompatibilityTextFieldShortcutTest extends SingleBrowserTest {

    private static final String TEXTFIELD_VALUE = "input";
    private static final String NOTIFICATION = "Received F8: "
            + TEXTFIELD_VALUE;

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

        WebElement textFieldText = findElement(By.tagName("input"));
        $(ButtonElement.class).first().click();

        waitForElementVisible(By.className("focus-label"));
        textFieldText.sendKeys(TEXTFIELD_VALUE);

        textFieldText.sendKeys(Keys.F8);

        assertEquals(NOTIFICATION,
                $(NotificationElement.class).first().getCaption());
    }
}