Overview
MessageListElement is a Playwright wrapper for <vaadin-message-list>. It provides helpers to access individual messages, read their content (text, user name, time) and assert message count. Messages are rendered as <vaadin-message> children in light DOM.
Component tag: vaadin-message-list
Implements:
HasStyleElementHasThemeElement
Constructors
MessageListElement(Locator locator)
Create a newMessageListElement from an existing locator.
The Playwright locator for the
<vaadin-message-list> elementMessage Access Methods
getMessages()
Get a locator for all<vaadin-message> children.
Returns: Locator - Locator matching every message in the list
getMessage(int index)
Get a locator for a single message by index.Zero-based index of the message
Locator - Locator for the message at the given index
getMessageByUserName(String userName)
Get a locator for the first message whose author name contains the given text.The user name to search for
Locator - Locator for the matching message
Content Accessor Methods
getMessageText(int index)
Get the text content of the message at the given index.Zero-based index of the message
String - The message text
getMessageUserName(int index)
Get the user name of the message at the given index.Zero-based index of the message
String - The user name
getMessageTime(int index)
Get the time of the message at the given index.Zero-based index of the message
String - The time text
Assertion Methods
assertMessageCount(int count)
Assert that the list contains exactly the expected number of messages.Expected message count
assertEmpty()
Assert that the list contains no messages.assertMessageText(int index, String expected)
Assert that the message at the given index has the expected text.Zero-based index of the message
Expected message text
assertMessageUserName(int index, String expected)
Assert that the message at the given index has the expected user name.Zero-based index of the message
Expected user name
assertMessageTime(int index, String expected)
Assert that the message at the given index has the expected time.Zero-based index of the message
Expected time text
Static Factory Methods
get(Page page)
Get the first<vaadin-message-list> on the page.
The Playwright page instance
MessageListElement - The first message list on the page
get(Locator locator)
Get the first<vaadin-message-list> within a locator scope.
The scope to search within
MessageListElement - The first message list within the scope
Usage Example
Notes
- Messages are rendered as
<vaadin-message>elements in light DOM - Message content is accessed via shadow DOM parts:
name,time, andmessage - The message text uses a special slot mechanism and requires JavaScript evaluation
- Zero-based indexing is used for all message accessor methods