use of com.vaadin.flow.component.notification.testbench.NotificationElement 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.notification.testbench.NotificationElement 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());
}
use of com.vaadin.flow.component.notification.testbench.NotificationElement 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.notification.testbench.NotificationElement 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());
}
use of com.vaadin.flow.component.notification.testbench.NotificationElement 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"));
}
Aggregations