mvysny / karibu-testing

Vaadin Server-Side Browserless Containerless Unit Testing
Apache License 2.0
105 stars 14 forks source link

Vaadin 24 Notifications are emtpy #149

Closed simasch closed 1 year ago

simasch commented 1 year ago

I have to tests that check for the content of a notification:

Notification notification = _get(Notification.class);
assertThat(notification.getElement().getOuterHTML()).isEqualTo("""
    <vaadin-notification suppress-template-warning>
     <template>
      Series saved
     </template>
    </vaadin-notification>""");

The notification is found but it's always empty.

mvysny commented 1 year ago

Hi Simon, could you please try calling NotificationsKt.expectNotifications("Series saved") whether that works?

Alternatively you can call https://github.com/mvysny/karibu-tools/blob/main/src/main/kotlin/Notifications.kt#L25 to obtain the notification text - since Vaadin 24 the text is no longer present in the HTML but is stored in the text property.

simasch commented 1 year ago

Hi @mvysny Thanks! Works great.