Skip to main content

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:
  • HasStyleElement
  • HasThemeElement

Constructors

MessageListElement(Locator locator)

Create a new MessageListElement from an existing locator.
Locator
required
The Playwright locator for the <vaadin-message-list> element

Message 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.
int
required
Zero-based index of the message
Returns: 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.
String
required
The user name to search for
Returns: Locator - Locator for the matching message

Content Accessor Methods

getMessageText(int index)

Get the text content of the message at the given index.
int
required
Zero-based index of the message
Returns: String - The message text

getMessageUserName(int index)

Get the user name of the message at the given index.
int
required
Zero-based index of the message
Returns: String - The user name

getMessageTime(int index)

Get the time of the message at the given index.
int
required
Zero-based index of the message
Returns: String - The time text

Assertion Methods

assertMessageCount(int count)

Assert that the list contains exactly the expected number of messages.
int
required
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.
int
required
Zero-based index of the message
String
required
Expected message text

assertMessageUserName(int index, String expected)

Assert that the message at the given index has the expected user name.
int
required
Zero-based index of the message
String
required
Expected user name

assertMessageTime(int index, String expected)

Assert that the message at the given index has the expected time.
int
required
Zero-based index of the message
String
required
Expected time text

Static Factory Methods

get(Page page)

Get the first <vaadin-message-list> on the page.
Page
required
The Playwright page instance
Returns: MessageListElement - The first message list on the page

get(Locator locator)

Get the first <vaadin-message-list> within a locator scope.
Locator
required
The scope to search within
Returns: 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, and message
  • The message text uses a special slot mechanism and requires JavaScript evaluation
  • Zero-based indexing is used for all message accessor methods