-
Notifications
You must be signed in to change notification settings - Fork 15
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 of queryByXXX vs getByXXX #53
Comments
@simoncollins thank you for submitting this. I will definitely add a note about this to the docs as well as a link to the cheat sheet that breaks down when to use what query. |
Great, thanks @benmonro ... much appreciated, and thanks for the library! |
Sure! Oh by the way would you mind sharing the error message you were
seeing?
On Mon, Oct 28, 2019 at 10:45 PM Simon Collins ***@***.***> wrote:
Great, thanks @benmonro <https://github.com/benmonro> ... much
appreciated, and thanks for the library!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#53?email_source=notifications&email_token=AADBPBDCYXKU5UKXZZ5H3CTQQ7EXBA5CNFSM4JGDUFU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECPJ5SI#issuecomment-547266249>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADBPBCFSBXEPWKXPK5S7BDQQ7EXBANCNFSM4JGDUFUQ>
.
--
Ben Monro
Software Developer
|
Sure, it was:
Basically the app is quite sluggish to load at the moment and has a loading indicator before showing a login form with a link with the text |
thanks @simoncollins. added notes in testing-library/testing-library-docs#313 |
If you want to assert that an element exists and you have a page that loads slowly, you have to use
queryByXXX
selector variants, otherwise you will get intermittent failures usinggetByXXX
when the element is not available in time.I burnt a fair bit of time trying to figure out why I was getting intermittent failures because
I'm new to using
testing-library
and had forgotten that difference. I didn't initially make the connection that the error message I was seeing fromgetByText
was because it was throwing an exception and not allowing Testcafe to retry the selector until the element was available.Is it worth adding an example and/or notes about this usage distinction to the documentation? Currently they only show the usage of
getByXXX
selectors.The text was updated successfully, but these errors were encountered: