-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Tabs: Fix flaky unit tests #58629
Tabs: Fix flaky unit tests #58629
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
await waitFor( async () => | ||
expect( await getSelectedTab() ).toHaveTextContent( | ||
'Beta' | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also add this same waiting time after the rerender
calls?
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Looking at @ciampo's comment above and testing further i'm still seeing some slight flakiness. Sometimes I have to run the test 200 times to get it to break, but eventually it does. I remain stumped as to why this test remains flaky. It's specifically the So far I've determined that:
|
cc @diegohaz in case anything comes to mind! |
I'd try to wait for something before await sleep();
await press.Tab(); In our internal tests, our |
Thank you @diegohaz! Catching up to this after being afk for a bit. I just ran a quick test and adding a @mirka I see you self-assigned this one, I'm happy to keep working on it, but I haven't pushed any changes because I don't want to duplicate effort. Let me know if/how I can help! |
@chad1008 Go ahead, I haven't done anything yet 👍 Let me know and I can take over at any point! |
Would be nice to finish and land this as some continuous flakiness has been reported. We can then closely monitor for further flakiness and react accordingly. |
Just pushed an update to this PR that implements a the one |
Flaky tests detected in 907fa33. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7894449815
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Will reuse the same sleep()
approach in #58968.
Thank you @tyxla! |
What?
Fixes flaky tests!
Why?
Because tests, unlike pastry, should not be flaky!
How?
The Ariakit internals go through a few different renders on selection changes. This can cause the test to run an assertion before the component is actually ready, especially in Controlled Mode.
this PR adds
waitFor
falls to our first assertions after Controlled mode selection changes in the newest unit tests. That ensures the component is done rendering before moving forward.Testing Instructions
Just wait for that beautiful green checkmark.