All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.mvysny.kaributesting.v8.Notifications.kt Maven / Gradle / Ivy

The newest version!
package com.github.mvysny.kaributesting.v8

import com.vaadin.ui.Notification
import com.vaadin.ui.UI

/**
 * Returns the list of currently displayed notifications.
 */
public fun getNotifications(): List = UI.getCurrent().extensions.filterIsInstance()

/**
 * Expects that given list of notifications is displayed. Also clears the notifications.
 */
public fun expectNotifications(vararg descriptions: Pair) {
    val notifications: List = getNotifications()
    expectList(*descriptions) { notifications.map { it.caption to it.description } }
    clearNotifications()
}

/**
 * Expects that there are no notifications displayed.
 */
public fun expectNoNotifications() {
    expectNotifications()
}

/**
 * Clears and removes all notifications from screen.
 */
public fun clearNotifications() {
    getNotifications().forEach { it.remove() }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy