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
Fix flaky unit test for the CMReleasesContainer component #20233
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -59,8 +59,10 @@ describe('CMReleasesContainer', () => { | |||
it('should render the container', async () => { | |||
render(); | |||
|
|||
const informationBox = await screen.findByRole('complementary', { name: 'Releases' }); | |||
expect(informationBox).toBeInTheDocument(); | |||
await waitFor(async () => { |
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.
I think findBy queries already use a waitFor https://testing-library.com/docs/dom-testing-library/api-async#findby-queries. I think what you end up doing here with an additional waitFor is increase the timeout / retries. But It looks like you can pass waitFor options to the findBy query to do that as well.
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.
Mark is right, it'll also fail if it's not in the document. There's probably a different async
fetch happening elsewhere that updates the component, you might needed to await something else.
Already fixed in #20250 |
What does it do?
I tried to find a way to fix the flaky unit test in the content releases
Why is it needed?
To pass the CI step