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

Fix flaky unit test for the CMReleasesContainer component #20233

Closed
wants to merge 8 commits into from

Conversation

simotae14
Copy link
Contributor

@simotae14 simotae14 commented Apr 30, 2024

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

@simotae14 simotae14 self-assigned this Apr 30, 2024
@simotae14 simotae14 marked this pull request as draft April 30, 2024 10:03
Copy link

vercel bot commented Apr 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
contributor-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 30, 2024 2:15pm

@simotae14 simotae14 changed the title Fix/fe flaky unit test Fix flaky unit test for the CMReleasesContainer component Apr 30, 2024
@simotae14 simotae14 added this to the 4.23.2 milestone Apr 30, 2024
@@ -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 () => {
Copy link
Contributor

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.

Copy link
Member

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.

@joshuaellis joshuaellis removed this from the 4.23.2 milestone May 1, 2024
@joshuaellis
Copy link
Member

since @remidej merged #20250, can we close this?

@simotae14
Copy link
Contributor Author

Already fixed in #20250

@simotae14 simotae14 closed this May 3, 2024
@simotae14 simotae14 deleted the fix/fe-flaky-unit-test branch May 3, 2024 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants