Deflake teleport/Welcome/Welcome.test.tsx #49870
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #41403.
I had "teleport/components/Welcome › should have correct welcome prompt flow for reset" fail because
screen.getByText(/submit/i)
failed to find such element in the DOM.The tests in this file depend on checking if some service method was called, but they don't wait for the UI to process the response. Instead of depending on a method being called, they should rather check the UI state and confirm that an operation was finished before proceeding. As I don't have time to fully rewrite the tests, I changed them so that after any
expect(foo).toHaveBeenCalled()
they usefindByText
rather thangetByText
. The difference is thatgetByText
fails immediately, whilefindByText
waits up to 1 second for the element to show up, see Types of Queries.