I have loved using both Formik and React Testing Library. At this point in the React community, I consider these tools to be nice sensible defaults...
For further actions, you may consider blocking this person and/or reporting abuse
Hi Charles ! I'm having kind of the same issue, but I'm not sure this really works. Since you don't await your
wait
call, I think your test will end before the expects in your wait argument succeed. I'm still trying to figure out how to fix this :(.Hi Maxime,
did you find a way to fix it ?
Yeah, this will give you a false positive.
how so?
If you do not await the wait in an async function, the test is over before the expectation could be evaluated.
In my case, I needed not just
await
theexpect
, but the problem also was the Formik did not call thehandleSubmit
callback. I had to fire asubmit
event on the form element itself.Hello. How do you submit an event on the form in the test?
Basically like this:
container
is the value returned in the object by therender
method.wait()
was recently deprecated and replaced withwaitFor()
testing-library.com/docs/dom-testi...Thanks! this worked like a charm for me.
Amen
Thanks man!
Thanks. This held me up for more than an hour. Never thought to wait on the assertions!