Home > assistive-playwright-client > ExpectedText
Type of an expectation from a message coming from the screen reader.
Signature:
export declare type ExpectedText = ExpectedText[] | string | RegExp | ((text: string) => boolean);
References: ExpectedText
isMatch() can be used to check whether a specific message screenReaderText
from the screen reader matches an expectation expectedText
and ScreenReaderClient.waitForMessage() can be used to wait for a message from the screen reader that matches the expectation expectedText
.
expectedText
can be:
a string: the text matches if screenReaderText
contains the text in expectedText
a regular expression: the text matches if screenReaderText
matches the regular expression
a function: the function is called, and should return a boolean describing whether it matches or not.
an array: the text matches if there is a match with one of the items of the array (which can be a string, a regular expression, a function or a nested array), according to the rules previously mentioned