Skip to content

Commit

Permalink
✅(markdown) fix flaky test on MarkdownEditor take 2
Browse files Browse the repository at this point in the history
A refacto on MarkdownEditor made the test flaky, we
replacing the bigger timeout on the waitFor with a waitForElementToBeRemoved
on one test to be sure the state is updated.
  • Loading branch information
kernicPanel committed Sep 16, 2023
1 parent 5b20776 commit 92f89a0
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
fireEvent,
screen,
waitFor,
waitForElementToBeRemoved,
within,
} from '@testing-library/react';
import userEvent from '@testing-library/user-event';
Expand Down Expand Up @@ -185,12 +186,7 @@ describe('<MarkdownEditor />', () => {
render(<MarkdownEditor markdownDocumentId={markdownDocument.id} />);

// Wait for rendered content: all loaders gone
await waitFor(
() => expect(screen.queryByRole('status')).not.toBeInTheDocument(),
{
timeout: 1000,
},
);
await waitForElementToBeRemoved(() => screen.queryByRole('status'));

expect(screen.getByTestId('renderer_container')).toContainHTML(
'<div class="markdown-body />',
Expand Down

0 comments on commit 92f89a0

Please sign in to comment.