-
Notifications
You must be signed in to change notification settings - Fork 472
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 typescript definitions for findBy* queries #226
Comments
Pretty sure it's |
I put together the type definitions for findBy and findAllBy queries, but am unable to commit due to what seems like a Windows compatibility issue:
I could bypass the pre-commit as running lint locally passes, same with container.setAttribute('data-test-attribute', 'something changed twice')
- await skipSomeTimeForMutationObserver(50)
+ await skipSomeTimeForMutationObserver(200)
expect(callback).toHaveBeenCalledTimes(3) Created a PR referencing this issue, worst case it may help get the ball rolling, best case it is good to go with minor adjustments :) |
Thanks to @JaxCavalera, this has been resolved. |
This may be a naive question, but why is |
It shouldn't return an error, it returns a Promise that can reject with an error (which throws when used with async/await syntax) const btn = await findByText('add user') expect(await findByText('home')).toBeInTheDocument() |
@alexkrolick, Hmm, maybe there is a discrepancy. What you typed in the 2nd comment in this issue is not what is in the typings. In the typings it is const btn = await findByText('add user');
if (btn instanceof HTMLElement) {
// do the rest of the test
}
else {
throw new Error(btn.message);
} |
If you're a Typescript user, care to make a PR to fix that? |
Will do. I think the |
I don't trust myself with typing those, so if someone would be good enough to do that, I would appreciate it!
The text was updated successfully, but these errors were encountered: