Should this expect be inside the setTimeout? I'm wondering if you are waiting 500ms to release the ArrowDown key but not for the expect. Maybe you could use the [waitforelementtoberemoved](https://testing-library.com/docs/dom-testing-library/api-async/#waitforelementtoberemoved)  instead