Search in sources :

Example 1 with TextFieldElement

use of com.vaadin.flow.component.textfield.testbench.TextFieldElement in project skeleton-starter-flow-spring by vaadin.

the class MainViewIT method testEnterShowsHelloUserNotificationWhenUserIsNotEmpty.

@Test
public void testEnterShowsHelloUserNotificationWhenUserIsNotEmpty() {
    TextFieldElement textField = $(TextFieldElement.class).waitForFirst();
    textField.setValue("Vaadiner");
    textField.sendKeys(Keys.ENTER);
    $(NotificationElement.class).waitForFirst();
    Assert.assertTrue($(NotificationElement.class).exists());
    NotificationElement notification = $(NotificationElement.class).first();
    Assert.assertEquals("Hello Vaadiner", notification.getText());
}
Also used : NotificationElement(com.vaadin.flow.component.notification.testbench.NotificationElement) TextFieldElement(com.vaadin.flow.component.textfield.testbench.TextFieldElement) Test(org.junit.Test)

Example 2 with TextFieldElement

use of com.vaadin.flow.component.textfield.testbench.TextFieldElement in project skeleton-starter-flow-spring by vaadin.

the class MainViewIT method testClickButtonShowsHelloUserNotificationWhenUserIsNotEmpty.

@Test
public void testClickButtonShowsHelloUserNotificationWhenUserIsNotEmpty() {
    TextFieldElement textField = $(TextFieldElement.class).waitForFirst();
    textField.setValue("Vaadiner");
    $(ButtonElement.class).waitForFirst().click();
    $(NotificationElement.class).waitForFirst();
    Assert.assertTrue($(NotificationElement.class).exists());
    NotificationElement notification = $(NotificationElement.class).first();
    Assert.assertEquals("Hello Vaadiner", notification.getText());
}
Also used : NotificationElement(com.vaadin.flow.component.notification.testbench.NotificationElement) TextFieldElement(com.vaadin.flow.component.textfield.testbench.TextFieldElement) Test(org.junit.Test)

Example 3 with TextFieldElement

use of com.vaadin.flow.component.textfield.testbench.TextFieldElement in project flow by vaadin.

the class SimpleIT method simplePage_withWhiteList_works.

@Test
public void simplePage_withWhiteList_works() {
    TestBenchElement viewElement = $("simple-view").first();
    ButtonElement button = viewElement.$(ButtonElement.class).id("button");
    button.click();
    TextFieldElement log = viewElement.$(TextFieldElement.class).id("log");
    Assert.assertEquals(SimpleView.CLICKED_MESSAGE, log.getValue());
}
Also used : TextFieldElement(com.vaadin.flow.component.textfield.testbench.TextFieldElement) ButtonElement(com.vaadin.flow.component.button.testbench.ButtonElement) TestBenchElement(com.vaadin.testbench.TestBenchElement) ChromeBrowserTest(com.vaadin.flow.testutil.ChromeBrowserTest) Test(org.junit.Test)

Aggregations

TextFieldElement (com.vaadin.flow.component.textfield.testbench.TextFieldElement)3 Test (org.junit.Test)3 NotificationElement (com.vaadin.flow.component.notification.testbench.NotificationElement)2 ButtonElement (com.vaadin.flow.component.button.testbench.ButtonElement)1 ChromeBrowserTest (com.vaadin.flow.testutil.ChromeBrowserTest)1 TestBenchElement (com.vaadin.testbench.TestBenchElement)1