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

Use native Jest matchers #112

Open
gregberge opened this issue Aug 16, 2018 · 5 comments
Open

Use native Jest matchers #112

gregberge opened this issue Aug 16, 2018 · 5 comments

Comments

@gregberge
Copy link
Member

Jest supports asynchronous matchers and asymmetric matchers, two required things to port expect-puppeteer matchers into Jest matchers. Some problems still persist:

Some matchers are returning an element like toMatchElement()

A matcher should not return anything, yes. But it is very convenient to assert that something is in the page and get the element matched in the page. I think we probably need to rethink this part. I am open to propositions.

Some matchers are already used by Jest like toMatch

I think it is not a big problem, we can change the name. Also open to propositions.

@srounce
Copy link

srounce commented Aug 30, 2018

A matcher should not return anything, yes. But it is very convenient to assert that something is in the page and get the element matched in the page. I think we probably need to rethink this part. I am open to propositions.

Perhaps allow matchers to receive element refs instead of selectors? That way they're simply doing assertions.

// Edited because the original idea was silly.

@gregberge
Copy link
Member Author

gregberge commented Aug 30, 2018

Thanks for your suggestion but I am sorry didn't get it, can you show me an example of code?

@akahn87
Copy link

akahn87 commented Sep 6, 2018

👍 on the idea of allowing matchers to receive element refs instead of selectors. It would be nice to be able to do:

await expect(page).toClick($btn)

Where $btn is already an element handle.

@swissspidy
Copy link
Contributor

@gregberge so is this essentially a wontfix?

@gregberge gregberge reopened this Feb 4, 2023
@gregberge
Copy link
Member Author

Sorry it was a mistake.

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

4 participants