Open
Description
🚀 Feature Request
expect
can take a custom message to display if the assertion fails. Would like the ability to optionally provide a function to construct and return the message.
Example
async def mesg(loc):
# create a useful error message based on the locator.
return fancy_message
await expect(loc, message=mesg)
Motivation
In cases where additional context is useful to explain the assertion failure, being able to construct this dynamically based on the locator in question would be useful.
Constructing the failure message beforehand isn't feasible since the locators may have changed while waiting.