use of com.vaadin.flow.component.button.testbench.ButtonElement in project flow by vaadin.
the class FusionFormIT method save_backend_loaded_empty_values_for_required_fields_no_runtime_errors.
@Test
public void save_backend_loaded_empty_values_for_required_fields_no_runtime_errors() {
ButtonElement loadDataButton = $(ButtonElement.class).id("load-from-endpoint");
loadDataButton.click();
ButtonElement saveButton = $(ButtonElement.class).id("save");
waitUntil(driver -> saveButton.isEnabled());
saveButton.click();
NotificationElement notification = $(NotificationElement.class).id("notification");
Assert.assertNotNull(notification);
waitUntil(driver -> notification.isOpen());
Assert.assertTrue(notification.getText().contains("must not be empty"));
Assert.assertFalse(notification.getText().contains("Expected string but received null"));
}
use of com.vaadin.flow.component.button.testbench.ButtonElement in project skeleton-starter-flow-spring by vaadin.
the class MainViewIT method testClickButtonShowsHelloAnonymousUserNotificationWhenUserNameIsEmpty.
@Test
public void testClickButtonShowsHelloAnonymousUserNotificationWhenUserNameIsEmpty() {
ButtonElement button = $(ButtonElement.class).waitForFirst();
button.click();
$(NotificationElement.class).waitForFirst();
Assert.assertTrue($(NotificationElement.class).exists());
NotificationElement notification = $(NotificationElement.class).first();
Assert.assertEquals("Hello anonymous user", notification.getText());
}
use of com.vaadin.flow.component.button.testbench.ButtonElement in project skeleton-starter-flow-spring by vaadin.
the class MainViewIT method clickingButtonTwiceShowsTwoNotifications.
@Test
public void clickingButtonTwiceShowsTwoNotifications() {
Assert.assertFalse($(NotificationElement.class).exists());
ButtonElement button = $(ButtonElement.class).waitForFirst();
button.click();
button.click();
$(NotificationElement.class).waitForFirst();
Assert.assertEquals(2, $(NotificationElement.class).all().size());
}
use of com.vaadin.flow.component.button.testbench.ButtonElement in project flow by vaadin.
the class FusionFormIT method save_empty_values_for_required_fields_no_runtime_errors.
@Test
public void save_empty_values_for_required_fields_no_runtime_errors() {
ButtonElement saveButton = $(ButtonElement.class).id("save");
saveButton.click();
NotificationElement notification = $(NotificationElement.class).id("notification");
Assert.assertNotNull(notification);
waitUntil(driver -> notification.isOpen());
Assert.assertTrue(notification.getText().contains("must not be empty"));
Assert.assertFalse(notification.getText().contains("Expected string but received a undefined"));
}
use of com.vaadin.flow.component.button.testbench.ButtonElement 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());
}
Aggregations