-
Notifications
You must be signed in to change notification settings - Fork 29
Add find* queries #44
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
Add find* queries #44
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks so much for the contribution @umpox!
|
||
export interface IScopedQueryUtils extends IScopedQueryMethods { | ||
getQueriesForElement(): IQueryUtils & IScopedQueryUtils | ||
export interface IScopedQueryUtils extends BoundFunctions<IQueryMethods> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure BoundFunctions
will work for us if it uses HTMLElement
type inferences when we're using puppeteer ElementHandle
s
I know it's a pain, but maybe we just have to write our own type inference or just add waitForOpts?: WaitForElementOptions
as optional to the signature of all the methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could duplicate BoundFunctions
but with ElementHandle
instead of HTMLElement
? Everything else should be the same I think
|
||
## Known Limitations | ||
|
||
- `waitForElement` method is not exposed. Puppeteer has its own set of wait utilities that somewhat conflict with the style used in `@testing-library/dom`. See [#3](https://github.com/testing-library/pptr-testing-library/issues/3). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we want to remove this note, but maybe convert it to cover waitForDomChange
and waitForElementToBeRemoved
as well and nudge to "use the find*
methods instead".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check latest commit, writing documentation is hard 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't use find*
queries for waitForElementToBeRemoved
, but I think we should be able to get that working nicely. Didn't get round to it in this PR but I'll raise an issue if anyone else wants to do it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good thanks! :)
4c0d3e9
to
4d96f87
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @umpox ! this is great stuff 👍
Any plans to release a publish version? |
Adds all the
find*
queries from dom-testing-library.This should be quite useful given the asynchronous nature of E2E tests.
I have also updated the README to remove
waitForElement
as a known limitation, as it is deprecated indom-testing-library
and the recommended alternative isfind*
queries orwaitFor
which should now be supported!.