Skip to content

Support Puppeteer #201

Open
Open
@sandinmyjoints

Description

@sandinmyjoints

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is neededneeds discussionWe need to discuss this to come up with a good solution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions