Open harkinj opened 5 years ago
Good question @harkinj,
Not sure what the right answer is. On one hand waitForElement
is more future proof if you use this test as a template for more complicated tests where the text is rendered asynchronously, but on the other hand it makes the simple test look more complicated than it is. There are a few more reasons why I'd keep it:
getByText
by itself doesn't look like an assertion. Someone who doesn't understand how RTL works under the hood (I don't!) might think the test is lacking an assertion.Hi, Thanks for your quick response. As u say its not clear which is better but I take on your points. Thanks again John
Hi, Thanks for this great site. This 1st simple test uses
await waitForElement(() => getByText(/hello Satoshi/i))
does it need to use waitForElement? Would getByText alone work? Thanks for the info. John