Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Assertions custom message function support #2468

Open
infime opened this issue Jun 20, 2024 · 0 comments
Open

[Feature]: Assertions custom message function support #2468

infime opened this issue Jun 20, 2024 · 0 comments

Comments

@infime
Copy link

infime commented Jun 20, 2024

🚀 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants