Closed charliematters closed 1 year ago
As of user-event
14, all of these APIs are async
. We need to target the latest version because recorder extensions can't access your package.json
.
I also don't think we need to await
the selectors because Chrome's recorder already has a waitForElement
step that can be used when a test relies on async selectors. Adding await
where it's not needed can cause race conditions and make tests slower with indirection.
Ah, I'm a version behind - sorry!
I haven't looked through the whole list, but the
userEvent.click
method doesn't return a promise, but we might want to await the selector? e.g.await userEvent.click(screen.getByText("foo"))
might be better asuserEvent.click(await screen.findByText("foo"))
I don't know the intricacies of Chrome's recorder, so this might be unworkable, but it's worth checking which userEvent calls need await