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

[ResponseOps][Cases] Fix StatusFilter flaky test #189982

Merged
merged 2 commits into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ const LABELS = {
inProgress: i18n.STATUS_IN_PROGRESS,
};

// FLAKY: https://github.com/elastic/kibana/issues/177334
describe.skip('StatusFilter', () => {
describe('StatusFilter', () => {
const onChange = jest.fn();
const defaultProps = {
selectedOptionKeys: [],
Expand All @@ -37,16 +36,18 @@ describe.skip('StatusFilter', () => {
it('should render', async () => {
render(<StatusFilter {...defaultProps} />);

expect(await screen.findByTestId('options-filter-popover-button-status')).toBeInTheDocument();
expect(await screen.findByTestId('options-filter-popover-button-status')).not.toBeDisabled();

userEvent.click(await screen.findByRole('button', { name: 'Status' }));

await waitForEuiPopoverOpen();

expect(await screen.findByRole('option', { name: LABELS.open })).toBeInTheDocument();
expect(await screen.findByRole('option', { name: LABELS.inProgress })).toBeInTheDocument();
expect(await screen.findByRole('option', { name: LABELS.closed })).toBeInTheDocument();
expect((await screen.findAllByRole('option')).length).toBe(3);
const options = await screen.findAllByRole('option');

expect(options.length).toBe(3);
expect(options[0]).toHaveTextContent(LABELS.open);
expect(options[1]).toHaveTextContent(LABELS.inProgress);
expect(options[2]).toHaveTextContent(LABELS.closed);
});

it('should call onStatusChanged when changing status to open', async () => {
Expand All @@ -68,10 +69,13 @@ describe.skip('StatusFilter', () => {
render(<StatusFilter {...defaultProps} hiddenStatuses={[CaseStatuses.closed]} />);

userEvent.click(await screen.findByRole('button', { name: 'Status' }));

await waitForEuiPopoverOpen();

expect(await screen.findAllByRole('option')).toHaveLength(2);
expect(await screen.findByRole('option', { name: LABELS.open })).toBeInTheDocument();
expect(await screen.findByRole('option', { name: LABELS.inProgress })).toBeInTheDocument();
const options = await screen.findAllByRole('option');

expect(options.length).toBe(2);
expect(options[0]).toHaveTextContent(LABELS.open);
expect(options[1]).toHaveTextContent(LABELS.inProgress);
});
});