Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deflake teleport/Welcome/Welcome.test.tsx #49870

Merged
merged 1 commit into from
Dec 6, 2024
Merged

Conversation

ravicious
Copy link
Member

@ravicious ravicious commented Dec 6, 2024

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 use findByText rather than getByText. The difference is that getByText fails immediately, while findByText waits up to 1 second for the element to show up, see Types of Queries.

@ravicious ravicious added this pull request to the merge queue Dec 6, 2024
Merged via the queue into master with commit e5a318a Dec 6, 2024
43 checks passed
@ravicious ravicious deleted the r7s/welcome-deflake branch December 6, 2024 11:51
@public-teleport-github-review-bot

@ravicious See the table below for backport results.

Branch Result
branch/v15 Create PR
branch/v16 Create PR
branch/v17 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Welcome.test.tsx flakiness
3 participants