Description
Describe the feature you'd like:
Matchers that work when running tests in Puppeteer.
Suggested implementation:
Puppeteer methods return ElementHandles that are proxies for elements in the DOM in the browser it's communicating with. jest-dom currently expects actual HTMLElements. So at a high level, it seems like an implementation approach could be to proxy the methods jest-dom is calling on the HTMLElements into calls to, say, ElementHandle
.evaluate. ElementHandle's methods are all async, so the matchers would need to be async -- perhaps this could be done with a parallel set of async matchers to the existing (sync) matchers.
Describe alternatives you've considered:
- Not using jest-dom with puppeteer :(
- Possibly this would belong in its own repo, something like jest-dom-pptr-adapter
Teachability, Documentation, Adoption, Migration Strategy:
This would likely be straightforward: simply mentioning in the docs that jest-dom is compatible with puppeteer, and noting that the async versions of the matchers would need to be used.